0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @file
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * STAM - Statistics Manager.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/*
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * Copyright (C) 2006-2013 Oracle Corporation
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * available from http://www.virtualbox.org. This file is free software;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * you can redistribute it and/or modify it under the terms of the GNU
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * General Public License (GPL) as published by the Free Software
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * The contents of this file may alternatively be used under the terms
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * of the Common Development and Distribution License Version 1.0
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * VirtualBox OSE distribution, in which case the provisions of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * CDDL are applicable instead of those of the GPL.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * You may elect to license modified versions of this file under the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * terms and conditions of either the GPL or the CDDL or both.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef ___VBox_vmm_stam_h
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define ___VBox_vmm_stam_h
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#include <VBox/types.h>
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#include <iprt/stdarg.h>
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef _MSC_VER
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# if _MSC_VER >= 1400
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# include <intrin.h>
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncRT_C_DECLS_BEGIN
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @defgroup grp_stam The Statistics Manager API
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#if defined(VBOX_WITHOUT_RELEASE_STATISTICS) && defined(VBOX_WITH_STATISTICS)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# error "Both VBOX_WITHOUT_RELEASE_STATISTICS and VBOX_WITH_STATISTICS are defined! Make up your mind!"
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_GET_TS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Gets the CPU timestamp counter.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param u64 The 64-bit variable which the timestamp shall be saved in.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef __GNUC__
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# if defined(RT_ARCH_X86)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /* This produces optimal assembler code for x86 but does not work for AMD64 ('A' means 'either rax or rdx') */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_GET_TS(u64) __asm__ __volatile__ ("rdtsc\n\t" : "=A" (u64))
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# elif defined(RT_ARCH_AMD64)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_GET_TS(u64) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { uint64_t low; uint64_t high; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync __asm__ __volatile__ ("rdtsc\n\t" : "=a"(low), "=d"(high)); \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (u64) = ((high << 32) | low); \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# if _MSC_VER >= 1400
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# pragma intrinsic(__rdtsc)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_GET_TS(u64) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { (u64) = __rdtsc(); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_GET_TS(u64) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t u64Tmp; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync __asm { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync __asm rdtsc \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync __asm mov dword ptr [u64Tmp], eax \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync __asm mov dword ptr [u64Tmp + 4], edx \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (u64) = u64Tmp; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_STATS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Code for inclusion only when VBOX_WITH_STATISTICS is defined.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param code A code block enclosed in {}.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_STATS(code) do code while(0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_STATS(code) do {} while(0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_STATS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Code for inclusion only when VBOX_WITH_STATISTICS is defined.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param code A code block enclosed in {}.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_STATS(code) STAM_REL_STATS(code)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_STATS(code) do {} while(0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Sample type.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef enum STAMTYPE
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Invalid entry. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_INVALID = 0,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic counter. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_COUNTER,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Profiling of an function. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_PROFILE,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Profiling of an operation. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_PROFILE_ADV,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Ratio of A to B, uint32_t types. Not reset. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_RATIO_U32,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Ratio of A to B, uint32_t types. Reset both to 0. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_RATIO_U32_RESET,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Callback. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_CALLBACK,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic unsigned 8-bit value. Not reset. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_U8,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic unsigned 8-bit value. Reset to 0. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_U8_RESET,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic hexadecimal unsigned 8-bit value. Not reset. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_X8,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic hexadecimal unsigned 8-bit value. Reset to 0. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_X8_RESET,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic unsigned 16-bit value. Not reset. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_U16,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic unsigned 16-bit value. Reset to 0. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_U16_RESET,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic hexadecimal unsigned 16-bit value. Not reset. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_X16,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic hexadecimal unsigned 16-bit value. Reset to 0. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_X16_RESET,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic unsigned 32-bit value. Not reset. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_U32,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic unsigned 32-bit value. Reset to 0. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_U32_RESET,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic hexadecimal unsigned 32-bit value. Not reset. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_X32,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic hexadecimal unsigned 32-bit value. Reset to 0. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_X32_RESET,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic unsigned 64-bit value. Not reset. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_U64,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic unsigned 64-bit value. Reset to 0. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_U64_RESET,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic hexadecimal unsigned 64-bit value. Not reset. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_X64,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Generic hexadecimal unsigned 64-bit value. Reset to 0. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_X64_RESET,
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** Generic boolean value. Not reset. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync STAMTYPE_BOOL,
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync /** Generic boolean value. Reset to false. */
4d4f336b656d46f8d301603114bb99ce635aafc0vboxsync STAMTYPE_BOOL_RESET,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The end (exclusive). */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMTYPE_END
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} STAMTYPE;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Sample visibility type.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef enum STAMVISIBILITY
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Invalid entry. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMVISIBILITY_INVALID = 0,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Always visible. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMVISIBILITY_ALWAYS,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Only visible when used (/hit). */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMVISIBILITY_USED,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Not visible in the GUI. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMVISIBILITY_NOT_GUI,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The end (exclusive). */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMVISIBILITY_END
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} STAMVISIBILITY;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Sample unit.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef enum STAMUNIT
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Invalid entry .*/
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_INVALID = 0,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** No unit. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_NONE,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Number of calls. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_CALLS,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Count of whatever. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_COUNT,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Count of bytes. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_BYTES,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Count of bytes. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_PAGES,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Error count. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_ERRORS,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Number of occurences. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_OCCURENCES,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Ticks. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_TICKS,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Ticks per call. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_TICKS_PER_CALL,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Ticks per occurence. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_TICKS_PER_OCCURENCE,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Ratio of good vs. bad. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_GOOD_BAD,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Megabytes. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_MEGABYTES,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Kilobytes. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_KILOBYTES,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Nano seconds. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_NS,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Nanoseconds per call. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_NS_PER_CALL,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Nanoseconds per call. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_NS_PER_OCCURENCE,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Percentage. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_PCT,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Hertz. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_HZ,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The end (exclusive). */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMUNIT_END
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} STAMUNIT;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_U8_INC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint8_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint8_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U8_INC(pCounter) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { ++*(pCounter); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U8_INC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_U8_INC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint8_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint8_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U8_INC(pCounter) STAM_REL_U8_INC(pCounter)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U8_INC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_U8_DEC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Decrements a uint8_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint8_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U8_DEC(pCounter) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { --*(pCounter); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U8_DEC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_U8_DEC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Decrements a uint8_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint8_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U8_DEC(pCounter) STAM_REL_U8_DEC(pCounter)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U8_DEC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_U8_ADD
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint8_t sample by a value.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint8_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Addend The value to add.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U8_ADD(pCounter, Addend) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { *(pCounter) += (Addend); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U8_ADD(pCounter, Addend) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_U8_ADD
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint8_t sample by a value.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint8_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Addend The value to add.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U8_ADD(pCounter, Addend) STAM_REL_U8_ADD(pCounter, Addend
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U8_ADD(pCounter, Addend) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_U16_INC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint16_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint16_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U16_INC(pCounter) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { ++*(pCounter); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U16_INC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_U16_INC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint16_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint16_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U16_INC(pCounter) STAM_REL_U16_INC(pCounter)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U16_INC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_U16_DEC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Decrements a uint16_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint16_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U16_DEC(pCounter) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { --*(pCounter); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U16_DEC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_U16_DEC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Decrements a uint16_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint16_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U16_DEC(pCounter) STAM_REL_U16_DEC(pCounter)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U16_DEC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_U16_INC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint16_t sample by a value.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint16_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Addend The value to add.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U16_ADD(pCounter, Addend) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { *(pCounter) += (Addend); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U16_ADD(pCounter, Addend) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_U16_INC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint16_t sample by a value.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint16_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Addend The value to add.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U16_ADD(pCounter, Addend) STAM_REL_U16_ADD(pCounter, Addend)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U16_ADD(pCounter, Addend) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_U32_INC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint32_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint32_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U32_INC(pCounter) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { ++*(pCounter); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U32_INC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_U32_INC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint32_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint32_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U32_INC(pCounter) STAM_REL_U32_INC(pCounter)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U32_INC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_U32_DEC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Decrements a uint32_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint32_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U32_DEC(pCounter) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { --*(pCounter); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U32_DEC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_U32_DEC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Decrements a uint32_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint32_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U32_DEC(pCounter) STAM_REL_U32_DEC(pCounter)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U32_DEC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_U32_ADD
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint32_t sample by value.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint32_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Addend The value to add.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U32_ADD(pCounter, Addend) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { *(pCounter) += (Addend); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U32_ADD(pCounter, Addend) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_U32_ADD
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint32_t sample by value.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint32_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Addend The value to add.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U32_ADD(pCounter, Addend) STAM_REL_U32_ADD(pCounter, Addend)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U32_ADD(pCounter, Addend) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_U64_INC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint64_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint64_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U64_INC(pCounter) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { ++*(pCounter); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U64_INC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_U64_INC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint64_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint64_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U64_INC(pCounter) STAM_REL_U64_INC(pCounter)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U64_INC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_U64_DEC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Decrements a uint64_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint64_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U64_DEC(pCounter) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { --*(pCounter); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U64_DEC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_U64_DEC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Decrements a uint64_t sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint64_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U64_DEC(pCounter) STAM_REL_U64_DEC(pCounter)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U64_DEC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_U64_ADD
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint64_t sample by a value.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint64_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Addend The value to add.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U64_ADD(pCounter, Addend) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { *(pCounter) += (Addend); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_U64_ADD(pCounter, Addend) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_U64_ADD
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a uint64_t sample by a value.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the uint64_t variable to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Addend The value to add.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U64_ADD(pCounter, Addend) STAM_REL_U64_ADD(pCounter, Addend)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_U64_ADD(pCounter, Addend) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Counter sample - STAMTYPE_COUNTER.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct STAMCOUNTER
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The current count. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync volatile uint64_t c;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} STAMCOUNTER;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a counter. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef STAMCOUNTER *PSTAMCOUNTER;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a const counter. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef const STAMCOUNTER *PCSTAMCOUNTER;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_COUNTER_INC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a counter sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the STAMCOUNTER structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_COUNTER_INC(pCounter) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { (pCounter)->c++; } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_COUNTER_INC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_COUNTER_INC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a counter sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the STAMCOUNTER structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_COUNTER_INC(pCounter) STAM_REL_COUNTER_INC(pCounter)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_COUNTER_INC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_COUNTER_DEC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Decrements a counter sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the STAMCOUNTER structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_COUNTER_DEC(pCounter) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { (pCounter)->c--; } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_COUNTER_DEC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_COUNTER_DEC
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Decrements a counter sample by one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the STAMCOUNTER structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_COUNTER_DEC(pCounter) STAM_REL_COUNTER_DEC(pCounter)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_COUNTER_DEC(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_COUNTER_ADD
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a counter sample by a value.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the STAMCOUNTER structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Addend The value to add to the counter.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_COUNTER_ADD(pCounter, Addend) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { (pCounter)->c += (Addend); } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_COUNTER_ADD(pCounter, Addend) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_COUNTER_ADD
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Increments a counter sample by a value.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pCounter Pointer to the STAMCOUNTER structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Addend The value to add to the counter.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_COUNTER_ADD(pCounter, Addend) STAM_REL_COUNTER_ADD(pCounter, Addend)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_COUNTER_ADD(pCounter, Addend) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_COUNTER_RESET
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Resets the statistics sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_COUNTER_RESET(pCounter) do { (pCounter)->c = 0; } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_COUNTER_RESET(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_COUNTER_RESET
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Resets the statistics sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_COUNTER_RESET(pCounter) STAM_REL_COUNTER_RESET(pCounter)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_COUNTER_RESET(pCounter) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Profiling sample - STAMTYPE_PROFILE.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct STAMPROFILE
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Number of periods. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync volatile uint64_t cPeriods;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Total count of ticks. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync volatile uint64_t cTicks;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Maximum tick count during a sampling. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync volatile uint64_t cTicksMax;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Minimum tick count during a sampling. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync volatile uint64_t cTicksMin;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} STAMPROFILE;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a profile sample. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef STAMPROFILE *PSTAMPROFILE;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a const profile sample. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef const STAMPROFILE *PCSTAMPROFILE;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_PROFILE_ADD_PERIOD
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Adds a period.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param cTicksInPeriod The number of tick (or whatever) of the preiod
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * being added. This is only referenced once.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADD_PERIOD(pProfile, cTicksInPeriod) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t const StamPrefix_cTicks = (cTicksInPeriod); \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile)->cTicks += StamPrefix_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile)->cPeriods++; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfile)->cTicksMax < StamPrefix_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile)->cTicksMax = StamPrefix_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfile)->cTicksMin > StamPrefix_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile)->cTicksMin = StamPrefix_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADD_PERIOD(pProfile, cTicksInPeriod) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_PROFILE_ADD_PERIOD
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Adds a period.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param cTicksInPeriod The number of tick (or whatever) of the preiod
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * being added. This is only referenced once.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADD_PERIOD(pProfile, cTicksInPeriod) STAM_REL_PROFILE_ADD_PERIOD(pProfile, cTicksInPeriod)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADD_PERIOD(pProfile, cTicksInPeriod) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_PROFILE_START
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Samples the start time of a profiling period.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfile Pointer to the STAMPROFILE structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @remarks Declears a stack variable that will be used by related macros.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_START(pProfile, Prefix) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t Prefix##_tsStart; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_GET_TS(Prefix##_tsStart)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_START(pProfile, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_PROFILE_START
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Samples the start time of a profiling period.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfile Pointer to the STAMPROFILE structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @remarks Declears a stack variable that will be used by related macros.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_START(pProfile, Prefix) STAM_REL_PROFILE_START(pProfile, Prefix)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_START(pProfile, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_PROFILE_STOP
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Samples the stop time of a profiling period and updates the sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfile Pointer to the STAMPROFILE structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_STOP(pProfile, Prefix) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_GET_TS(Prefix##_cTicks); \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync Prefix##_cTicks -= Prefix##_tsStart; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile)->cTicks += Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile)->cPeriods++; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfile)->cTicksMax < Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile)->cTicksMax = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfile)->cTicksMin > Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile)->cTicksMin = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_STOP(pProfile, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_PROFILE_STOP
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Samples the stop time of a profiling period and updates the sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfile Pointer to the STAMPROFILE structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_STOP(pProfile, Prefix) STAM_REL_PROFILE_STOP(pProfile, Prefix)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_STOP(pProfile, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_PROFILE_STOP_EX
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Samples the stop time of a profiling period and updates both the sample
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * and an attribution sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfile Pointer to the STAMPROFILE structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfile2 Pointer to the STAMPROFILE structure which this
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * interval should be attributed to as well. This may be NULL.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_STOP_EX(pProfile, pProfile2, Prefix) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_GET_TS(Prefix##_cTicks); \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync Prefix##_cTicks -= Prefix##_tsStart; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile)->cTicks += Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile)->cPeriods++; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfile)->cTicksMax < Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile)->cTicksMax = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfile)->cTicksMin > Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile)->cTicksMin = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfile2)) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile2)->cTicks += Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile2)->cPeriods++; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfile2)->cTicksMax < Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile2)->cTicksMax = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfile2)->cTicksMin > Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile2)->cTicksMin = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_STOP_EX(pProfile, pProfile2, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_PROFILE_STOP_EX
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Samples the stop time of a profiling period and updates both the sample
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * and an attribution sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfile Pointer to the STAMPROFILE structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfile2 Pointer to the STAMPROFILE structure which this
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * interval should be attributed to as well. This may be NULL.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_STOP_EX(pProfile, pProfile2, Prefix) STAM_REL_PROFILE_STOP_EX(pProfile, pProfile2, Prefix)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_STOP_EX(pProfile, pProfile2, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Advanced profiling sample - STAMTYPE_PROFILE_ADV.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Identical to a STAMPROFILE sample, but the start timestamp
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * is stored after the STAMPROFILE structure so the sampling
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * can start and stop in different functions.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct STAMPROFILEADV
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The STAMPROFILE core. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMPROFILE Core;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The start timestamp. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync volatile uint64_t tsStart;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} STAMPROFILEADV;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a advanced profile sample. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef STAMPROFILEADV *PSTAMPROFILEADV;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a const advanced profile sample. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef const STAMPROFILEADV *PCSTAMPROFILEADV;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_PROFILE_ADV_START
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Samples the start time of a profiling period.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_START(pProfileAdv, Prefix) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_GET_TS((pProfileAdv)->tsStart)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_START(pProfileAdv, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_PROFILE_ADV_START
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Samples the start time of a profiling period.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_START(pProfileAdv, Prefix) STAM_REL_PROFILE_ADV_START(pProfileAdv, Prefix)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_START(pProfileAdv, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_PROFILE_ADV_STOP
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Samples the stop time of a profiling period (if running) and updates the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_STOP(pProfileAdv, Prefix) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfileAdv)->tsStart) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_GET_TS(Prefix##_cTicks); \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync Prefix##_cTicks -= (pProfileAdv)->tsStart; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv)->tsStart = 0; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv)->Core.cTicks += Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv)->Core.cPeriods++; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfileAdv)->Core.cTicksMax < Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv)->Core.cTicksMax = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfileAdv)->Core.cTicksMin > Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv)->Core.cTicksMin = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_STOP(pProfileAdv, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_PROFILE_ADV_STOP
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Samples the stop time of a profiling period (if running) and updates the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_STOP(pProfileAdv, Prefix) STAM_REL_PROFILE_ADV_STOP(pProfileAdv, Prefix)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_STOP(pProfileAdv, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_PROFILE_ADV_STOP_START
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Stops one profile counter (if running) and starts another one.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv1 Pointer to the STAMPROFILEADV structure to stop.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv2 Pointer to the STAMPROFILEADV structure to start.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_STOP_START(pProfileAdv1, pProfileAdv2, Prefix) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_GET_TS(Prefix##_cTicks); \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv2)->tsStart = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfileAdv1)->tsStart) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync Prefix##_cTicks -= (pProfileAdv1)->tsStart; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv1)->tsStart = 0; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv1)->Core.cTicks += Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv1)->Core.cPeriods++; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfileAdv1)->Core.cTicksMax < Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv1)->Core.cTicksMax = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfileAdv1)->Core.cTicksMin > Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv1)->Core.cTicksMin = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_STOP_START(pProfileAdv1, pProfileAdv2, Prefix) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_PROFILE_ADV_STOP_START
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Samples the stop time of a profiling period (if running) and updates the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_STOP_START(pProfileAdv1, pProfileAdv2, Prefix) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_REL_PROFILE_ADV_STOP_START(pProfileAdv1, pProfileAdv2, Prefix)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_STOP_START(pProfileAdv1, pProfileAdv2, Prefix) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_PROFILE_ADV_SUSPEND
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Suspends the sampling for a while. This can be useful to exclude parts
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * covered by other samples without screwing up the count, and average+min times.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables. The prefix
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * must match that of the resume one since it stores the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * suspend time in a stack variable.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_SUSPEND(pProfileAdv, Prefix) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t Prefix##_tsSuspend; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_GET_TS(Prefix##_tsSuspend)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_SUSPEND(pProfileAdv, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_PROFILE_ADV_SUSPEND
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Suspends the sampling for a while. This can be useful to exclude parts
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * covered by other samples without screwing up the count, and average+min times.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables. The prefix
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * must match that of the resume one since it stores the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * suspend time in a stack variable.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_SUSPEND(pProfileAdv, Prefix) STAM_REL_PROFILE_ADV_SUSPEND(pProfileAdv, Prefix)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_SUSPEND(pProfileAdv, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_PROFILE_ADV_RESUME
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Counter to STAM_REL_PROFILE_ADV_SUSPEND.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables. This must
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * match the one used with the SUSPEND!
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_RESUME(pProfileAdv, Prefix) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t Prefix##_tsNow; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_GET_TS(Prefix##_tsNow); \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv)->tsStart += Prefix##_tsNow - Prefix##_tsSuspend; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_RESUME(pProfileAdv, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_PROFILE_ADV_RESUME
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Counter to STAM_PROFILE_ADV_SUSPEND.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables. This must
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * match the one used with the SUSPEND!
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_RESUME(pProfileAdv, Prefix) STAM_REL_PROFILE_ADV_RESUME(pProfileAdv, Prefix)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_RESUME(pProfileAdv, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_PROFILE_ADV_STOP_EX
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Samples the stop time of a profiling period (if running) and updates both
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * the sample and an attribution sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfile2 Pointer to the STAMPROFILE structure which this
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * interval should be attributed to as well. This may be NULL.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_STOP_EX(pProfileAdv, pProfile2, Prefix) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync do { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfileAdv)->tsStart) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint64_t Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_GET_TS(Prefix##_cTicks); \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync Prefix##_cTicks -= (pProfileAdv)->tsStart; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv)->tsStart = 0; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv)->Core.cTicks += Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv)->Core.cPeriods++; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfileAdv)->Core.cTicksMax < Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv)->Core.cTicksMax = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfileAdv)->Core.cTicksMin > Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfileAdv)->Core.cTicksMin = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfile2)) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync { \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile2)->cTicks += Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile2)->cPeriods++; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfile2)->cTicksMax < Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile2)->cTicksMax = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync if ((pProfile2)->cTicksMin > Prefix##_cTicks) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync (pProfile2)->cTicksMin = Prefix##_cTicks; \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_STOP_EX(pProfileAdv, pProfile2, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_PROFILE_ADV_STOP_EX
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Samples the stop time of a profiling period (if running) and updates both
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * the sample and an attribution sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfile2 Pointer to the STAMPROFILE structure which this
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * interval should be attributed to as well. This may be NULL.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param Prefix Identifier prefix used to internal variables.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_STOP_EX(pProfileAdv, pProfile2, Prefix) STAM_REL_PROFILE_ADV_STOP_EX(pProfileAdv, pProfile2, Prefix)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_STOP_EX(pProfileAdv, pProfile2, Prefix) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_PROFILE_ADV_IS_RUNNING
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Checks if it is running.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_IS_RUNNING(pProfileAdv) (pProfileAdv)->tsStart
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_IS_RUNNING(pProfileAdv) (false)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_PROFILE_ADV_IS_RUNNING
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Checks if it is running.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_IS_RUNNING(pProfileAdv) STAM_REL_PROFILE_ADV_IS_RUNNING(pProfileAdv)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_IS_RUNNING(pProfileAdv) (false)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_PROFILE_ADV_SET_STOPPED
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Marks the profile counter as stopped.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * This is for avoiding screwups in twisty code.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_SET_STOPPED(pProfileAdv) do { (pProfileAdv)->tsStart = 0; } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_REL_PROFILE_ADV_SET_STOPPED(pProfileAdv) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_PROFILE_ADV_SET_STOPPED
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Marks the profile counter as stopped.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * This is for avoiding screwups in twisty code.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifdef VBOX_WITH_STATISTICS
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_SET_STOPPED(pProfileAdv) STAM_REL_PROFILE_ADV_SET_STOPPED(pProfileAdv)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#else
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync# define STAM_PROFILE_ADV_SET_STOPPED(pProfileAdv) do { } while (0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Ratio of A to B, uint32_t types.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @remark Use STAM_STATS or STAM_REL_STATS for modifying A & B values.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct STAMRATIOU32
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Sample A. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t volatile u32A;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Sample B. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t volatile u32B;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} STAMRATIOU32;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a uint32_t ratio. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef STAMRATIOU32 *PSTAMRATIOU32;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to const a uint32_t ratio. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef const STAMRATIOU32 *PCSTAMRATIOU32;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @defgroup grp_stam_r3 The STAM Host Context Ring 3 API
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncVMMR3DECL(int) STAMR3InitUVM(PUVM pUVM);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncVMMR3DECL(void) STAMR3TermUVM(PUVM pUVM);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncVMMR3DECL(int) STAMR3RegisterU(PUVM pUVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const char *pszName, STAMUNIT enmUnit, const char *pszDesc);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncVMMR3DECL(int) STAMR3Register(PVM pVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const char *pszName, STAMUNIT enmUnit, const char *pszDesc);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_REG
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Registers a statistics sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pVM VM Handle.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pvSample Pointer to the sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param enmType Sample type. This indicates what pvSample is pointing at.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pszName Sample name. The name is on this form "/<component>/<sample>".
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Further nesting is possible.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param enmUnit Sample unit.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pszDesc Sample description.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define STAM_REL_REG(pVM, pvSample, enmType, pszName, enmUnit, pszDesc) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_REL_STATS({ int rcStam = STAMR3Register(pVM, pvSample, enmType, STAMVISIBILITY_ALWAYS, pszName, enmUnit, pszDesc); \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync AssertRC(rcStam); })
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REG
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Registers a statistics sample if statistics are enabled.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pVM VM Handle.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pvSample Pointer to the sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param enmType Sample type. This indicates what pvSample is pointing at.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pszName Sample name. The name is on this form "/<component>/<sample>".
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Further nesting is possible.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param enmUnit Sample unit.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pszDesc Sample description.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define STAM_REG(pVM, pvSample, enmType, pszName, enmUnit, pszDesc) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_STATS({STAM_REL_REG(pVM, pvSample, enmType, pszName, enmUnit, pszDesc);})
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REL_REG_USED
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Registers a statistics sample which only shows when used.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pVM VM Handle.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pvSample Pointer to the sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param enmType Sample type. This indicates what pvSample is pointing at.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pszName Sample name. The name is on this form "/<component>/<sample>".
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Further nesting is possible.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param enmUnit Sample unit.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pszDesc Sample description.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define STAM_REL_REG_USED(pVM, pvSample, enmType, pszName, enmUnit, pszDesc) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_REL_STATS({ int rcStam = STAMR3Register(pVM, pvSample, enmType, STAMVISIBILITY_USED, pszName, enmUnit, pszDesc); \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync AssertRC(rcStam);})
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @def STAM_REG_USED
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Registers a statistics sample which only shows when used, if statistics are enabled.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pVM VM Handle.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pvSample Pointer to the sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param enmType Sample type. This indicates what pvSample is pointing at.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pszName Sample name. The name is on this form "/<component>/<sample>".
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Further nesting is possible.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param enmUnit Sample unit.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pszDesc Sample description.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define STAM_REG_USED(pVM, pvSample, enmType, pszName, enmUnit, pszDesc) \
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAM_STATS({ STAM_REL_REG_USED(pVM, pvSample, enmType, pszName, enmUnit, pszDesc); })
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncVMMR3DECL(int) STAMR3RegisterFU(PUVM pUVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const char *pszDesc, const char *pszName, ...);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncVMMR3DECL(int) STAMR3RegisterF(PVM pVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const char *pszDesc, const char *pszName, ...);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncVMMR3DECL(int) STAMR3RegisterVU(PUVM pUVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const char *pszDesc, const char *pszName, va_list args);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncVMMR3DECL(int) STAMR3RegisterV(PVM pVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const char *pszDesc, const char *pszName, va_list args);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Resets the sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pVM The VM handle.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pvSample The sample registered using STAMR3RegisterCallback.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef void FNSTAMR3CALLBACKRESET(PVM pVM, void *pvSample);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a STAM sample reset callback. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef FNSTAMR3CALLBACKRESET *PFNSTAMR3CALLBACKRESET;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Prints the sample into the buffer.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pVM The VM handle.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pvSample The sample registered using STAMR3RegisterCallback.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pszBuf The buffer to print into.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param cchBuf The size of the buffer.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef void FNSTAMR3CALLBACKPRINT(PVM pVM, void *pvSample, char *pszBuf, size_t cchBuf);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a STAM sample print callback. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef FNSTAMR3CALLBACKPRINT *PFNSTAMR3CALLBACKPRINT;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncVMMR3DECL(int) STAMR3RegisterCallback(PVM pVM, void *pvSample, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync PFNSTAMR3CALLBACKRESET pfnReset, PFNSTAMR3CALLBACKPRINT pfnPrint,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const char *pszDesc, const char *pszName, ...);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncVMMR3DECL(int) STAMR3RegisterCallbackV(PVM pVM, void *pvSample, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync PFNSTAMR3CALLBACKRESET pfnReset, PFNSTAMR3CALLBACKPRINT pfnPrint,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync const char *pszDesc, const char *pszName, va_list args);
c647bac94d46aebf0bcf05d87cea81d048dc2675vboxsyncVMMR3DECL(int) STAMR3Deregister(PUVM pUVM, const char *pszPat);
c647bac94d46aebf0bcf05d87cea81d048dc2675vboxsyncVMMR3DECL(int) STAMR3DeregisterF(PUVM pUVM, const char *pszPatFmt, ...);
c647bac94d46aebf0bcf05d87cea81d048dc2675vboxsyncVMMR3DECL(int) STAMR3DeregisterV(PUVM pUVM, const char *pszPatFmt, va_list va);
c647bac94d46aebf0bcf05d87cea81d048dc2675vboxsyncVMMR3DECL(int) STAMR3DeregisterByAddr(PUVM pUVM, void *pvSample);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
a04100f955c08c93b063cf3d9c4f963637996f3cvboxsyncVMMR3DECL(int) STAMR3Reset(PUVM pUVM, const char *pszPat);
a04100f955c08c93b063cf3d9c4f963637996f3cvboxsyncVMMR3DECL(int) STAMR3Snapshot(PUVM pUVM, const char *pszPat, char **ppszSnapshot, size_t *pcchSnapshot, bool fWithDesc);
a04100f955c08c93b063cf3d9c4f963637996f3cvboxsyncVMMR3DECL(int) STAMR3SnapshotFree(PUVM pUVM, char *pszSnapshot);
a04100f955c08c93b063cf3d9c4f963637996f3cvboxsyncVMMR3DECL(int) STAMR3Dump(PUVM pUVM, const char *pszPat);
a04100f955c08c93b063cf3d9c4f963637996f3cvboxsyncVMMR3DECL(int) STAMR3DumpToReleaseLog(PUVM pUVM, const char *pszPat);
a04100f955c08c93b063cf3d9c4f963637996f3cvboxsyncVMMR3DECL(int) STAMR3Print(PUVM pUVM, const char *pszPat);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Callback function for STAMR3Enum().
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @returns non-zero to halt the enumeration.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pszName The name of the sample.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param enmType The type.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pvSample Pointer to the data. enmType indicates the format of this data.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param enmUnit The unit.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param enmVisibility The visibility.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pszDesc The description.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pvUser The pvUser argument given to STAMR3Enum().
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef DECLCALLBACK(int) FNSTAMR3ENUM(const char *pszName, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit,
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync STAMVISIBILITY enmVisiblity, const char *pszDesc, void *pvUser);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a FNSTAMR3ENUM(). */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef FNSTAMR3ENUM *PFNSTAMR3ENUM;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
a04100f955c08c93b063cf3d9c4f963637996f3cvboxsyncVMMR3DECL(int) STAMR3Enum(PUVM pUVM, const char *pszPat, PFNSTAMR3ENUM pfnEnum, void *pvUser);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncVMMR3DECL(const char *) STAMR3GetUnit(STAMUNIT enmUnit);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @} */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @} */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncRT_C_DECLS_END
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync