Committing Intel(R) TBB 2018 source code
[platform/upstream/tbb.git] / src / perf / time_sandbox.h
1 /*
2     Copyright (c) 2005-2017 Intel Corporation
3
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7
8         http://www.apache.org/licenses/LICENSE-2.0
9
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15
16
17
18
19 */
20
21 #ifndef __TIME_FRAMEWORK_H__
22 #error time_framework.h must be included
23 #endif
24
25 #define INJECT_TBB namespace tbb { using namespace ::tbb; namespace internal { using namespace ::tbb::internal; } }
26 #define INJECT_TBB5 namespace tbb { namespace interface5 { using namespace ::tbb::interface5; namespace internal { using namespace ::tbb::interface5::internal; } } }
27
28 #ifndef INJECT_BOX_NAMES
29 #if defined(__TBB_task_H) || defined(__TBB_concurrent_unordered_internal_H) || defined(__TBB_reader_writer_lock_H) || defined(__TBB__concurrent_unordered_impl_H)
30 #define INJECT_BOX_NAMES INJECT_TBB INJECT_TBB5
31 #else
32 #define INJECT_BOX_NAMES INJECT_TBB
33 #endif
34 #endif
35
36 #ifdef BOX1
37 namespace sandbox1 {
38     INJECT_BOX_NAMES
39 #   ifdef BOX1HEADER
40 #   include BOX1HEADER
41 #   endif
42     typedef ::BOX1TEST testbox;
43 }
44 #endif
45 #ifdef BOX2
46 namespace sandbox2 {
47     INJECT_BOX_NAMES
48 #   ifdef BOX2HEADER
49 #   include BOX2HEADER
50 #   endif
51     typedef ::BOX2TEST testbox;
52 }
53 #endif
54 #ifdef BOX3
55 namespace sandbox3 {
56     INJECT_BOX_NAMES
57 #   ifdef BOX3HEADER
58 #   include BOX3HEADER
59 #   endif
60     typedef ::BOX3TEST testbox;
61 }
62 #endif
63 #ifdef BOX4
64 namespace sandbox4 {
65     INJECT_BOX_NAMES
66 #   ifdef BOX4HEADER
67 #   include BOX4HEADER
68 #   endif
69     typedef ::BOX4TEST testbox;
70 }
71 #endif
72 #ifdef BOX5
73 namespace sandbox5 {
74     INJECT_BOX_NAMES
75 #   ifdef BOX5HEADER
76 #   include BOX5HEADER
77 #   endif
78     typedef ::BOX5TEST testbox;
79 }
80 #endif
81 #ifdef BOX6
82 namespace sandbox6 {
83     INJECT_BOX_NAMES
84 #   ifdef BOX6HEADER
85 #   include BOX6HEADER
86 #   endif
87     typedef ::BOX6TEST testbox;
88 }
89 #endif
90 #ifdef BOX7
91 namespace sandbox7 {
92     INJECT_BOX_NAMES
93 #   ifdef BOX7HEADER
94 #   include BOX7HEADER
95 #   endif
96     typedef ::BOX7TEST testbox;
97 }
98 #endif
99 #ifdef BOX8
100 namespace sandbox8 {
101     INJECT_BOX_NAMES
102 #   ifdef BOX8HEADER
103 #   include BOX8HEADER
104 #   endif
105     typedef ::BOX8TEST testbox;
106 }
107 #endif
108 #ifdef BOX9
109 namespace sandbox9 {
110     INJECT_BOX_NAMES
111 #   ifdef BOX9HEADER
112 #   include BOX9HEADER
113 #   endif
114     typedef ::BOX9TEST testbox;
115 }
116 #endif
117
118 //if harness.h included
119 #if defined(ASSERT) && !HARNESS_NO_PARSE_COMMAND_LINE
120 #ifndef TEST_PREFIX
121 #define TEST_PREFIX if(Verbose) printf("Processing with %d threads: %ld...\n", threads, long(value));
122 #endif
123 #endif//harness included
124
125 #ifndef TEST_PROCESSOR_NAME
126 #define TEST_PROCESSOR_NAME test_sandbox
127 #endif
128
129 class TEST_PROCESSOR_NAME : public TestProcessor {
130 public:
131     TEST_PROCESSOR_NAME(const char *name, StatisticsCollector::Sorting sort_by = StatisticsCollector::ByAlg)
132         : TestProcessor(name, sort_by) {}
133     void factory(arg_t value, int threads) {
134 #ifdef TEST_PREFIX
135         TEST_PREFIX
136 #endif
137         process( value, threads,
138 #define RUNBOX(n) run(#n"."BOX##n, new sandbox##n::testbox() )
139 #ifdef BOX1
140         RUNBOX(1),
141 #endif
142 #ifdef BOX2
143         RUNBOX(2),
144 #endif
145 #ifdef BOX3
146         RUNBOX(3),
147 #endif
148 #ifdef BOX4
149         RUNBOX(4),
150 #endif
151 #ifdef BOX5
152         RUNBOX(5),
153 #endif
154 #ifdef BOX6
155         RUNBOX(6),
156 #endif
157 #ifdef BOX7
158         RUNBOX(7),
159 #endif
160 #ifdef BOX8
161         RUNBOX(8),
162 #endif
163 #ifdef BOX9
164         RUNBOX(9),
165 #endif
166         end );
167 #ifdef TEST_POSTFIX
168         TEST_POSTFIX
169 #endif
170     }
171 };