| 119 | |
| 120 | template <typename T, typename NativeFunction> |
| 121 | void run_native_benchmark(T& x, T& y, NativeFunction f, const std::string& expr_string) |
| 122 | { |
| 123 | T total = T(0); |
| 124 | unsigned int count = 0; |
| 125 | |
| 126 | exprtk::timer timer; |
| 127 | timer.start(); |
| 128 | |
| 129 | for (x = global_lower_bound_x; x <= global_upper_bound_x; x += global_delta) |
| 130 | { |
| 131 | for (y = global_lower_bound_y; y <= global_upper_bound_y; y += global_delta) |
| 132 | { |
| 133 | total += f(x,y); |
| 134 | ++count; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | timer.stop(); |
| 139 | |
| 140 | if (T(0) != total) |
| 141 | printf("[native] Total Time:%12.8f Rate:%14.3fevals/sec Expression: %s\n", |
| 142 | timer.time(), |
| 143 | count / timer.time(), |
| 144 | expr_string.c_str()); |
| 145 | else |
| 146 | printf("run_native_benchmark() - Error running benchmark for expression: %s\n",expr_string.c_str()); |
| 147 | } |
| 148 | |
| 149 | template <typename T> |
| 150 | bool run_parse_benchmark(exprtk::symbol_table<T>& symbol_table) |