Class globals debug Probe
Probe class - collect statistics; controlled via property tree Data can be viewed / modified in the prop tree /_debug/nas/probe/<myLabel>/* ./enable bool, ./reset bool, reset hit counters to 0 and _start_time to now ./hits[i] number of hits, by default i=0 -> hits secondary counters can be added under the same path with addCounter() ./time after generateStats() show how long the probe was enabled ./hps after generateStats() show avg. hits/second ./hitratio after generateStats() if two counters: hits[1]/hits[0] == Example == var myProbe = debug.Probe.new("myLabel").enable(); var cnt2 = myProbe.addCounter(); # create a 2nd counter #at the place of interest (e.g. in some loop or class method) insert: myProbe.hit(); # count how often this place in the code is hit if (condition) myProbe.hit(cnt2); # count how often condition is true print(myProbe.getHits()); print(myProbe.getHits(cnt2)/myProbe.getHits()); # print hit ratio
Functions
addCounter
add secondary counter(s) returns counter id
disable
disable counting, write time and hit/s to property tree
enable
enable counting
hit
increment counter (if enabled) use addCounter() before using counter_id > 0
new
label: Used in property path prefix: Optional
setTimeout
set timeout, next hit() after timeout will disable()