changing branches
[pstop.git] / state / state.go
index 124b884..c799ccd 100644 (file)
@@ -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()