by looking at the pattern defined in the server. Currently I'm using
hard-coded stuff which matches personal usage.
-2. Only tested on MySQL 5.6. It should be possible to make this work
-on MySQL 5.7 and also MariaDB 10.0 but that has not been tested yet.
+2. Only tested on MySQL 5.6 and MariaDB 10.0. It should be possible
+to make this work on MySQL 5.7 but that has not been tested yet.
fmt.Println("Caught a signal", sig)
done <- struct{}{}
case <-ticker.C:
+ state.Collect()
state.Display()
case event := <-termboxChan:
// switch on event type
finished = true
case termbox.KeyTab: // tab - change display modes
state.DisplayNext()
+ state.Display()
}
switch event.Ch {
case '-': // decrease the interval if > 1
finished = true
case 't': // toggle between absolute/relative statistics
state.SetWantRelativeStats(!state.WantRelativeStats())
+ state.Display()
case 'z': // reset the statistics to now by taking a query of current values
state.ResetDBStatistics()
+ state.Display()
}
case termbox.EventResize: // set sizes
state.ScreenSetSize(event.Width, event.Height)
+ state.Display()
case termbox.EventError: // quit
log.Fatalf("Quitting because of termbox error: \n%s\n", event.Err)
}
// do a fresh collection of data and then update the initial values based on that.
func (state *State) ResetDBStatistics() {
- state.fsbi.Collect(state.dbh)
- state.fsbi.UpdateInitialValues()
+ state.Collect()
+ state.UpdateInitialValues()
+}
- state.tlwsbt.Collect(state.dbh)
+func (state *State) UpdateInitialValues() {
+ state.fsbi.UpdateInitialValues()
state.tlwsbt.UpdateInitialValues()
+ state.tiwsbt.UpdateInitialValues()
+}
+func (state *State) Collect() {
+ state.fsbi.Collect(state.dbh)
+ state.tlwsbt.Collect(state.dbh)
state.tiwsbt.Collect(state.dbh)
- state.tiwsbt.UpdateInitialValues()
}
func (state State) MySQLVersion() string {
}
func (state *State) displayOpsOrLatency() {
- state.tiwsbt.Collect(state.dbh)
-
state.screen.PrintAt(0, 2, state.tiwsbt.Headings())
max_rows := state.screen.Height() - 3
// show actual I/O latency values
func (state State) displayIO() {
- state.fsbi.Collect(state.dbh)
-
state.screen.PrintAt(0, 2, state.fsbi.Headings())
// print out the data
}
func (state *State) displayLocks() {
- state.tlwsbt.Collect(state.dbh)
-
state.screen.PrintAt(0, 2, state.tlwsbt.Headings())
// print out the data