VirtualBox

Changeset 37409 in vbox for trunk/include/iprt/trace.h


Ignore:
Timestamp:
Jun 10, 2011 3:10:29 PM (13 years ago)
Author:
vboxsync
Message:

iprt/trace: Added the CPU/APIC ID to the trace entires. Added some introspection APIs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/trace.h

    r37396 r37409  
    7676 * @{ */
    7777/** Free the memory block on release using RTMemFree(). */
    78 #define RTTRACEBUF_FLAGS_FREE_ME    RT_BIT_32(0)
     78#define RTTRACEBUF_FLAGS_FREE_ME        RT_BIT_32(0)
     79/** Whether the trace buffer is disabled or enabled. */
     80#define RTTRACEBUF_FLAGS_DISABLED       RT_BIT_32(RTTRACEBUF_FLAGS_DISABLED_BIT)
     81/** The bit number corresponding to the RTTRACEBUF_FLAGS_DISABLED mask. */
     82#define RTTRACEBUF_FLAGS_DISABLED_BIT   1
    7983/** Mask of the valid flags. */
    80 #define RTTRACEBUF_FLAGS_MASK       UINT32_C(0x00000001)
     84#define RTTRACEBUF_FLAGS_MASK           UINT32_C(0x00000003)
    8185/** @}  */
    8286
     
    9094RTDECL(int)         RTTraceBufDumpToAssert(RTTRACEBUF hTraceBuf);
    9195
     96/**
     97 * Trace buffer callback for processing one entry.
     98 *
     99 * Used by RTTraceBufEnumEntries.
     100 *
     101 * @returns IPRT status code.  Any status code but VINF_SUCCESS will abort the
     102 *          enumeration and be returned by RTTraceBufEnumEntries.
     103 * @param   hTraceBuf           The trace buffer handle.
     104 * @param   iEntry              The entry number.
     105 * @param   NanoTS              The timestamp of the entry.
     106 * @param   idCpu               The ID of the CPU which added the entry.
     107 * @param   pszMsg              The message text.
     108 * @param   pvUser              The user argument.
     109 */
     110typedef DECLCALLBACK(int) FNRTTRACEBUFCALLBACK(RTTRACEBUF hTraceBuf, uint32_t iEntry, uint64_t NanoTS,
     111                                               RTCPUID idCpu, const char *pszMsg, void *pvUser);
     112/** Pointer to trace buffer enumeration callback function. */
     113typedef FNRTTRACEBUFCALLBACK *PFNRTTRACEBUFCALLBACK;
     114
     115/**
     116 * Enumerates the used trace buffer entries, calling @a pfnCallback for each.
     117 *
     118 * @returns IPRT status code.  Should the callback (@a pfnCallback) return
     119 *          anything other than VINF_SUCCESS, then the enumeration will be
     120 *          aborted and the status code will be returned by this function.
     121 * @retval  VINF_SUCCESS
     122 * @retval  VERR_INVALID_HANDLE
     123 * @retval  VERR_INVALID_PARAMETER
     124 * @retval  VERR_INVALID_POINTER
     125 *
     126 * @param   hTraceBuf           The trace buffer handle.  Special handles are
     127 *                              accepted.
     128 * @param   pfnCallback         The callback to call for each entry.
     129 * @param   pvUser              The user argument for the callback.
     130 */
     131RTDECL(int)         RTTraceBufEnumEntries(RTTRACEBUF hTraceBuf, PFNRTTRACEBUFCALLBACK pfnCallback, void *pvUser);
     132
     133/**
     134 * Gets the entry size used by the specified trace buffer.
     135 *
     136 * @returns The size on success, 0 if the handle is invalid.
     137 *
     138 * @param   hTraceBuf           The trace buffer handle.  Special handles are
     139 *                              accepted.
     140 */
     141RTDECL(uint32_t)    RTTraceBufGetEntrySize(RTTRACEBUF hTraceBuf);
     142
     143/**
     144 * Gets the number of entries in the specified trace buffer.
     145 *
     146 * @returns The entry count on success, 0 if the handle is invalid.
     147 *
     148 * @param   hTraceBuf           The trace buffer handle.  Special handles are
     149 *                              accepted.
     150 */
     151RTDECL(uint32_t)    RTTraceBufGetEntryCount(RTTRACEBUF hTraceBuf);
     152
     153
     154/**
     155 * Disables tracing.
     156 *
     157 * @returns @c true if tracing was enabled prior to this call, @c false if
     158 *          disabled already.
     159 *
     160 * @param   hTraceBuf           The trace buffer handle.  Special handles are
     161 *                              accepted.
     162 */
     163RTDECL(bool)        RTTraceBufDisable(RTTRACEBUF hTraceBuf);
     164
     165/**
     166 * Enables tracing.
     167 *
     168 * @returns @c true if tracing was enabled prior to this call, @c false if
     169 *          disabled already.
     170 *
     171 * @param   hTraceBuf           The trace buffer handle.  Special handles are
     172 *                              accepted.
     173 */
     174RTDECL(bool)        RTTraceBufEnable(RTTRACEBUF hTraceBuf);
     175
     176
    92177RTDECL(int)         RTTraceBufAddMsg(      RTTRACEBUF hTraceBuf, const char *pszMsg);
    93178RTDECL(int)         RTTraceBufAddMsgF(     RTTRACEBUF hTraceBuf, const char *pszMsgFmt, ...);
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