-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capture running statistics for algorithms #19
Capture running statistics for algorithms #19
Conversation
* Outputs summary stats to the console during running. * Outputs stats to a .stats.txt file for algorithms with statistics. * Writes the stats into the HTML report under each algo graph that has stats. The table support dynamically showing or hiding best or worst stats, similarly to the time comparison table. Also includes utility headers, shiftstats.h and bitstats.h that define common stat names that many algorithms use.
* A few search algorithms have more than one main index, e.g. Boyer Moore. * This just provides a convenient place to capture those stats without having to resort to algo-specific values.
* If there's a few algorithm defined stats, they tend to run over a line in a console, even with reasonably long lines. * Keep the names as short as possible, to keep things as neat as possible.
* A few algorithms maintain more than one table, this header can be used to define the basic bit stats for two tables.
* We don't record this anymore, as we store a stat per pattern length anyway.
I should add, collecting stats does not affect normal benchmark timings, as stats are collected in a separate search function after the main search is timed. |
One thing I have found using stats is that the code uses too much stack memory. With a normal number of algorithms to test it's not a problem - but I recently profiled over 1000 algorithms and it would crash. I had to comment out the stats code to run normal profiling. I think, if you're still interested in it, it should be altered to allocate memory on the heap. I have found the stats capability useful in practice to understand what algorithms are doing, although I only use it occasionally. |
This PR has changes which allow algorithms to report running statistics.
Running
To obtain stats in a run, use the
-stats
flag:Standard Stats
It's entirely up to the implementer what stats are reported, but a standard set of statistics is provided that fit most search algorithms.
Algorithm defined Stats
Algorithms can define up to 8 stats particular to an algorithm. To do this, they must implement the
getAlgoValueNames()
function. These are often the same for particular kinds of algorithm. Below is an example from\include\bitstats.h
, which defines two stats useful for some bit-oriented algorithms.If you don't want to implement any special stats for an algorithm, an empty set of stat names should be returned:
Algorithms
This PR makes no changes to any existing algorithms, so on it's own, running
-stats
will do nothing - no algorithms support it!I'll submit changes to families of existing algorithms which have had stats added to them in batches in further PRs.
To test stats, you should look at these PRs, which are branched off this.