source: rtems/c/src/lib/libcpu/powerpc/mpc505/timer/timer.c @ 9b4422a2

4.11
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on May 3, 2012 at 3:09:24 PM

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*  timer.c
2 *
3 *  This file manages the benchmark timer used by the RTEMS Timing Test
4 *  Suite.  Each measured time period is demarcated by calls to
5 *  benchmark_timer_initialize() and benchmark_timer_read().  benchmark_timer_read() usually returns
6 *  the number of microseconds since benchmark_timer_initialize() exitted.
7 *
8 *  NOTE: It is important that the timer start/stop overhead be
9 *        determined when porting or modifying this code.
10 *
11 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
12 *  On-Line Applications Research Corporation (OAR).
13 */
14
15#include <rtems.h>
16
17bool benchmark_timer_find_average_overhead;
18
19static unsigned int volatile lastInitValue;
20
21void benchmark_timer_initialize( void )
22{
23  __asm__ volatile( " mftb %0": "=r" (lastInitValue) );
24}
25
26/*
27 *  The following controls the behavior of benchmark_timer_read().
28 *
29 *  AVG_OVEREHAD is the overhead for starting and stopping the timer.  It
30 *  is usually deducted from the number returned.
31 *
32 *  LEAST_VALID is the lowest number this routine should trust.  Numbers
33 *  below this are "noise" and zero is returned.
34 */
35
36#define AVG_OVERHEAD      0  /* It typically takes X.X microseconds */
37                             /* (Y countdowns) to start/stop the timer. */
38                             /* This value is in microseconds. */
39#define LEAST_VALID       1  /* Don't trust a clicks value lower than this */
40
41int benchmark_timer_read( void )
42{
43  uint32_t   value;
44  __asm__ volatile ( " mftb %0": "=r" (value) );
45  return value - lastInitValue;
46}
47
48void benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
49{
50  benchmark_timer_find_average_overhead = find_flag;
51}
Note: See TracBrowser for help on using the repository browser.