提交 44b1144e 编写于 作者: R Rodrigo Kumpera

[counters] Introduce variance and units.

上级 8e4d85b5
......@@ -20,6 +20,18 @@ static MonoCounter *counters = NULL;
static int valid_mask = 0;
static int set_mask = 0;
static int
mono_counter_get_variance (MonoCounter *counter)
{
return counter->type & MONO_COUNTER_VARIANCE_MASK;
}
static int
mono_counter_get_unit (MonoCounter *counter)
{
return counter->type & MONO_COUNTER_UNIT_MASK;
}
/**
* mono_counters_enable:
* @section_mask: a mask listing the sections that will be displayed
......@@ -170,7 +182,7 @@ mono_counters_dump_section (int section, FILE *outfile)
{
MonoCounter *counter = counters;
while (counter) {
if (counter->type & section)
if (counter->type & section && mono_counter_get_variance (counter) == MONO_COUNTER_MONOTONIC)
dump_counter (counter, outfile);
counter = counter->next;
}
......
......@@ -5,6 +5,7 @@
#include <mono/utils/mono-publib.h>
enum {
/* Counter type, bits 0-7. */
MONO_COUNTER_INT, /* 32 bit int */
MONO_COUNTER_UINT, /* 32 bit uint */
MONO_COUNTER_WORD, /* pointer-sized int */
......@@ -16,7 +17,7 @@ enum {
MONO_COUNTER_TYPE_MASK = 0xf,
MONO_COUNTER_CALLBACK = 128, /* ORed with the other values */
MONO_COUNTER_SECTION_MASK = 0xffffff00,
/* sections */
/* Sections, bits 8-15 */
MONO_COUNTER_JIT = 1 << 8,
MONO_COUNTER_GC = 1 << 9,
MONO_COUNTER_METADATA = 1 << 10,
......@@ -24,7 +25,24 @@ enum {
MONO_COUNTER_SECURITY = 1 << 12,
MONO_COUNTER_RUNTIME = 1 << 13,
MONO_COUNTER_SYSTEM = 1 << 14,
MONO_COUNTER_LAST_SECTION
MONO_COUNTER_LAST_SECTION,
/* Unit, bits 16-23 */
MONO_COUNTER_UNIT_SHIFT = 16,
MONO_COUNTER_UNIT_MASK = 0xFFu << MONO_COUNTER_UNIT_SHIFT,
MONO_COUNTER_RAW = 0 << 16, /* Raw value */
MONO_COUNTER_BYTES = 1 << 16, /* Quantity of bytes. RSS, active heap, etc */
MONO_COUNTER_TIME = 2 << 16, /* Time interval in 100ns units. Minor pause, JIT compilation*/
MONO_COUNTER_EVENTS = 3 << 16, /* Number of times the given event happens. Major collections, Compiled methods. */
MONO_COUNTER_ITEMS = 4 << 16, /* Current number of things. Threads, queued jobs.*/
MONO_COUNTER_PERCENTAGE = 5 << 16, /* [0-1] Fraction Percentage of something. Load average. */
/* Monotonicity, bits 24-31 */
MONO_COUNTER_VARIANCE_SHIFT = 24,
MONO_COUNTER_VARIANCE_MASK = 0xFFu << MONO_COUNTER_VARIANCE_SHIFT,
MONO_COUNTER_MONOTONIC = 0 << 24, /* This counter value always increase/decreases over time. Reported by --stat. */
MONO_COUNTER_CONSTANT = 1 << 24, /* Fixed value. Used by configuration data. */
MONO_COUNTER_VARIABLE = 2 << 24, /* This counter value can be anything on each sampling. Only interesting when sampling. */
};
MONO_API void mono_counters_enable (int section_mask);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册