Bridges-C++
3.4.4
Bridges(C++ API)
|
#include <SortingBenchmark.h>
Benchmarks sorting algorithm.
Benchmarks sorting algorithms and add time series to a LineChart.
The benchmark goes from an initial size controlled by setBaseSize() to a largest size controlled by setMaxSize(). One can also set a maximum time spent on a particular run using setTimeCap().
The benchmark goes from a array size of n to the next one of geoBase * n + increment, where the base is controlled by setGeometric() and increment is controlled by setIncrement(). For simpler use one can set a purley linear sampling with linearRange() or a purely geometric one with geometricRange().
The sorting algorithms must have for prototype: void (sort)(int array, int arraysize); and can be passed to the run function for being benchmarked. A typical use would look something like
Public Member Functions | |
SortingBenchmark (LineChart &p) | |
void | setGenerator (const std::string &generatorName) |
std::string | getGenerator () const |
void | setMaxSize (int size) |
Puts a cap on the largest array to be used. More... | |
void | setBaseSize (int size) |
Smallest array to be used. More... | |
void | setIncrement (int inc) |
Sets the increment for the benchmark size. More... | |
void | setGeometric (double base) |
Sets a geometric progression for the benchmark size. More... | |
void | linearRange (int baseSize, int maxSize, int nbPoint) |
The benchmark will sample a range with a fixed number of points. More... | |
void | geometricRange (int baseSize, int maxSize, double base) |
The benchmark will sample a range using in geometrically increasing sequence. More... | |
void | setTimeCap (double cap_in_s) |
sets an upper bound to the time of a run. More... | |
void | run (std::string algoName, void(*runnable)(int *, int)) |
benchmark one implementation More... | |
|
inline |
|
inline |
The benchmark will sample a range using in geometrically increasing sequence.
The benchmark will sample the range [baseSize; maxSize] using a geometric distribution in base base. That is to say, it will sample baseSize, base*baseSize, base*base*baseSize, ...
baseSize | lower bound of the range sampled |
maxSize | upper bound of the range sampled |
base | base of the geometric increase |
|
inline |
|
inline |
The benchmark will sample a range with a fixed number of points.
The benchmark will sample about nbPoint equally distributed in the range [baseSize; maxSize]
baseSize | lower bound of the range sampled |
maxSize | upper bound of the range sampled |
nbPoint | number of sample |
|
inline |
benchmark one implementation
algoName | screen name of the algorithm to be used in the visualization |
runnable | pointer to the sorting function to benchmark |
|
inline |
Smallest array to be used.
size | of the smallest array to use/ |
|
inline |
generatorName | possible values are "random", "inorder", "reverseorder", "fewdifferentvalues", "almostsorted" |
|
inline |
Sets a geometric progression for the benchmark size.
base | new base of the geometric progression |
|
inline |
Sets the increment for the benchmark size.
inc | new value of the increment |
|
inline |
Puts a cap on the largest array to be used.
size | Maximum size considered |
|
inline |
sets an upper bound to the time of a run.
The benchmark will end after a run if it takes more than the given amount of time. So it is possible a particular run takes more than the alloted time, but that will be the last run.
cap_in_s | time limit in seconds |