VirtualBox

Changeset 40397 in vbox for trunk


Ignore:
Timestamp:
Mar 7, 2012 9:52:38 PM (13 years ago)
Author:
vboxsync
Message:

VMM: Make most of the tracing optional so we don't have to be afraid of adding lots more.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/vm.h

    r40235 r40397  
    9494    /** Ring-0 Host Context VM Pointer. */
    9595    PVMR0                   pVMR0;
     96    /** Flag indicating that tracing is enabled.  */
     97    bool                    fTracingEnabled;
    9698    /** Alignment padding. */
    97     RTR0PTR                 pvR0Padding;
     99    uint8_t                 abAlignment0[HC_ARCH_BITS == 32 ? 3 : 7];
    98100    /** Raw-mode Context VM Pointer. */
    99101    PVMRC                   pVMRC;
  • trunk/include/VBox/vmm/vm.mac

    r40235 r40397  
    121121    .pVMR3                  RTR3PTR_RES 1
    122122    .pVMR0                  RTR0PTR_RES 1
    123     .pvR0Padding            RTR0PTR_RES 1
     123    .fTracingEnabled        resb 1
     124%if HC_ARCH_BITS == 32
     125    .abAlignment0           resb 3
     126%else
     127    .abAlignment0           resb 7
     128%endif
    124129    .pVMRC                  RTRCPTR_RES 1
    125130    .idCpu                  resd 1
  • trunk/src/VBox/VMM/include/VMMTracing.h

    r40380 r40397  
    4343#define VM_TO_HTB(a_pVM)          ((a_pVM)->CTX_SUFF(hTraceBuf))
    4444
     45/** Macro wrapper for trace points that are disabled by default. */
     46#define TP_COND_VMCPU(a_pVCpu, a_TraceStmt) \
     47    do { \
     48        if (RT_UNLIKELY((a_pVCpu)->fTracingEnabled)) \
     49        { \
     50            RTTRACEBUF const hTB = (a_pVCpu)->CTX_SUFF(pVM)->CTX_SUFF(hTraceBuf); \
     51            a_TraceStmt; \
     52        } \
     53    } while (0)
     54
     55
     56
    4557
    4658/** @name Ring-3 trace points.
     
    5365# elif defined(DBGFTRACE_ENABLED)
    5466#  define VBOXVMM_EM_STATE_CHANGED(a_pVCpu, a_enmOldState, a_enmNewState, a_rc) \
    55         RTTraceBufAddMsgF(VMCPU_TO_HTB(a_pVCpu), "em-state-changed %d -> %d (rc=%d)", a_enmOldState, a_enmNewState, a_rc)
     67        TP_COND_VMCPU(a_pVCpu, RTTraceBufAddMsgF(hTB, "em-state-changed %d -> %d (rc=%d)", a_enmOldState, a_enmNewState, a_rc))
    5668#  define VBOXVMM_EM_STATE_UNCHANGED(a_pVCpu, a_enmState, a_rc) \
    57         RTTraceBufAddMsgF(VMCPU_TO_HTB(a_pVCpu), "em-state-unchanged %d (rc=%d)", a_enmState, a_rc)
     69        TP_COND_VMCPU(a_pVCpu, RTTraceBufAddMsgF(hTB, "em-state-unchanged %d (rc=%d)", a_enmState, a_rc))
    5870#   define VBOXVMM_EM_RAW_RUN_PRE(a_pVCpu, a_pCtx) \
    59         RTTraceBufAddMsgF(VMCPU_TO_HTB(a_pVCpu), "em-raw-pre %04x:%08llx", (a_pCtx)->cs, (a_pCtx)->rip)
     71        TP_COND_VMCPU(a_pVCpu, RTTraceBufAddMsgF(hTB, "em-raw-pre %04x:%08llx", (a_pCtx)->cs, (a_pCtx)->rip))
    6072#   define VBOXVMM_EM_RAW_RUN_RET(a_pVCpu, a_pCtx, a_rc) \
    61         RTTraceBufAddMsgF(VMCPU_TO_HTB(a_pVCpu), "em-raw-ret %04x:%08llx rc=%d", (a_pCtx)->cs, (a_pCtx)->rip, (a_rc))
     73        TP_COND_VMCPU(a_pVCpu, RTTraceBufAddMsgF(hTB, "em-raw-ret %04x:%08llx rc=%d", (a_pCtx)->cs, (a_pCtx)->rip, (a_rc)))
    6274#   define VBOXVMM_EM_FF_HIGH(a_pVCpu, a_fGlobal, a_fLocal, a_rc) \
    63         RTTraceBufAddMsgF(VMCPU_TO_HTB(a_pVCpu), "em-ff-high vm=%#x cpu=%#x rc=%d", (a_fGlobal), (a_fLocal), (a_rc))
     75        TP_COND_VMCPU(a_pVCpu, RTTraceBufAddMsgF(hTB, "em-ff-high vm=%#x cpu=%#x rc=%d", (a_fGlobal), (a_fLocal), (a_rc)))
    6476#   define VBOXVMM_EM_FF_ALL(a_pVCpu, a_fGlobal, a_fLocal, a_rc) \
    65         RTTraceBufAddMsgF(VMCPU_TO_HTB(a_pVCpu), "em-ff-all vm=%#x cpu=%#x rc=%d", (a_fGlobal), (a_fLocal), (a_rc))
     77        TP_COND_VMCPU(a_pVCpu, RTTraceBufAddMsgF(hTB, "em-ff-all vm=%#x cpu=%#x rc=%d", (a_fGlobal), (a_fLocal), (a_rc)))
    6678#   define VBOXVMM_EM_FF_ALL_RET(a_pVCpu, a_rc) \
    67         RTTraceBufAddMsgF(VMCPU_TO_HTB(a_pVCpu), "em-ff-all-ret %d", (a_rc))
     79        TP_COND_VMCPU(a_pVCpu, RTTraceBufAddMsgF(hTB, "em-ff-all-ret %d", (a_rc)))
    6880#   define VBOXVMM_EM_FF_RAW(a_pVCpu, a_fGlobal, a_fLocal) \
    69         RTTraceBufAddMsgF(VMCPU_TO_HTB(a_pVCpu), "em-ff-raw vm=%#x cpu=%#x", (a_fGlobal), (a_fLocal))
     81        TP_COND_VMCPU(a_pVCpu, RTTraceBufAddMsgF(hTB, "em-ff-raw vm=%#x cpu=%#x", (a_fGlobal), (a_fLocal)))
    7082#   define VBOXVMM_EM_FF_RAW_RET(a_pVCpu, a_rc) \
    71         RTTraceBufAddMsgF(VMCPU_TO_HTB(a_pVCpu), "em-ff-raw-ret %d", (a_rc))
     83        TP_COND_VMCPU(a_pVCpu, RTTraceBufAddMsgF(hTB, "em-ff-raw-ret %d", (a_rc)))
    7284
    7385# else
     
    8496# endif
    8597#endif  /* IN_RING3 */
     98/** @} */
    8699
    87100
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette