From: Julian Seward Date: Tue, 24 Apr 2012 11:49:03 +0000 (+0000) Subject: (stats only) Let the callers of LibVEX_Translate know how many guest X-Git-Tag: svn/VALGRIND_3_8_1^2~165 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f13d8aba4c777b8f7069631ff7e4462bc1c4a28;p=thirdparty%2Fvalgrind.git (stats only) Let the callers of LibVEX_Translate know how many guest instructions got incorporated into the IRSB. git-svn-id: svn://svn.valgrind.org/vex/trunk@2313 --- diff --git a/VEX/priv/guest_generic_bb_to_IR.c b/VEX/priv/guest_generic_bb_to_IR.c index 6066fe0ae5..7e39619ee3 100644 --- a/VEX/priv/guest_generic_bb_to_IR.c +++ b/VEX/priv/guest_generic_bb_to_IR.c @@ -180,6 +180,7 @@ static Bool const_False ( void* callback_opaque, Addr64 a ) { IRSB* bb_to_IR ( /*OUT*/VexGuestExtents* vge, /*OUT*/UInt* n_sc_extents, + /*OUT*/UInt* n_guest_instrs, /* stats only */ /*IN*/ void* callback_opaque, /*IN*/ DisOneInstrFn dis_instr_fn, /*IN*/ UChar* guest_code, @@ -245,6 +246,7 @@ IRSB* bb_to_IR ( so far gone. */ delta = 0; n_instrs = 0; + *n_guest_instrs = 0; /* Guest addresses as IRConsts. Used in self-checks to specify the restart-after-discard point. */ @@ -756,6 +758,7 @@ IRSB* bb_to_IR ( vex_printf( "\n"); } + *n_guest_instrs = n_instrs; return irsb; } diff --git a/VEX/priv/guest_generic_bb_to_IR.h b/VEX/priv/guest_generic_bb_to_IR.h index 9c1e7409be..aba6f3c476 100644 --- a/VEX/priv/guest_generic_bb_to_IR.h +++ b/VEX/priv/guest_generic_bb_to_IR.h @@ -164,6 +164,7 @@ extern IRSB* bb_to_IR ( /*OUT*/VexGuestExtents* vge, /*OUT*/UInt* n_sc_extents, + /*OUT*/UInt* n_guest_instrs, /* stats only */ /*IN*/ void* callback_opaque, /*IN*/ DisOneInstrFn dis_instr_fn, /*IN*/ UChar* guest_code, diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index a8c396816c..c73c5d291a 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -528,9 +528,10 @@ VexTranslateResult LibVEX_Translate ( VexTranslateArgs* vta ) /* Set up result struct. */ VexTranslateResult res; - res.status = VexTransOK; - res.n_sc_extents = 0; - res.offs_profInc = -1; + res.status = VexTransOK; + res.n_sc_extents = 0; + res.offs_profInc = -1; + res.n_guest_instrs = 0; /* yet more sanity checks ... */ if (vta->arch_guest == vta->arch_host) { @@ -549,6 +550,7 @@ VexTranslateResult LibVEX_Translate ( VexTranslateArgs* vta ) irsb = bb_to_IR ( vta->guest_extents, &res.n_sc_extents, + &res.n_guest_instrs, vta->callback_opaque, disInstrFn, vta->guest_bytes, diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index bf6162eb55..ef50206cc8 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -491,6 +491,9 @@ typedef /* Offset in generated code of the profile inc, or -1 if none. Needed for later patching. */ Int offs_profInc; + /* Stats only: the number of guest insns included in the + translation. It may be zero (!). */ + UInt n_guest_instrs; } VexTranslateResult;