From 230955969f6512ba1271e4d000b725f5a810cbbc Mon Sep 17 00:00:00 2001 From: Simon J Mudd Date: Tue, 18 Nov 2014 05:12:44 +0100 Subject: [PATCH] Rename UpdateInitialValues() to SyncReferenceValues() --- .../file_summary_by_instance.go | 2 +- performance_schema/ps_table/ps_table.go | 2 +- .../table_io_waits_summary_by_table.go | 20 +++++++++++--------- .../table_lock_waits_summary_by_table.go | 2 +- state/state.go | 12 ++++++------ 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/performance_schema/file_summary_by_instance/file_summary_by_instance.go b/performance_schema/file_summary_by_instance/file_summary_by_instance.go index f71f1d6..10ef5f4 100644 --- a/performance_schema/file_summary_by_instance/file_summary_by_instance.go +++ b/performance_schema/file_summary_by_instance/file_summary_by_instance.go @@ -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) diff --git a/performance_schema/ps_table/ps_table.go b/performance_schema/ps_table/ps_table.go index 68957d7..e16d4b7 100644 --- a/performance_schema/ps_table/ps_table.go +++ b/performance_schema/ps_table/ps_table.go @@ -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 diff --git a/performance_schema/table_io_waits_summary_by_table/table_io_waits_summary_by_table.go b/performance_schema/table_io_waits_summary_by_table/table_io_waits_summary_by_table.go index ab1166b..6f8a232 100644 --- a/performance_schema/table_io_waits_summary_by_table/table_io_waits_summary_by_table.go +++ b/performance_schema/table_io_waits_summary_by_table/table_io_waits_summary_by_table.go @@ -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 { diff --git a/performance_schema/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table.go b/performance_schema/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table.go index 294d7c0..5ae561f 100644 --- a/performance_schema/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table.go +++ b/performance_schema/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table.go @@ -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) diff --git a/state/state.go b/state/state.go index 7b48221..1b4b54f 100644 --- a/state/state.go +++ b/state/state.go @@ -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 -- 2.7.4