|
Bitdefender Hypervisor Memory Introspection
|
Event measurement. More...
#include "guests.h"Go to the source code of this file.
Macros | |
| #define | __stats_case(x) case x: return &(#x[5]) |
Functions | |
| static __pure const char * | IntStatGetName (STAT_ID StatId) |
| Returns the name of a STAT_ID. More... | |
| static void | GetTime (TIMESPEC *Time) |
| Returns the current time. More... | |
| static void | DiffTime (TIMESPEC const *End, TIMESPEC const *Start, TIMESPEC *Result) |
| Computes the delta between two time values. More... | |
| static void | IncStatsCallsCount (void) |
| Computes the time GetTime was called for each counter that was started before this one and on this event. More... | |
| static void | AddToTime (TIMESPEC *Time, TIMESPEC const *Adder) |
| Adds two time values. More... | |
| void | IntStatsDumpAll (void) |
| Prints all the non-zero stats. More... | |
| void | IntStatsReset (STAT_ID StatId) |
| Resets a stat. More... | |
| void | IntStatsResetAll (void) |
| Resets all the stats. More... | |
| void | IntStatStart (STAT_ID StatId) |
| Starts a stat measurement. More... | |
| void | IntStatStop (STAT_ID StatId) |
| Stops a stat measurement. More... | |
| void | IntStatDiscard (STAT_ID StatId) |
| Discards the current measurement for a stat counter. More... | |
| void | IntStatsInit (void) |
| Initialization routine. More... | |
Variables | |
| STAT_COUNTER | gCounters [statsMaxCounter] = {0} |
| The list of counters. More... | |
Event measurement.
Offers a way to measure how many events of some kind were triggered and how much time it takes for introcore to handle it. Event, in this case, can mean anything, from an entire VMEXIT event, to a smaller, more focused, part of an algorithm. Each event is defined by a STAT_ID. Stats can be nested. Normally, only the time an event was triggered is measured (and this is usually enough to pin point performance problems). If STATS_HAS_HIGHRES_TIMER is defined we will also measure the time needed for Introcore to handle that event. This is usually not defined because it can leas to hypercalls to the hypervisor and the simple act of gathering this information may create performance problems.
Definition in file stats.c.
| #define __stats_case | ( | x | ) | case x: return &(#x[5]) |
Referenced by IntStatGetName().
Adds two time values.
| [in,out] | Time | Value to which to add. |
| [in] | Adder | Value to add. |
Definition at line 193 of file stats.c.
Referenced by IntStatStop().
Computes the delta between two time values.
| [in] | End | The end of the time interval. |
| [in] | Start | The start of the time interval. |
| [out] | Result | The delta. |
Definition at line 140 of file stats.c.
Referenced by IntStatsInit(), and IntStatStop().
|
static |
Returns the current time.
If STATS_HAS_HIGHRES_TIMER is defined, this will use clock_gettime; if not, rdtsc Will be used.
| [out] | Time | The time. |
Definition at line 120 of file stats.c.
Referenced by IntStatsInit(), IntStatStart(), and IntStatStop().
|
static |
Computes the time GetTime was called for each counter that was started before this one and on this event.
Does nothing if STATS_HAS_HIGHRES_TIMER is not defined.
Definition at line 171 of file stats.c.
Referenced by IntStatStart(), and IntStatStop().
| void IntStatDiscard | ( | STAT_ID | StatId | ) |
Discards the current measurement for a stat counter.
| [in] | StatId | Counter to discard. |
Definition at line 431 of file stats.c.
Referenced by IntStatStop().
Returns the name of a STAT_ID.
| [in] | StatId | The ID of the stat. |
Definition at line 30 of file stats.c.
Referenced by IntStatsDumpAll().
| void IntStatsDumpAll | ( | void | ) |
Prints all the non-zero stats.
Definition at line 220 of file stats.c.
Referenced by IntGuestUninit(), and IntHandleTimer().
| void IntStatsInit | ( | void | ) |
Initialization routine.
If STATS_HAS_HIGHRES_TIMER is defined will determine how much a GetTime takes so we know how much to subtract when a counter includes another counter.
Definition at line 448 of file stats.c.
Referenced by IntGuestInit(), and IntStatStop().
| void IntStatsReset | ( | STAT_ID | StatId | ) |
Resets a stat.
| [in] | StatId | Stat to reset. |
Definition at line 276 of file stats.c.
Referenced by IntStatsResetAll(), and IntStatStop().
| void IntStatsResetAll | ( | void | ) |
| void IntStatStart | ( | STAT_ID | StatId | ) |
Starts a stat measurement.
Does nothing before the OS-specific parts of Introcore are initialized (IntWinGuestFinishInit for Windows guests; IntLixGuestNew for Linux guests) or if Introcore is preparing to unload.
Each call must be matched by a IntStatStop call. Calling this function twice for the same gEventId will over-write the old measurement for this stat.
| [in] | StatId | Stat for which to start the measurement. |
| void IntStatStop | ( | STAT_ID | StatId | ) |
Stops a stat measurement.
Does nothing before the OS-specific parts of Introcore are initialized (IntWinGuestFinishInit for Windows guests; IntLixGuestNew for Linux guests) or if Introcore is preparing to unload.
Must be called after a IntStatStart call.
| [in] | StatId | Stat for which to stop the measurement. |
| STAT_COUNTER gCounters[statsMaxCounter] = {0} |