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

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

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
RevLine 
[96284fd8]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
[6427f1a]5 *  benchmark_timer_initialize() and benchmark_timer_read().  benchmark_timer_read() usually returns
6 *  the number of microseconds since benchmark_timer_initialize() exitted.
[96284fd8]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
[a982e0c6]15#include <rtems.h>
[96284fd8]16
[3942cce]17bool benchmark_timer_find_average_overhead;
[96284fd8]18
19static unsigned int volatile lastInitValue;
20
[6427f1a]21void benchmark_timer_initialize( void )
[96284fd8]22{
[f9acc33]23  __asm__ volatile( " mftb %0": "=r" (lastInitValue) );
[96284fd8]24}
25
26/*
[6427f1a]27 *  The following controls the behavior of benchmark_timer_read().
[96284fd8]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
[6427f1a]41int benchmark_timer_read( void )
[96284fd8]42{
[66c373bf]43  uint32_t   value;
[f9acc33]44  __asm__ volatile ( " mftb %0": "=r" (value) );
[96284fd8]45  return value - lastInitValue;
46}
47
[3942cce]48void benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
[96284fd8]49{
[6427f1a]50  benchmark_timer_find_average_overhead = find_flag;
[96284fd8]51}
Note: See TracBrowser for help on using the repository browser.