timing.3 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. .\"
  2. .\" @(#)timing.man 2.0 98/04/24
  3. .\"
  4. .\" timing - lmbench timing subsystem
  5. .\"
  6. .\" Copyright (C) 1998 Carl Staelin and Larry McVoy
  7. .\" E-mail: staelin@hpl.hp.com
  8. .\"
  9. .TH "lmbench timing" 3 "$Date$" "(c)1998 Larry McVoy" "LMBENCH"
  10. .SH "NAME"
  11. BENCH, BENCH_OVERHEAD, BENCH1, start, stop, get_n, set_n, gettime, settime,
  12. get_enough, t_overhead, l_overhead \- the lmbench timing subsystem
  13. .SH "SYNOPSIS"
  14. .ft C
  15. #include "lmbench.h"
  16. .br
  17. BENCH(loop_body, enough)
  18. .br
  19. BENCH_OVERHEAD(loop_body, overhead_loop, enough)
  20. .br
  21. BENCH1(loop_body, enough)
  22. .br
  23. void start(struct timeval *begin);
  24. .br
  25. uint64 stop(struct timeval *begin, struct timeval *end);
  26. .br
  27. uint64 get_n();
  28. .br
  29. void set_n(uint64 n);
  30. .br
  31. uint64 gettime();
  32. .br
  33. void settime(uint64 u);
  34. .br
  35. uint64 get_enough(uint64 enough);
  36. .br
  37. uint64 t_overhead();
  38. .br
  39. double l_overhead();
  40. .ft R
  41. .SH "DESCRIPTION"
  42. The single most important element of a good benchmarking system is
  43. the quality and reliability of its measurement system.
  44. .IR lmbench 's
  45. timing subsystem manages the experimental timing process to produce
  46. accurate results in the least possible time.
  47. .I lmbench
  48. includes methods for measuring and eliminating several factors that
  49. influence the accuracy of timing measurements, such as the resolution
  50. of the system clock.
  51. .PP
  52. .I lmbench
  53. gets accurate results by considering clock resolution,
  54. auto-sizing the duration of each benchmark, and conducting multiple
  55. experiments.
  56. .TP
  57. .B "BENCH(loop_body, enough)"
  58. measures the performance of
  59. .I loop_body
  60. repeatedly and report the median result.
  61. .TP
  62. .B "BENCH_OVERHEAD(loop_body, overhead_loop, enough)"
  63. repeatedly measures the performance of
  64. .I loop_body
  65. and subtract the time in
  66. .I overhead_loop
  67. and reports the median result.
  68. .TP
  69. .B "BENCH1(loop_body, enough)"
  70. measures the performance of
  71. .I loop_body
  72. once.
  73. .TP
  74. .B "void start(struct timeval *begin)"
  75. start a timing interval. If
  76. .I begin
  77. is non-null, save the start time in
  78. .I begin .
  79. .TP
  80. .B "uint64 stop(struct timeval *begin, struct timeval *end)"
  81. stop a timing interval, returning the number of elapsed micro-seconds.
  82. .TP
  83. .B "uint64 get_n()"
  84. returns the number of times
  85. .I loop_body
  86. was executed during the timing interval.
  87. .TP
  88. .B "void set_n(uint64 n)"
  89. sets the number of times
  90. .I loop_body
  91. was executed during the timing interval.
  92. .TP
  93. .B "uint64 gettime()"
  94. returns the number of micro-seconds in the timing interval.
  95. .TP
  96. .B "void settime(uint64 u)"
  97. sets the number of micro-seconds in the timing interval.
  98. .TP
  99. .B "uint64 get_enough(uint64 enough)"
  100. return the time in micro-seconds needed to accurately measure
  101. a timing interval.
  102. .TP
  103. .B "uint64 t_overhead()"
  104. return the time in micro-seconds needed to measure time.
  105. .TP
  106. .B "double l_overhead()"
  107. return the time in micro-seconds needed to do a simple loop.
  108. .SH "VARIABLES"
  109. There are three environment variables that can be used to modify
  110. the
  111. .I lmbench
  112. timing subsystem: ENOUGH, TIMING_O, and LOOP_O.
  113. The environment variables can be used to directly set the results
  114. of
  115. .B get_enough ,
  116. .B t_overhead ,
  117. and
  118. .B l_overhead .
  119. When running a large number of benchmarks, or repeating the same
  120. benchmark many times, this can save time by eliminating the necessity
  121. of recalculating these values for each run.
  122. .SH "FUTURES"
  123. Development of
  124. .I lmbench
  125. is continuing.
  126. .SH "SEE ALSO"
  127. lmbench(8), lmbench(3), reporting(3), results(3), gettimeofday(2).
  128. .SH "AUTHOR"
  129. Carl Staelin and Larry McVoy
  130. .PP
  131. Comments, suggestions, and bug reports are always welcome.