Rename UpdateInitialValues() to SyncReferenceValues()
authorSimon J Mudd <sjmudd@pobox.com>
Tue, 18 Nov 2014 04:12:44 +0000 (05:12 +0100)
committerSimon J Mudd <sjmudd@pobox.com>
Tue, 18 Nov 2014 04:12:44 +0000 (05:12 +0100)
performance_schema/file_summary_by_instance/file_summary_by_instance.go
performance_schema/ps_table/ps_table.go
performance_schema/table_io_waits_summary_by_table/table_io_waits_summary_by_table.go
performance_schema/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table.go
state/state.go

index f71f1d6..10ef5f4 100644 (file)
@@ -56,7 +56,7 @@ type File_summary_by_instance struct {
 }
 
 // reset the statistics to current values
-func (t *File_summary_by_instance) UpdateInitialValues() {
+func (t *File_summary_by_instance) SyncReferenceValues() {
        t.SetNow()
        t.initial = make(file_summary_by_instance_rows, len(t.current))
        copy(t.initial, t.current)
index 68957d7..e16d4b7 100644 (file)
@@ -10,7 +10,7 @@ import (
 // a table of rows
 type Tabler interface {
        Collect(dbh *sql.DB)
-       UpdateInitialValues()
+       SyncReferenceValues()
        Headings() string
        RowContent(max_rows int) []string
        TotalRowContent() string
index ab1166b..6f8a232 100644 (file)
@@ -37,19 +37,19 @@ func (t Table_io_waits_summary_by_table) WantsLatency() bool {
 // relative values, after which it stores totals.
 func (t *Table_io_waits_summary_by_table) Collect(dbh *sql.DB) {
        start := time.Now()
-       lib.Logger.Println("Table_io_waits_summary_by_table.Collect() BEGIN")
+       // lib.Logger.Println("Table_io_waits_summary_by_table.Collect() BEGIN")
        t.current = select_tiwsbt_rows(dbh)
-       lib.Logger.Println("- t.current set from", len(t.current), "collected row(s) from SELECT")
+       lib.Logger.Println("t.current collected", len(t.current), "row(s) from SELECT")
 
        if len(t.initial) == 0 && len(t.current) > 0 {
-               // lib.Logger.Println("- setting t.initial to initial value" )
+               lib.Logger.Println("t.initial: copying from t.current (initial setup)" )
                t.initial = make(table_io_waits_summary_by_table_rows, len(t.current))
                copy(t.initial, t.current)
        }
 
        // check for reload initial characteristics
        if t.initial.needs_refresh(t.current) {
-               // lib.Logger.Println( "- t.initial data needs refreshing!" )
+               lib.Logger.Println( "t.initial: copying from t.current (data needs refreshing)" )
                t.initial = make(table_io_waits_summary_by_table_rows, len(t.current))
                copy(t.initial, t.current)
        }
@@ -58,8 +58,10 @@ func (t *Table_io_waits_summary_by_table) Collect(dbh *sql.DB) {
 
        // lib.Logger.Println( "t.initial:", t.initial )
        // lib.Logger.Println( "t.current:", t.current )
-       lib.Logger.Println("t.results:", t.results)
-       lib.Logger.Println("t.totals:", t.totals)
+       lib.Logger.Println("t.initial.totals():", t.initial.totals() )
+       lib.Logger.Println("t.current.totals():", t.current.totals() )
+       // lib.Logger.Println("t.results:", t.results)
+       // lib.Logger.Println("t.totals:", t.totals)
        lib.Logger.Println("Table_io_waits_summary_by_table.Collect() END, took:", time.Duration(time.Since(start)).String())
 }
 
@@ -79,15 +81,15 @@ func (t *Table_io_waits_summary_by_table) make_results() {
 }
 
 // reset the statistics to current values
-func (t *Table_io_waits_summary_by_table) UpdateInitialValues() {
-       // lib.Logger.Println( "Table_io_waits_summary_by_table.UpdateInitialValues() BEGIN" )
+func (t *Table_io_waits_summary_by_table) SyncReferenceValues() {
+       // lib.Logger.Println( "Table_io_waits_summary_by_table.SyncReferenceValues() BEGIN" )
 
        t.initial = make(table_io_waits_summary_by_table_rows, len(t.current))
        copy(t.initial, t.current)
 
        t.make_results()
 
-       // lib.Logger.Println( "Table_io_waits_summary_by_table.UpdateInitialValues() END" )
+       // lib.Logger.Println( "Table_io_waits_summary_by_table.SyncReferenceValues() END" )
 }
 
 func (t *Table_io_waits_summary_by_table) Headings() string {
index 294d7c0..5ae561f 100644 (file)
@@ -57,7 +57,7 @@ func (t *Table_lock_waits_summary_by_table) make_results() {
 }
 
 // reset the statistics to current values
-func (t *Table_lock_waits_summary_by_table) UpdateInitialValues() {
+func (t *Table_lock_waits_summary_by_table) SyncReferenceValues() {
        t.SetNow()
        t.initial = make(table_lock_waits_summary_by_table_rows, len(t.current))
        copy(t.initial, t.current)
index 7b48221..1b4b54f 100644 (file)
@@ -76,15 +76,15 @@ func (state *State) Setup(dbh *sql.DB) {
 // do a fresh collection of data and then update the initial values based on that.
 func (state *State) ResetDBStatistics() {
        state.CollectAll()
-       state.UpdateInitialValues()
+       state.SyncReferenceValues()
 }
 
-func (state *State) UpdateInitialValues() {
+func (state *State) SyncReferenceValues() {
        start := time.Now()
-       state.fsbi.UpdateInitialValues()
-       state.tlwsbt.UpdateInitialValues()
-       state.tiwsbt.UpdateInitialValues()
-       lib.Logger.Println("state.UpdateInitialValues() took", time.Duration(time.Since(start)).String())
+       state.fsbi.SyncReferenceValues()
+       state.tlwsbt.SyncReferenceValues()
+       state.tiwsbt.SyncReferenceValues()
+       lib.Logger.Println("state.SyncReferenceValues() took", time.Duration(time.Since(start)).String())
 }
 
 // collect all initial values on startup / reset