kvm-recheck-rcuperf.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/bash
  2. #
  3. # Analyze a given results directory for rcuperf performance measurements.
  4. #
  5. # Usage: kvm-recheck-rcuperf.sh resdir
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, you can access it online at
  19. # http://www.gnu.org/licenses/gpl-2.0.html.
  20. #
  21. # Copyright (C) IBM Corporation, 2016
  22. #
  23. # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  24. i="$1"
  25. if test -d $i
  26. then
  27. :
  28. else
  29. echo Unreadable results directory: $i
  30. exit 1
  31. fi
  32. PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH
  33. . tools/testing/selftests/rcutorture/bin/functions.sh
  34. if kvm-recheck-rcuperf-ftrace.sh $i
  35. then
  36. # ftrace data was successfully analyzed, call it good!
  37. exit 0
  38. fi
  39. configfile=`echo $i | sed -e 's/^.*\///'`
  40. sed -e 's/^\[[^]]*]//' < $i/console.log |
  41. awk '
  42. /-perf: .* gps: .* batches:/ {
  43. ngps = $9;
  44. nbatches = $11;
  45. }
  46. /-perf: .*writer-duration/ {
  47. gptimes[++n] = $5 / 1000.;
  48. sum += $5 / 1000.;
  49. }
  50. END {
  51. newNR = asort(gptimes);
  52. if (newNR <= 0) {
  53. print "No rcuperf records found???"
  54. exit;
  55. }
  56. pct50 = int(newNR * 50 / 100);
  57. if (pct50 < 1)
  58. pct50 = 1;
  59. pct90 = int(newNR * 90 / 100);
  60. if (pct90 < 1)
  61. pct90 = 1;
  62. pct99 = int(newNR * 99 / 100);
  63. if (pct99 < 1)
  64. pct99 = 1;
  65. div = 10 ** int(log(gptimes[pct90]) / log(10) + .5) / 100;
  66. print "Histogram bucket size: " div;
  67. last = gptimes[1] - 10;
  68. count = 0;
  69. for (i = 1; i <= newNR; i++) {
  70. current = div * int(gptimes[i] / div);
  71. if (last == current) {
  72. count++;
  73. } else {
  74. if (count > 0)
  75. print last, count;
  76. count = 1;
  77. last = current;
  78. }
  79. }
  80. if (count > 0)
  81. print last, count;
  82. print "Average grace-period duration: " sum / newNR " microseconds";
  83. print "Minimum grace-period duration: " gptimes[1];
  84. print "50th percentile grace-period duration: " gptimes[pct50];
  85. print "90th percentile grace-period duration: " gptimes[pct90];
  86. print "99th percentile grace-period duration: " gptimes[pct99];
  87. print "Maximum grace-period duration: " gptimes[newNR];
  88. print "Grace periods: " ngps + 0 " Batches: " nbatches + 0 " Ratio: " ngps / nbatches;
  89. print "Computed from rcuperf printk output.";
  90. }'