Closed mdevine82 closed 9 years ago
We could just add a new setting and take it into account at xhprof_shutdown
.
The object holding all configs is already there
https://github.com/staabm/xhprof.io/blob/master/inc/prepend.php#L60
we could support lower thresholds for all provided information:
(
[ct] => 1 // number of calls.
[wt] => 419 // wall/wait time (ms).
[cpu] => 0 // cpu time.
[mu] => 8264 // memory usage (bytes).
[pmu] => 0 // peak memory usage.
)
I guess that makes sense. Even though most people would just care about wall time, we might as well take care of everything else.
We basically just get the final element and work with it from there.
$lastElement = end($xhprof_data);
reset($xhprof_data);
$wallTime = $lastElement['wt']
Now for the configs values, I guess we can just make them all default to zero. In terms of naming convention, would we want it to be ('min_wt' or 'min_wall_time').
Let me know your thoughts.
For configuration I prefer most readable strings, no matter if they map 1:1 to the underlying logic - min_wall_time
sounds good.
For a first step just checking the last element makes sense. The ct
isn't aggregated by xhprof so we cant support the threshold for this param.
The other things I was toying around with was adding in code in the shutdown function to only save perf runs that exceed a set threshold. Basically saying all runs with a total wall time of less than 500 ms, just ignore.
Thoughts?