Browse Source

Track stats for how many times the nonfaulting optimization is applied

Amaan Cheval 6 years ago
parent
commit
c3fa48e3fc
3 changed files with 4 additions and 1 deletions
  1. 1 0
      src/native/cpu.c
  2. 2 1
      src/native/profiler/profiler.h
  3. 1 0
      tests/benchmark/linux-boot.js

+ 1 - 0
src/native/cpu.c

@@ -666,6 +666,7 @@ static void jit_generate(int32_t address_hash, uint32_t phys_addr, struct code_c
         {
             // Non-faulting, so we skip setting previous_ip and patch the previous instruction_pointer
             // increment
+            profiler_stat_increment(S_NONFAULTING_OPTIMIZATION);
             eip_delta += instruction_length;
             gen_patch_increment_instruction_pointer(eip_delta);
         }

+ 2 - 1
src/native/profiler/profiler.h

@@ -22,7 +22,7 @@ enum profile_name {
 };
 
 
-#define PROFILER_STAT_COUNT 8
+#define PROFILER_STAT_COUNT 9
 
 enum stat_name {
     S_COMPILE,
@@ -33,6 +33,7 @@ enum stat_name {
     S_CACHE_DROP,
     S_CACHE_SKIPPED,
     S_COMPILE_WITH_LINK,
+    S_NONFAULTING_OPTIMIZATION,
 };
 
 struct profiler_stat {

+ 1 - 0
tests/benchmark/linux-boot.js

@@ -63,6 +63,7 @@ emulator.add_listener("serial0-output-char", function(chr)
             "CACHE_DROP",
             "CACHE_SKIPPED",
             "COMPILE_WITH_LINK",
+            "NONFAULTING_OPTIMIZATION",
         ];
         const total = cpu.wm.exports["_profiler_get_total"]();
         let text = "";