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

Function test_case

test/benchmark/benchmark_memset.cpp:55–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53double totalTimeSecs = 0.0;
54
55void test_case(int copySize)
56{
57 const int minimumCopyBytes = 1024*1024*64;
58
59 int numTimes = (minimumCopyBytes + copySize-1) / copySize;
60 if (numTimes < 8) numTimes = 8;
61
62 tick_t bestResult = 1e9;
63
64#ifndef NUM_TRIALS
65#define NUM_TRIALS 5
66#endif
67
68 for(int i = 0; i < NUM_TRIALS; ++i)
69 {
70 double t0 = tick();
71 test_memset(numTimes, copySize);
72 double t1 = tick();
73 if (t1 - t0 < bestResult) bestResult = t1 - t0;
74 totalTimeSecs += (double)(t1 - t0) / ticks_per_sec();
75 }
76 unsigned long long totalBytesTransferred = numTimes * copySize;
77
78 copySizes.push_back(copySize);
79
80 tick_t ticksElapsed = bestResult;
81 if (ticksElapsed > 0)
82 {
83 double seconds = (double)ticksElapsed / ticks_per_sec();
84 double bytesPerSecond = totalBytesTransferred / seconds;
85 double mbytesPerSecond = bytesPerSecond / (1024.0*1024.0);
86 results.push_back(mbytesPerSecond);
87 }
88 else
89 {
90 results.push_back(0.0);
91 }
92}
93
94void print_results()
95{

Callers 1

run_oneFunction · 0.70

Calls 4

ticks_per_secFunction · 0.85
tickFunction · 0.70
test_memsetFunction · 0.70
push_backMethod · 0.65

Tested by

no test coverage detected