]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Adjust the built-in profiler so that it can try to count host insns as well as guest...
authorJulian Seward <jseward@acm.org>
Tue, 26 Feb 2019 08:57:57 +0000 (09:57 +0100)
committerJulian Seward <jseward@acm.org>
Tue, 26 Feb 2019 08:57:57 +0000 (09:57 +0100)
coregrind/m_transtab.c

index f7717f6377651ae8cfb5f24e1a17c30c7986d4f2..4ed0844ca4658db87074b0522d09cd79f08ddaca 100644 (file)
@@ -1835,8 +1835,14 @@ void VG_(add_to_transtab)( const VexGuestExtents* vge,
    TTEntryH__init(&sectors[y].ttH[tteix]);
    sectors[y].ttC[tteix].tcptr  = tcptr;
    sectors[y].ttC[tteix].usage.prof.count  = 0;
-   sectors[y].ttC[tteix].usage.prof.weight = 
-      n_guest_instrs == 0 ? 1 : n_guest_instrs;
+
+   sectors[y].ttC[tteix].usage.prof.weight
+      = False
+           ? // Count guest instrs (assumes all side exits are untaken)
+             (n_guest_instrs == 0 ? 1 : n_guest_instrs)
+           : // Counts some (not very good) approximation to host instructions
+             (code_len == 0 ? 1 : (code_len / 4));
+
    sectors[y].ttC[tteix].entry  = entry;
    TTEntryH__from_VexGuestExtents( &sectors[y].ttH[tteix], vge );
    sectors[y].ttH[tteix].status = InUse;