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

Function measure

test/benchmark/test_box2d_benchmark.cpp:44–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42const int e_count = 40;
43
44result_t measure(clock_t *times) {
45 float values[FRAMES];
46 result_t r;
47
48 float total = 0;
49 for (int i = 0; i < FRAMES; ++i) {
50 values[i] = (float)times[i] / CLOCKS_PER_SEC * 1000;
51 total += values[i];
52 }
53 r.mean = total / FRAMES;
54
55 float variance = 0;
56 for (int i = 0; i < FRAMES; ++i) {
57 float diff = values[i] - r.mean;
58 variance += diff * diff;
59 }
60 r.stddev = sqrt(variance / FRAMES);
61
62 return r;
63}
64
65b2World *world;
66clock_t *times, minn = CLOCKS_PER_SEC * 1000 * 100, maxx = -1;

Callers 1

iterFunction · 0.85

Calls 1

sqrtFunction · 0.50

Tested by

no test coverage detected