mhz.8 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .\" $Id$
  2. .TH MHZ 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH"
  3. .SH NAME
  4. mhz \- calulate processor clock rate
  5. .SH SYNOPSIS
  6. .B mhz
  7. .I [-c]
  8. .SH DESCRIPTION
  9. .B mhz
  10. calculates the processor clock rate in megahertz.
  11. Since it is written in portable ANSI/C, it cannot rely on
  12. the operating system to report the clock speed.
  13. Nor can it measure the time of a single loop to determine
  14. the clock rate since this would require that it assume
  15. the number of clock ticks per instruction, which is not
  16. constant across architectures.
  17. .P
  18. .B mhz
  19. measures the time to execute a variety of loops, which are
  20. carefully constructed to minimize the compiler and processor's
  21. ability to overlap instruction execution so that time total
  22. time per loop is an integral multiple of clock ticks.
  23. .B mhz
  24. then finds the greatest common divisor of the various
  25. time measurements to identify the clock rate.
  26. .P
  27. Of course, things aren't really that simple. For one thing,
  28. the measured times are real numbers, not integers, so we must
  29. convert the real numbers to integers in order for the
  30. .I "greatest common divisor"
  31. to make sense.
  32. In reality,
  33. .B mhz
  34. makes a series of assumptions that the smallest measured
  35. time is {1, 2, ...} clock ticks.
  36. .B mhz
  37. then computes the number of clock ticks for each measured
  38. value, and the error between the predicted value and the
  39. measured value.
  40. .P
  41. .B mhz
  42. also has a variety of mechanisms for reducing the impact
  43. of measurement error on the reported results, since the
  44. algorithm is extremely sensitive to measurement error.
  45. .SH OUTPUT
  46. Output format is either just the clock rate as a float (-c) or more verbose
  47. .sp
  48. .ft CB
  49. 39.80 Mhz, 25 nanosec clock
  50. .ft
  51. .SH BUGS
  52. .SH ACKNOWLEDGEMENT
  53. Funding for the development of
  54. this tool was provided by Sun Microsystems Computer Corporation.
  55. .SH "SEE ALSO"
  56. lmbench(8).