1051N/A; STAM - Statistics Manager.
1051N/A; Copyright (C) 2006-2010 Oracle Corporation
1051N/A; This file is part of VirtualBox Open Source Edition (OSE), as
1051N/A; you can redistribute it
and/or modify it under the terms of the GNU
1051N/A; General Public License (GPL) as published by the Free Software
1051N/A; Foundation, in version 2 as it comes in the "COPYING" file of the
1051N/A; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
1051N/A; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1051N/A; The contents of this file may alternatively be used under the terms
1051N/A; of the Common Development and Distribution License Version 1.0
1051N/A; VirtualBox OSE distribution, in which case the provisions of the
1051N/A; CDDL are applicable instead of those of the GPL.
1051N/A; You may elect to license modified versions of this file under the
1051N/A; terms and conditions of either the GPL or the CDDL or both.
6238N/A%ifndef ___VBox_vmm_stam_mac__
1051N/A%define ___VBox_vmm_stam_mac__
6238N/A%ifndef VBOX_WITH_STATISTICS
6238N/A %define VBOX_WITH_STATISTICS
; Counter sample - STAMTYPE_COUNTER.
; Increments a counter sample by one.
; @param %1 Pointer to the STAMCOUNTER structure to operate on.
%macro STAM32_COUNTER_INC 1
%ifdef VBOX_WITH_STATISTICS
%macro STAM64_COUNTER_INC 1
%ifdef VBOX_WITH_STATISTICS
%macro STAM_COUNTER_INC 1
%ifdef VBOX_WITH_STATISTICS
; Increments a counter sample by a value.
; @param %1 Pointer to the STAMCOUNTER structure to operate on.
; @param %2 The value to add to the counter.
%macro STAM32_COUNTER_ADD 2
%ifdef VBOX_WITH_STATISTICS
%macro STAM64_COUNTER_ADD 2
%ifdef VBOX_WITH_STATISTICS
%macro STAM_COUNTER_ADD 2
%ifdef VBOX_WITH_STATISTICS
STAM64_COUNTER_ADD %1, %2
STAM32_COUNTER_ADD %1, %2
; Profiling sample - STAMTYPE_PROFILE.
; Samples the start time of a profiling period.
; @param %1 Pointer to somewhere one can store a 64-bit timestamp until STAM_PROFILE_STOPP
%macro STAM32_PROFILE_START 1
%ifdef VBOX_WITH_STATISTICS
%macro STAM64_PROFILE_START 1
%ifdef VBOX_WITH_STATISTICS
%macro STAM_PROFILE_START 1
%ifdef VBOX_WITH_STATISTICS
; Samples the stop time of a profiling period and updates the sample.
; @param %1 Pointer to the STAMPROFILE structure to operate on.
; @param %2 Pointer to where the 64-bit timestamp from STAM_PROFILE_START was stored.
%macro STAM32_PROFILE_STOP 2
%ifdef VBOX_WITH_STATISTICS
jb short %%not_update_max
jbe short %%not_update_max
ja short %%not_update_min
jae short %%not_update_min
%macro STAM64_PROFILE_STOP 2
%ifdef VBOX_WITH_STATISTICS
jbe short %%not_update_max
jae short %%not_update_min
%macro STAM_PROFILE_STOP 2
%ifdef VBOX_WITH_STATISTICS
STAM64_PROFILE_STOP %1, %2
STAM32_PROFILE_STOP %1, %2
; Samples the start time of a profiling period.
; @param %1 Pointer to the STAMPROFILEADV structure to operate on.
%macro STAM32_PROFILE_ADV_START 1
%ifdef VBOX_WITH_STATISTICS
%macro STAM64_PROFILE_ADV_START 1
%ifdef VBOX_WITH_STATISTICS
%macro STAM_PROFILE_ADV_START 1
%ifdef VBOX_WITH_STATISTICS
STAM64_PROFILE_ADV_START %1
STAM32_PROFILE_ADV_START %1
; Samples the stop time of a profiling period and updates the sample.
; @param %1 Pointer to the STAMPROFILEADV structure to operate on.
%macro STAM32_PROFILE_ADV_STOP 1
%ifdef VBOX_WITH_STATISTICS
cmp dword [ecx + 4], byte 0
STAM32_PROFILE_STOP %1, ecx
%macro STAM64_PROFILE_ADV_STOP 1
%ifdef VBOX_WITH_STATISTICS
STAM64_PROFILE_STOP %1, rcx
%macro STAM_PROFILE_ADV_STOP 1
%ifdef VBOX_WITH_STATISTICS
STAM64_PROFILE_ADV_STOP %1
STAM32_PROFILE_ADV_STOP %1