]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
For --profile-flags=, weight the counts by the number of guest insns
authorJulian Seward <jseward@acm.org>
Tue, 24 Apr 2012 11:50:49 +0000 (11:50 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 24 Apr 2012 11:50:49 +0000 (11:50 +0000)
in each IRSB, rather than considering each IRSB to have a weight of 1.
This probably gives more representative profiles, especially post
t-chain merge, which made inter-SB transitions more or less free
compared to what they were before.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12542

coregrind/m_translate.c
coregrind/m_transtab.c
coregrind/pub_core_transtab.h

index 31740a3272e040a457e023437f6d7e379e1f7e95..607b030f8fb5fc33bb2dc86d600e0e5cfcd5fd7a 100644 (file)
@@ -1579,6 +1579,7 @@ Bool VG_(translate) ( ThreadId tid,
                                 tmpbuf_used,
                                 tres.n_sc_extents > 0,
                                 tres.offs_profInc,
+                                tres.n_guest_instrs,
                                 vex_arch );
       } else {
           vg_assert(tres.offs_profInc == -1); /* -1 == unset */
index 1d3cc206dc670fa82b2e1043706f2563a58b3213..7c08725bb4607b70fb977f937dd36a50bad815d6 100644 (file)
@@ -1446,6 +1446,7 @@ void VG_(add_to_transtab)( VexGuestExtents* vge,
                            UInt             code_len,
                            Bool             is_self_checking,
                            Int              offs_profInc,
+                           UInt             n_guest_instrs,
                            VexArch          arch_host )
 {
    Int    tcAvailQ, reqdQ, y, i;
@@ -1459,6 +1460,9 @@ void VG_(add_to_transtab)( VexGuestExtents* vge,
    /* 60000: should agree with N_TMPBUF in m_translate.c. */
    vg_assert(code_len > 0 && code_len < 60000);
 
+   /* Generally stay sane */
+   vg_assert(n_guest_instrs < 200); /* it can be zero, tho */
+
    if (0)
       VG_(printf)("add_to_transtab(entry = 0x%llx, len = %d)\n",
                   entry, code_len);
@@ -1548,7 +1552,7 @@ void VG_(add_to_transtab)( VexGuestExtents* vge,
    sectors[y].tt[i].status = InUse;
    sectors[y].tt[i].tcptr  = tcptr;
    sectors[y].tt[i].count  = 0;
-   sectors[y].tt[i].weight = 1;
+   sectors[y].tt[i].weight = n_guest_instrs == 0 ? 1 : n_guest_instrs;
    sectors[y].tt[i].vge    = *vge;
    sectors[y].tt[i].entry  = entry;
 
index 046bc21a95dca5216a76035a1ee202289a83292b..9a10b663e5a17a59551b80d3cee8eaf83449db8a 100644 (file)
@@ -62,6 +62,7 @@ void VG_(add_to_transtab)( VexGuestExtents* vge,
                            UInt             code_len,
                            Bool             is_self_checking,
                            Int              offs_profInc,
+                           UInt             n_guest_instrs,
                            VexArch          arch_host );
 
 extern