git://git.iain.cx/iain
/
pstop.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bba62c7
)
Collect only the data as we need it
author
Simon J Mudd
<sjmudd@pobox.com>
Mon, 17 Nov 2014 08:21:20 +0000
(09:21 +0100)
committer
Simon J Mudd
<sjmudd@pobox.com>
Mon, 17 Nov 2014 08:21:20 +0000
(09:21 +0100)
state/state.go
patch
|
blob
|
history
diff --git
a/state/state.go
b/state/state.go
index
8898331
..
4df68d2
100644
(file)
--- a/
state/state.go
+++ b/
state/state.go
@@
-75,7
+75,11
@@
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() {
// do a fresh collection of data and then update the initial values based on that.
func (state *State) ResetDBStatistics() {
- state.Collect()
+ // collect all initial values on startup / reset
+ state.fsbi.Collect(state.dbh)
+ state.tlwsbt.Collect(state.dbh)
+ state.tiwsbt.Collect(state.dbh)
+
state.UpdateInitialValues()
}
state.UpdateInitialValues()
}
@@
-87,11
+91,18
@@
func (state *State) UpdateInitialValues() {
lib.Logger.Println("state.UpdateInitialValues() took", time.Duration(time.Since(start)).String())
}
lib.Logger.Println("state.UpdateInitialValues() took", time.Duration(time.Since(start)).String())
}
+// Only collect the data we are looking at.
func (state *State) Collect() {
start := time.Now()
func (state *State) Collect() {
start := time.Now()
- state.fsbi.Collect(state.dbh)
- state.tlwsbt.Collect(state.dbh)
- state.tiwsbt.Collect(state.dbh)
+
+ switch state.show {
+ case showLatency, showOps:
+ state.tiwsbt.Collect(state.dbh)
+ case showIO:
+ state.fsbi.Collect(state.dbh)
+ case showLocks:
+ state.tlwsbt.Collect(state.dbh)
+ }
lib.Logger.Println("state.Collect() took", time.Duration(time.Since(start)).String())
}
lib.Logger.Println("state.Collect() took", time.Duration(time.Since(start)).String())
}