This sections contains module documentation of main benchmark modules. Benchmark extension is bundled with hydratk (not standalone extension).
Modules provides class Extension inherited from class hydratk.core.extension.Extension. Unit tests available at hydratk/extensions/benchmark/benchmark/01_methods_ut.jedi
- _groups - test group to execute, default all
- _cycles - test cycles, default 20
- _outfile - output filename, dafault not generated
- _enable_gc - enable garbage collector, default False
- _result - test execution results
- _test_groups - test groups modules mapping
Method sets extension metadata (id, name, version, author, year).
Method registers action hooks.
commands - benchmark long options - bench-groups, bench-cycles, bench-out, bench-gc
Method handles command benchmark. It parses command options bench-groups, bench-cycles, bench-out, bench-gc. Default values are taken from configuration parameters groups (all), cycles (20), outfile (None), enable_gc (False). It fires event benchmark_start, calls method run_test_groups and fires event benchmark_finish.
Method executes requested test groups and prints report.
Method executes tests in given test group. Tests are stored in separate module which is imported. It returns test group results as dictionary.
Method executes given test. It uses class Timer from module timeit. Test code is imported in setup script. Test is executed several times according to option cycles. Garbage collector is enabled/disabled according to option enable_gc. It returns test results as list (execution times in milliseconds).
Method generates report in CSV format and stores it to file according to option outfile.
Method calculates statistic parameters from execution times. Mean, median, minimum, maximum, variance, standard deviation, 1st quartile, 3rd quartile.
Method prints report as formatted table (sorted by group, test). Statistic parameters are displayed only (not execution times).