4.115
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 | #ifdef HAVE_CONFIG_H |
---|
13 | #include "config.h" |
---|
14 | #endif |
---|
15 | |
---|
16 | #include <rtems/btimer.h> |
---|
17 | |
---|
18 | #include <bsp.h> |
---|
19 | #include <rtems/timerdrv.h> |
---|
20 | #include "test_support.h" |
---|
21 | #include "timesys.h" |
---|
22 | |
---|
23 | extern void benchmark_timer_empty_operation( |
---|
24 | int iteration, |
---|
25 | void *argument |
---|
26 | ); |
---|
27 | |
---|
28 | void rtems_time_test_measure_operation( |
---|
29 | const char *description, |
---|
30 | rtems_time_test_method_t operation, |
---|
31 | void *argument, |
---|
32 | int iterations, |
---|
33 | int overhead |
---|
34 | ) |
---|
35 | { |
---|
36 | int i; |
---|
37 | long loop_overhead; |
---|
38 | int end_time; |
---|
39 | |
---|
40 | benchmark_timer_initialize(); |
---|
41 | for (i=0 ; i<iterations ; i++ ) { |
---|
42 | benchmark_timer_empty_operation( i, argument ); |
---|
43 | } |
---|
44 | loop_overhead = benchmark_timer_read(); |
---|
45 | |
---|
46 | benchmark_timer_initialize(); |
---|
47 | for (i=0 ; i<iterations ; i++ ) { |
---|
48 | (*operation)( i, argument ); |
---|
49 | } |
---|
50 | end_time = benchmark_timer_read(); |
---|
51 | |
---|
52 | put_time( |
---|
53 | description, |
---|
54 | end_time, |
---|
55 | iterations, |
---|
56 | loop_overhead, |
---|
57 | overhead |
---|
58 | ); |
---|
59 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.