README-BENCH 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. This is cpufreq-bench, a microbenchmark for the cpufreq framework.
  2. Purpose
  3. =======
  4. What is this benchmark for:
  5. - Identify worst case performance loss when doing dynamic frequency
  6. scaling using Linux kernel governors
  7. - Identify average reaction time of a governor to CPU load changes
  8. - (Stress) Testing whether a cpufreq low level driver or governor works
  9. as expected
  10. - Identify cpufreq related performance regressions between kernels
  11. - Possibly Real time priority testing? -> what happens if there are
  12. processes with a higher prio than the governor's kernel thread
  13. - ...
  14. What this benchmark does *not* cover:
  15. - Power saving related regressions (In fact as better the performance
  16. throughput is, the worse the power savings will be, but the first should
  17. mostly count more...)
  18. - Real world (workloads)
  19. Description
  20. ===========
  21. cpufreq-bench helps to test the condition of a given cpufreq governor.
  22. For that purpose, it compares the performance governor to a configured
  23. powersave module.
  24. How it works
  25. ============
  26. You can specify load (100% CPU load) and sleep (0% CPU load) times in us which
  27. will be run X time in a row (cycles):
  28. sleep=25000
  29. load=25000
  30. cycles=20
  31. This part of the configuration file will create 25ms load/sleep turns,
  32. repeated 20 times.
  33. Adding this:
  34. sleep_step=25000
  35. load_step=25000
  36. rounds=5
  37. Will increase load and sleep time by 25ms 5 times.
  38. Together you get following test:
  39. 25ms load/sleep time repeated 20 times (cycles).
  40. 50ms load/sleep time repeated 20 times (cycles).
  41. ..
  42. 100ms load/sleep time repeated 20 times (cycles).
  43. First it is calibrated how long a specific CPU intensive calculation
  44. takes on this machine and needs to be run in a loop using the performance
  45. governor.
  46. Then the above test runs are processed using the performance governor
  47. and the governor to test. The time the calculation really needed
  48. with the dynamic freq scaling governor is compared with the time needed
  49. on full performance and you get the overall performance loss.
  50. Example of expected results with ondemand governor:
  51. This shows expected results of the first two test run rounds from
  52. above config, you there have:
  53. 100% CPU load (load) | 0 % CPU load (sleep) | round
  54. 25 ms | 25 ms | 1
  55. 50 ms | 50 ms | 2
  56. For example if ondemand governor is configured to have a 50ms
  57. sampling rate you get:
  58. In round 1, ondemand should have rather static 50% load and probably
  59. won't ever switch up (as long as up_threshold is above).
  60. In round 2, if the ondemand sampling times exactly match the load/sleep
  61. trigger of the cpufreq-bench, you will see no performance loss (compare with
  62. below possible ondemand sample kick ins (1)):
  63. But if ondemand always kicks in in the middle of the load sleep cycles, it
  64. will always see 50% loads and you get worst performance impact never
  65. switching up (compare with below possible ondemand sample kick ins (2))::
  66. 50 50 50 50ms ->time
  67. load -----| |-----| |-----| |-----|
  68. | | | | | | |
  69. sleep |-----| |-----| |-----| |----
  70. |-----|-----|-----|-----|-----|-----|-----|---- ondemand sampling (1)
  71. 100 0 100 0 100 0 100 load seen by ondemand(%)
  72. |-----|-----|-----|-----|-----|-----|-----|-- ondemand sampling (2)
  73. 50 50 50 50 50 50 50 load seen by ondemand(%)
  74. You can easily test all kind of load/sleep times and check whether your
  75. governor in average behaves as expected.
  76. ToDo
  77. ====
  78. Provide a gnuplot utility script for easy generation of plots to present
  79. the outcome nicely.
  80. cpufreq-bench Command Usage
  81. ===========================
  82. -l, --load=<long int> initial load time in us
  83. -s, --sleep=<long int> initial sleep time in us
  84. -x, --load-step=<long int> time to be added to load time, in us
  85. -y, --sleep-step=<long int> time to be added to sleep time, in us
  86. -c, --cpu=<unsigned int> CPU Number to use, starting at 0
  87. -p, --prio=<priority> scheduler priority, HIGH, LOW or DEFAULT
  88. -g, --governor=<governor> cpufreq governor to test
  89. -n, --cycles=<int> load/sleep cycles to get an avarage value to compare
  90. -r, --rounds<int> load/sleep rounds
  91. -f, --file=<configfile> config file to use
  92. -o, --output=<dir> output dir, must exist
  93. -v, --verbose verbose output on/off
  94. Due to the high priority, the application may not be responsible for some time.
  95. After the benchmark, the logfile is saved in OUTPUTDIR/benchmark_TIMESTAMP.log