brintos

brintos / linux-shallow public Read only

0
0
Text · 4.6 KiB · 97727ae Raw
125 lines · plain
1This is cpufreq-bench, a microbenchmark for the cpufreq framework.2 3Purpose4=======5 6What is this benchmark for:7  - Identify worst case performance loss when doing dynamic frequency8    scaling using Linux kernel governors9  - Identify average reaction time of a governor to CPU load changes10  - (Stress) Testing whether a cpufreq low level driver or governor works11    as expected12  - Identify cpufreq related performance regressions between kernels13  - Possibly Real time priority testing? -> what happens if there are14    processes with a higher prio than the governor's kernel thread15  - ...16 17What this benchmark does *not* cover:18  - Power saving related regressions (In fact as better the performance19    throughput is, the worse the power savings will be, but the first should20    mostly count more...)21  - Real world (workloads)22 23 24Description25===========26 27cpufreq-bench helps to test the condition of a given cpufreq governor.28For that purpose, it compares the performance governor to a configured29powersave module.30 31 32How it works33============34You can specify load (100% CPU load) and sleep (0% CPU load) times in us which35will be run X time in a row (cycles):36 37         sleep=2500038         load=2500039         cycles=2040 41This part of the configuration file will create 25ms load/sleep turns,42repeated 20 times.43 44Adding this:45         sleep_step=2500046         load_step=2500047         rounds=548Will increase load and sleep time by 25ms 5 times.49Together you get following test:5025ms  load/sleep time repeated 20 times (cycles).5150ms  load/sleep time repeated 20 times (cycles).52..53100ms load/sleep time repeated 20 times (cycles).54 55First it is calibrated how long a specific CPU intensive calculation56takes on this machine and needs to be run in a loop using the performance57governor.58Then the above test runs are processed using the performance governor59and the governor to test. The time the calculation really needed60with the dynamic freq scaling governor is compared with the time needed61on full performance and you get the overall performance loss.62 63 64Example of expected results with ondemand governor:65 66This shows expected results of the first two test run rounds from67above config, you there have:68 69100% CPU load (load) | 0 % CPU load (sleep)  | round70   25 ms             |    25 ms              |   171   50 ms             |    50 ms              |   272 73For example if ondemand governor is configured to have a 50ms74sampling rate you get:75 76In round 1, ondemand should have rather static 50% load and probably77won't ever switch up (as long as up_threshold is above).78 79In round 2, if the ondemand sampling times exactly match the load/sleep80trigger of the cpufreq-bench, you will see no performance loss (compare with81below possible ondemand sample kick ins (1)):82 83But if ondemand always kicks in in the middle of the load sleep cycles, it84will always see 50% loads and you get worst performance impact never85switching up (compare with below possible ondemand sample kick ins (2))::86 87      50     50   50   50ms ->time88load -----|     |-----|     |-----|     |-----|89          |     |     |     |     |     |     |90sleep     |-----|     |-----|     |-----|     |----91    |-----|-----|-----|-----|-----|-----|-----|----  ondemand sampling (1)92         100    0    100    0    100    0    100     load seen by ondemand(%)93       |-----|-----|-----|-----|-----|-----|-----|--   ondemand sampling (2)94      50     50    50    50    50    50    50        load seen by ondemand(%)95 96You can easily test all kind of load/sleep times and check whether your97governor in average behaves as expected.98 99 100ToDo101====102 103Provide a gnuplot utility script for easy generation of plots to present104the outcome nicely.105 106 107cpufreq-bench Command Usage108===========================109-l, --load=<long int>           initial load time in us110-s, --sleep=<long int>          initial sleep time in us111-x, --load-step=<long int>      time to be added to load time, in us112-y, --sleep-step=<long int>     time to be added to sleep time, in us113-c, --cpu=<unsigned int>        CPU Number to use, starting at 0114-p, --prio=<priority>           scheduler priority, HIGH, LOW or DEFAULT115-g, --governor=<governor>       cpufreq governor to test116-n, --cycles=<int>              load/sleep cycles to get an average value to compare117-r, --rounds<int>               load/sleep rounds118-f, --file=<configfile>         config file to use119-o, --output=<dir>              output dir, must exist120-v, --verbose                   verbose output on/off121 122Due to the high priority, the application may not be responsible for some time.123After the benchmark, the logfile is saved in OUTPUTDIR/benchmark_TIMESTAMP.log124 125