From: Julian Seward Date: Tue, 26 Feb 2019 08:57:57 +0000 (+0100) Subject: Adjust the built-in profiler so that it can try to count host insns as well as guest... X-Git-Tag: VALGRIND_3_15_0~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6bcb493b03a71d49a288913a9b8e8c081268fd7d;p=thirdparty%2Fvalgrind.git Adjust the built-in profiler so that it can try to count host insns as well as guest insns. n-i-bz. --- diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c index f7717f6377..4ed0844ca4 100644 --- a/coregrind/m_transtab.c +++ b/coregrind/m_transtab.c @@ -1835,8 +1835,14 @@ void VG_(add_to_transtab)( const VexGuestExtents* vge, TTEntryH__init(§ors[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( §ors[y].ttH[tteix], vge ); sectors[y].ttH[tteix].status = InUse;