MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / iter

Function iter

test/benchmark/test_box2d_benchmark.cpp:146–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146void iter() {
147 if (frameCounter < FRAMES) {
148 clock_t start = clock();
149 world->Step(1.0f/60.0f, 3, 3);
150 clock_t end = clock();
151 clock_t curr = end - start;
152 times[frameCounter] = curr;
153 if (curr < minn) minn = curr;
154 if (curr > maxx) maxx = curr;
155#if DEBUG
156 printf("%f :: ", topBody->GetPosition().y);
157 printf("%f\n", (float32)(end - start) / CLOCKS_PER_SEC * 1000);
158#endif
159 frameCounter++;
160 return;
161 }
162
163 // that's it!
164
165 frameCounter++;
166
167 result_t result = measure(times);
168
169 printf("frame averages: %.3f +- %.3f, range: %.3f to %.3f \n", result.mean, result.stddev, float(minn)/CLOCKS_PER_SEC * 1000, float(maxx)/CLOCKS_PER_SEC * 1000);
170}
171

Callers 1

mainFunction · 0.70

Calls 4

clockFunction · 0.85
printfFunction · 0.85
measureFunction · 0.85
GetPositionMethod · 0.80

Tested by

no test coverage detected