1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * @brief Timing Test Support |
---|
6 | * |
---|
7 | * This header file contains supporting definitions for the |
---|
8 | * Timing Test Suites. |
---|
9 | */ |
---|
10 | |
---|
11 | /* |
---|
12 | * COPYRIGHT (c) 1989-2013. |
---|
13 | * On-Line Applications Research Corporation (OAR). |
---|
14 | * |
---|
15 | * Redistribution and use in source and binary forms, with or without |
---|
16 | * modification, are permitted provided that the following conditions |
---|
17 | * are met: |
---|
18 | * 1. Redistributions of source code must retain the above copyright |
---|
19 | * notice, this list of conditions and the following disclaimer. |
---|
20 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
21 | * notice, this list of conditions and the following disclaimer in the |
---|
22 | * documentation and/or other materials provided with the distribution. |
---|
23 | * |
---|
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
34 | * POSSIBILITY OF SUCH DAMAGE. |
---|
35 | */ |
---|
36 | |
---|
37 | #include <tmacros.h> |
---|
38 | #include <inttypes.h> |
---|
39 | |
---|
40 | /* |
---|
41 | * This constant determines the maximum number of a resource |
---|
42 | * that will be created. For example, some test create multiple |
---|
43 | * blocking tasks to determine the execution time of blocking |
---|
44 | * services. By default, the blocking time of 100 tasks will |
---|
45 | * be measured. Small targets often do not have enough memory |
---|
46 | * to create 100 tasks. By overriding the default OPERATION_COUNT |
---|
47 | * with a lower number (typically 10 or less), all of the time tests |
---|
48 | * can usually be run. This is stil not very fine-grained but |
---|
49 | * is enough to significantly reduce memory consumption. |
---|
50 | */ |
---|
51 | |
---|
52 | #ifndef OPERATION_COUNT |
---|
53 | #define OPERATION_COUNT 100 |
---|
54 | #endif |
---|
55 | |
---|
56 | /* functions */ |
---|
57 | |
---|
58 | #define put_time( _message, _total_time, \ |
---|
59 | _iterations, _loop_overhead, _overhead ) \ |
---|
60 | printf( \ |
---|
61 | "%s - %" PRId32 "\n", \ |
---|
62 | (_message), \ |
---|
63 | (((_total_time) - (_loop_overhead)) / (_iterations)) - (_overhead) \ |
---|
64 | ) |
---|
65 | |
---|
66 | #if defined(CONFIGURE_STACK_CHECKER_ENABLED) || defined(RTEMS_DEBUG) |
---|
67 | #define Print_Warning() \ |
---|
68 | do { \ |
---|
69 | puts( \ |
---|
70 | "\n" \ |
---|
71 | "THE TIMES REPORTED BY THIS TEST INCLUDE DEBUG CODE!\n" \ |
---|
72 | "\n" \ |
---|
73 | ); \ |
---|
74 | } while (0) |
---|
75 | |
---|
76 | #else |
---|
77 | #define Print_Warning() |
---|
78 | #endif |
---|
79 | |
---|
80 | /* variables */ |
---|
81 | |
---|
82 | TEST_EXTERN volatile uint32_t end_time; /* ending time variable */ |
---|
83 | TEST_EXTERN volatile uint32_t overhead; /* loop overhead variable */ |
---|
84 | |
---|
85 | /* end of include file */ |
---|