source: rtems/testsuites/support/src/tmtests_support.c @ 82fbd35

4.11
Last change on this file since 82fbd35 was 82fbd35, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 21, 2010 at 4:54:17 PM

2010-06-21 Joel Sherrill <joel.sherrill@…>

  • support/include/test_support.h, support/src/tmtests_empty_function.c: Add helper so it is easier to write a basic repeated operation tmtest.
  • support/src/tmtests_support.c: New file.
  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2010.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#include <bsp.h>
13#include <rtems/timerdrv.h>
14#include "test_support.h"
15#include "timesys.h"
16
17extern void benchmark_timer_empty_operation(
18  int    iteration,
19  void  *argument
20);
21
22void rtems_time_test_measure_operation(
23  const char               *description,
24  rtems_time_test_method_t  operation,
25  void                     *argument,
26  int                       iterations,
27  int                       overhead
28)
29{
30  int i;
31  int loop_overhead;
32  int end_time;
33
34  benchmark_timer_initialize();
35    for (i=0 ; i<iterations ; i++ ) {
36      benchmark_timer_empty_operation( i, argument );
37    }
38  loop_overhead = benchmark_timer_read();
39
40  benchmark_timer_initialize();
41    for (i=0 ; i<iterations ; i++ ) {
42      (*operation)( i, argument );
43    }
44  end_time = benchmark_timer_read();
45
46  put_time(
47    description,
48    end_time,
49    iterations,
50    loop_overhead,
51    overhead
52  );
53}
Note: See TracBrowser for help on using the repository browser.