X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=state%2Fstate.go;h=c799ccdf3bac228c3b35b2fd8bc3848b3390a845;hb=9c17baa1e5fb1582c5bbed49280a9ee672142332;hp=682fb1cd20cccce6b5e1c5d33678d7e13230d09e;hpb=193ae41f5473832680f1969a1e0bc19bc27909b8;p=pstop.git diff --git a/state/state.go b/state/state.go index 682fb1c..c799ccd 100644 --- a/state/state.go +++ b/state/state.go @@ -13,6 +13,7 @@ import ( "github.com/sjmudd/pstop/lib" fsbi "github.com/sjmudd/pstop/p_s/file_summary_by_instance" "github.com/sjmudd/pstop/p_s/ps_table" + "github.com/sjmudd/pstop/wait_info" tiwsbt "github.com/sjmudd/pstop/p_s/table_io_waits_summary_by_table" tlwsbt "github.com/sjmudd/pstop/p_s/table_lock_waits_summary_by_table" "github.com/sjmudd/pstop/screen" @@ -31,6 +32,7 @@ const ( ) type State struct { + finished bool datadir string dbh *sql.DB help bool @@ -43,10 +45,12 @@ type State struct { show Show mysql_version string want_relative_stats bool + wait_info.WaitInfo // embedded } func (state *State) Setup(dbh *sql.DB) { state.dbh = dbh + state.finished = false state.screen.Initialise() @@ -83,6 +87,16 @@ func (state *State) Setup(dbh *sql.DB) { state.SetDatadir(datadir) } +// have we finished ? +func (state State) Finished() bool { + return state.finished +} + +// indicate we have finished +func (state *State) SetFinished() { + state.finished = true +} + // do a fresh collection of data and then update the initial values based on that. func (state *State) ResetDBStatistics() { state.CollectAll() @@ -261,7 +275,7 @@ func (state State) displayDescription() { } func (state *State) displayOpsOrLatency() { - state.screen.PrintAt(0, 2, state.tiwsbt.Headings()) + state.screen.BoldPrintAt(0, 2, state.tiwsbt.Headings()) max_rows := state.screen.Height() - 3 row_content := state.tiwsbt.RowContent(max_rows) @@ -280,12 +294,12 @@ func (state *State) displayOpsOrLatency() { } // print out the totals at the bottom - state.screen.PrintAt(0, state.screen.Height()-1, state.tiwsbt.TotalRowContent()) + state.screen.BoldPrintAt(0, state.screen.Height()-1, state.tiwsbt.TotalRowContent()) } // show actual I/O latency values func (state State) displayIO() { - state.screen.PrintAt(0, 2, state.fsbi.Headings()) + state.screen.BoldPrintAt(0, 2, state.fsbi.Headings()) // print out the data max_rows := state.screen.Height() - 3 @@ -305,11 +319,11 @@ func (state State) displayIO() { } // print out the totals at the bottom - state.screen.PrintAt(0, state.screen.Height()-1, state.fsbi.TotalRowContent()) + state.screen.BoldPrintAt(0, state.screen.Height()-1, state.fsbi.TotalRowContent()) } func (state *State) displayLocks() { - state.screen.PrintAt(0, 2, state.tlwsbt.Headings()) + state.screen.BoldPrintAt(0, 2, state.tlwsbt.Headings()) // print out the data max_rows := state.screen.Height() - 3 @@ -329,11 +343,11 @@ func (state *State) displayLocks() { } // print out the totals at the bottom - state.screen.PrintAt(0, state.screen.Height()-1, state.tlwsbt.TotalRowContent()) + state.screen.BoldPrintAt(0, state.screen.Height()-1, state.tlwsbt.TotalRowContent()) } func (state *State) displayUsers() { - state.screen.PrintAt(0, 2, state.users.Headings()) + state.screen.BoldPrintAt(0, 2, state.users.Headings()) // print out the data max_rows := state.screen.Height() - 3 @@ -353,7 +367,7 @@ func (state *State) displayUsers() { } // print out the totals at the bottom - state.screen.PrintAt(0, state.screen.Height()-1, state.users.TotalRowContent()) + state.screen.BoldPrintAt(0, state.screen.Height()-1, state.users.TotalRowContent()) } // do we want to show all p_s data?