Module bench
source code
Benchmarking.
Run each test 3 times and get median value. Using 10K array as base
test time.
Each other test compared with base with next formula:
Tc * Nb
q = ---------
Tb * Nc
Here:
* Tc - execution time of current test * Tb - execution time of base *
Nb - array size of base (10K) * Nc - array size of current test
If resulting value is ``q <= 1.0`` it's the best possible result,
i.e. time increase proportionally to array size.
|
|
Measure
Measure execution time helper.
|
|
|
HELP = 'Usage: python _bench.py [OPTIONS]\n\nOptions:\n -h ...
|
|
Return median value for the list of values.
- Parameters:
values - list of values for processing.
- Returns:
- median value.
|
|
Run func with argument fobj and measure execution time.
- Parameters:
func - function for test
fobj - data for test
- Returns:
- execution time
|
|
Run each test N times.
- Parameters:
func - function for test
hexstr - string with content of hex file to read
n - times to repeat.
- Returns:
- (median time, times list)
|
|
Run each test N times.
- Parameters:
func - function for test
n - times to repeat.
- Returns:
- (median time, times list)
|
|
Return time coefficient relative to base numbers.
- Parameters:
tc - current test time
nc - current test data size
tb - base test time
nb - base test data size
- Returns:
- time coef.
|
|
Create test data on given pattern.
- Parameters:
n1 - size of first part of array at base address 0.
offset - offset for second part of array.
n2 - size of second part of array at given offset.
- Returns:
- (overall size, hex file, IntelHex object)
|
|
Main function to run benchmarks.
- Parameters:
argv - command-line arguments.
- Returns:
- exit code (0 is OK).
|
HELP
- Value:
'''Usage: python _bench.py [OPTIONS]
Options:
-h this help
-n N repeat tests N times
-r run only tests for read operation
-w run only tests for write operation
...
|
|