feat: add more computation - Commit 9752727f - Tuna_New
-
feat: add more computation
-
| skipped 158 lines |
159 | 159 | | return num_threads; |
160 | 160 | | } |
161 | 161 | | |
162 | | - | inline void do_nothing(int) {} |
| 162 | + | inline int do_nothing(int x) { |
| 163 | + | return x / 1024; |
| 164 | + | } |
163 | 165 | | |
164 | | - | inline void do_nothing(double) {} |
| 166 | + | inline double do_nothing(double x) { |
| 167 | + | return x / 3.14; |
| 168 | + | } |
165 | 169 | | |
166 | 170 | | double Benchmark::complex_calculation(double num) { |
| 171 | + | [[maybe_unused]] volatile int x; |
| 172 | + | [[maybe_unused]] volatile double y; |
167 | 173 | | for (int i = 0; i < static_cast<int>(UserConfig::COMPUTATION_TIMES); ++i) { |
168 | | - | do_nothing(i); // Prevent being optimized |
| 174 | + | x = do_nothing(i); // Prevent being optimized |
169 | 175 | | } |
170 | 176 | | for (double i = 0; i < static_cast<double>(UserConfig::COMPUTATION_TIMES); ++i) { |
171 | | - | do_nothing(i); // Prevent being optimized |
| 177 | + | y = do_nothing(i); // Prevent being optimized |
172 | 178 | | } |
173 | 179 | | return num; |
174 | 180 | | } |
| skipped 118 lines |
Page is in error, reload to recover