From: Simon J Mudd Date: Mon, 17 Nov 2014 08:23:49 +0000 (+0100) Subject: Collect only the data as we need it X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=01e5cd73ee698eae5490433c1e9eacc8e35ea502;p=pstop.git Collect only the data as we need it --- diff --git a/state/state.go b/state/state.go index 4df68d2..7b48221 100644 --- a/state/state.go +++ b/state/state.go @@ -75,11 +75,7 @@ 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() { - // collect all initial values on startup / reset - state.fsbi.Collect(state.dbh) - state.tlwsbt.Collect(state.dbh) - state.tiwsbt.Collect(state.dbh) - + state.CollectAll() state.UpdateInitialValues() } @@ -91,6 +87,13 @@ func (state *State) UpdateInitialValues() { lib.Logger.Println("state.UpdateInitialValues() took", time.Duration(time.Since(start)).String()) } +// collect all initial values on startup / reset +func (state *State) CollectAll() { + state.fsbi.Collect(state.dbh) + state.tlwsbt.Collect(state.dbh) + state.tiwsbt.Collect(state.dbh) +} + // Only collect the data we are looking at. func (state *State) Collect() { start := time.Now()