js/src/jit-test/tests/basic/perf-smoketest.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 function spin_loop()
michael@0 2 {
michael@0 3 for (let i = 0; i < 10000; i++) ;
michael@0 4 }
michael@0 5
michael@0 6 function check_timing(label, count) {
michael@0 7 if (count == -1) {
michael@0 8 print("TEST-UNEXPECTED-FAIL | TestPerf | " + label);
michael@0 9 throwError();
michael@0 10 } else {
michael@0 11 print("TEST-PASS | TestPerf | " + label + " = " + count);
michael@0 12 }
michael@0 13 }
michael@0 14
michael@0 15 var pm = new PerfMeasurement(PerfMeasurement.ALL);
michael@0 16 if (pm.eventsMeasured == 0) {
michael@0 17 print("TEST-KNOWN-FAIL | perf-smoketest | stub, skipping test");
michael@0 18 } else {
michael@0 19 pm.start();
michael@0 20 spin_loop();
michael@0 21 pm.stop();
michael@0 22
michael@0 23 check_timing("cpu_cycles", pm.cpu_cycles);
michael@0 24 check_timing("instructions", pm.instructions);
michael@0 25 check_timing("cache_references", pm.cache_references);
michael@0 26 check_timing("cache_misses", pm.cache_misses);
michael@0 27 check_timing("branch_instructions", pm.branch_instructions);
michael@0 28 check_timing("branch_misses", pm.branch_misses);
michael@0 29 check_timing("bus_cycles", pm.bus_cycles);
michael@0 30 check_timing("page_faults", pm.page_faults);
michael@0 31 check_timing("major_page_faults", pm.major_page_faults);
michael@0 32 check_timing("context_switches", pm.context_switches);
michael@0 33 check_timing("cpu_migrations", pm.cpu_migrations);
michael@0 34 }

mercurial