1 | // Copyright 2020 The Marl Authors. |
2 | // |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | // you may not use this file except in compliance with the License. |
5 | // You may obtain a copy of the License at |
6 | // |
7 | // https://www.apache.org/licenses/LICENSE-2.0 |
8 | // |
9 | // Unless required by applicable law or agreed to in writing, software |
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | // See the License for the specific language governing permissions and |
13 | // limitations under the License. |
14 | |
15 | #include "marl_bench.h" |
16 | |
17 | #include "marl/sanitizers.h" |
18 | |
19 | int main(int argc, char** argv) { |
20 | #if ADDRESS_SANITIZER_ENABLED |
21 | printf( |
22 | "***WARNING*** Marl built with address sanitizer enabled. " |
23 | "Timings will be affected\n" ); |
24 | #endif |
25 | #if MEMORY_SANITIZER_ENABLED |
26 | printf( |
27 | "***WARNING*** Marl built with memory sanitizer enabled. " |
28 | "Timings will be affected\n" ); |
29 | #endif |
30 | #if THREAD_SANITIZER_ENABLED |
31 | printf( |
32 | "***WARNING*** Marl built with thread sanitizer enabled. " |
33 | "Timings will be affected\n" ); |
34 | #endif |
35 | ::benchmark::Initialize(&argc, argv); |
36 | if (::benchmark::ReportUnrecognizedArguments(argc, argv)) |
37 | return 1; |
38 | ::benchmark::RunSpecifiedBenchmarks(); |
39 | return 0; |
40 | } |
41 | |
42 | uint32_t Schedule::doSomeWork(uint32_t x) { |
43 | uint32_t q = x; |
44 | for (uint32_t i = 0; i < 100000; i++) { |
45 | x = (x << 4) | x; |
46 | x = x | 0x1020; |
47 | x = (x >> 2) & q; |
48 | } |
49 | return x; |
50 | } |