/* Worst-case size in bytes of a 64-bit value encoded with LEB128. */
#define LEB128_SIZE 10
-/* Size in bytes of the event ID prefix. */
-#define EVENT_SIZE 1
/* Size of a value encoded as a single byte. */
#define BYTE_SIZE 1
+/* Size in bytes of the event prefix (ID + time). */
+#define EVENT_SIZE (BYTE_SIZE + LEB128_SIZE)
static int nocalls = 0;
static int notraces = 0;
assert (logbuffer->cursor <= logbuffer->buf_end);
}
+static void
+emit_event_time (LogBuffer *logbuffer, int event, uint64_t time)
+{
+ emit_byte (logbuffer, event);
+ emit_time (logbuffer, time);
+}
+
+static void
+emit_event (LogBuffer *logbuffer, int event)
+{
+ emit_event_time (logbuffer, event, current_time ());
+}
+
static void
emit_svalue (LogBuffer *logbuffer, int64_t value)
{
buffer = ensure_logbuf_inner (buffer,
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* tid */
);
- uint64_t now = current_time ();
-
- emit_byte (buffer, TYPE_END_UNLOAD | TYPE_METADATA);
- emit_time (buffer, now);
+ emit_event (buffer, TYPE_END_UNLOAD | TYPE_METADATA);
emit_byte (buffer, TYPE_THREAD);
emit_ptr (buffer, (void *) thread->node.key);
}
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* type */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_META | TYPE_SYNC_POINT);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_META | TYPE_SYNC_POINT);
emit_byte (logbuffer, type);
EXIT_LOG;
)
);
- emit_byte (logbuffer, TYPE_HEAP_OBJECT | TYPE_HEAP);
+ emit_event (logbuffer, TYPE_HEAP_OBJECT | TYPE_HEAP);
emit_obj (logbuffer, obj);
emit_ptr (logbuffer, klass);
emit_value (logbuffer, size);
ENTER_LOG;
LogBuffer *logbuffer = ensure_logbuf (
- EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */
+ EVENT_SIZE /* event */
);
- emit_byte (logbuffer, TYPE_HEAP_START | TYPE_HEAP);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_HEAP_START | TYPE_HEAP);
EXIT_LOG;
ENTER_LOG;
LogBuffer *logbuffer = ensure_logbuf (
- EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */
+ EVENT_SIZE /* event */
);
now = current_time ();
- emit_byte (logbuffer, TYPE_HEAP_END | TYPE_HEAP);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_HEAP_END | TYPE_HEAP);
EXIT_LOG;
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* gc event */ +
BYTE_SIZE /* generation */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_GC_EVENT | TYPE_GC);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_GC_EVENT | TYPE_GC);
emit_byte (logbuffer, ev);
emit_byte (logbuffer, generation);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* new size */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_GC_RESIZE | TYPE_GC);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_GC_RESIZE | TYPE_GC);
emit_value (logbuffer, new_size);
EXIT_LOG;
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* klass */ +
LEB128_SIZE /* obj */ +
LEB128_SIZE /* size */ +
) : 0)
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, do_bt | TYPE_ALLOC);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, do_bt | TYPE_ALLOC);
emit_ptr (logbuffer, klass);
emit_obj (logbuffer, obj);
emit_value (logbuffer, len);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* num */ +
num * (
LEB128_SIZE /* object */
)
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_GC_MOVE | TYPE_GC);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_GC_MOVE | TYPE_GC);
emit_value (logbuffer, num);
for (int i = 0; i < num; ++i)
)
);
- emit_byte (logbuffer, TYPE_HEAP_ROOT | TYPE_HEAP);
+ emit_event (logbuffer, TYPE_HEAP_ROOT | TYPE_HEAP);
emit_value (logbuffer, num);
emit_value (logbuffer, mono_gc_collection_count (mono_gc_max_generation ()));
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* type */ +
LEB128_SIZE /* handle */ +
(op == MONO_PROFILER_GC_HANDLE_CREATED ? (
) : 0)
);
- uint64_t now = current_time ();
-
if (op == MONO_PROFILER_GC_HANDLE_CREATED)
- emit_byte (logbuffer, (do_bt ? TYPE_GC_HANDLE_CREATED_BT : TYPE_GC_HANDLE_CREATED) | TYPE_GC);
+ emit_event (logbuffer, (do_bt ? TYPE_GC_HANDLE_CREATED_BT : TYPE_GC_HANDLE_CREATED) | TYPE_GC);
else if (op == MONO_PROFILER_GC_HANDLE_DESTROYED)
- emit_byte (logbuffer, (do_bt ? TYPE_GC_HANDLE_DESTROYED_BT : TYPE_GC_HANDLE_DESTROYED) | TYPE_GC);
+ emit_event (logbuffer, (do_bt ? TYPE_GC_HANDLE_DESTROYED_BT : TYPE_GC_HANDLE_DESTROYED) | TYPE_GC);
else
g_assert_not_reached ();
- emit_time (logbuffer, now);
emit_value (logbuffer, type);
emit_value (logbuffer, handle);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* image */ +
nlen /* name */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
emit_byte (logbuffer, TYPE_IMAGE);
emit_ptr (logbuffer, image);
memcpy (logbuffer->cursor, name, nlen);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* image */ +
nlen /* name */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
emit_byte (logbuffer, TYPE_IMAGE);
emit_ptr (logbuffer, image);
memcpy (logbuffer->cursor, name, nlen);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* assembly */ +
nlen /* name */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
emit_byte (logbuffer, TYPE_ASSEMBLY);
emit_ptr (logbuffer, assembly);
memcpy (logbuffer->cursor, name, nlen);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* assembly */ +
nlen /* name */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
emit_byte (logbuffer, TYPE_ASSEMBLY);
emit_ptr (logbuffer, assembly);
memcpy (logbuffer->cursor, name, nlen);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* klass */ +
LEB128_SIZE /* image */ +
nlen /* name */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
emit_byte (logbuffer, TYPE_CLASS);
emit_ptr (logbuffer, klass);
emit_ptr (logbuffer, image);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* klass */ +
LEB128_SIZE /* image */ +
nlen /* name */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
emit_byte (logbuffer, TYPE_CLASS);
emit_ptr (logbuffer, klass);
emit_ptr (logbuffer, image);
static void
method_enter (MonoProfiler *prof, MonoMethod *method)
{
- uint64_t now = current_time ();
-
#ifndef DISABLE_HELPER_THREAD
process_method_enter_coverage (prof, method);
#endif /* DISABLE_HELPER_THREAD */
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* method */
);
- emit_byte (logbuffer, TYPE_ENTER | TYPE_METHOD);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_ENTER | TYPE_METHOD);
emit_method (prof, logbuffer, method);
EXIT_LOG;
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* method */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_LEAVE | TYPE_METHOD);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_LEAVE | TYPE_METHOD);
emit_method (prof, logbuffer, method);
EXIT_LOG;
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* method */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_EXC_LEAVE | TYPE_METHOD);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_EXC_LEAVE | TYPE_METHOD);
emit_method (prof, logbuffer, method);
EXIT_LOG;
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* buffer */ +
LEB128_SIZE /* size */ +
) : 0)
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_JITHELPER | TYPE_RUNTIME);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_JITHELPER | TYPE_RUNTIME);
emit_byte (logbuffer, type);
emit_ptr (logbuffer, buffer);
emit_value (logbuffer, size);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* object */ +
(do_bt ? (
LEB128_SIZE /* count */ +
) : 0)
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, do_bt | TYPE_EXCEPTION);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, do_bt | TYPE_EXCEPTION);
emit_obj (logbuffer, object);
if (do_bt)
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* clause type */ +
LEB128_SIZE /* clause num */ +
LEB128_SIZE /* method */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_EXCEPTION | TYPE_CLAUSE);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_EXCEPTION | TYPE_CLAUSE);
emit_byte (logbuffer, clause_type);
emit_value (logbuffer, clause_num);
emit_method (prof, logbuffer, method);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* object */ +
(do_bt ? (
LEB128_SIZE /* count */ +
) : 0)
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, (event << 4) | do_bt | TYPE_MONITOR);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, (event << 4) | do_bt | TYPE_MONITOR);
emit_obj (logbuffer, object);
if (do_bt)
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* tid */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
emit_byte (logbuffer, TYPE_THREAD);
emit_ptr (logbuffer, (void*) tid);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* tid */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
emit_byte (logbuffer, TYPE_THREAD);
emit_ptr (logbuffer, (void*) tid);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* domain id */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
emit_byte (logbuffer, TYPE_DOMAIN);
emit_ptr (logbuffer, (void*)(uintptr_t) mono_domain_get_id (domain));
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* domain id */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
emit_byte (logbuffer, TYPE_DOMAIN);
emit_ptr (logbuffer, (void*)(uintptr_t) mono_domain_get_id (domain));
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* domain id */ +
nlen /* name */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_METADATA);
emit_byte (logbuffer, TYPE_DOMAIN);
emit_ptr (logbuffer, (void*)(uintptr_t) mono_domain_get_id (domain));
memcpy (logbuffer->cursor, name, nlen);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* context id */ +
LEB128_SIZE /* domain id */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_END_LOAD | TYPE_METADATA);
emit_byte (logbuffer, TYPE_CONTEXT);
emit_ptr (logbuffer, (void*)(uintptr_t) mono_context_get_id (context));
emit_ptr (logbuffer, (void*)(uintptr_t) mono_context_get_domain_id (context));
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* context id */ +
LEB128_SIZE /* domain id */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_END_UNLOAD | TYPE_METADATA);
emit_byte (logbuffer, TYPE_CONTEXT);
emit_ptr (logbuffer, (void*)(uintptr_t) mono_context_get_id (context));
emit_ptr (logbuffer, (void*)(uintptr_t) mono_context_get_domain_id (context));
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
BYTE_SIZE /* type */ +
LEB128_SIZE /* tid */ +
len /* name */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_METADATA);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_METADATA);
emit_byte (logbuffer, TYPE_THREAD);
emit_ptr (logbuffer, (void*)tid);
memcpy (logbuffer->cursor, name, len);
typedef struct {
MonoLockFreeQueueNode node;
MonoProfiler *prof;
- uint64_t elapsed;
+ uint64_t time;
uintptr_t tid;
void *ip;
int count;
InterlockedIncrement (&sample_hits);
- uint64_t now = current_time ();
-
SampleHit *sample = (SampleHit *) mono_lock_free_queue_dequeue (&profiler->sample_reuse_queue);
if (!sample) {
sample->count = 0;
mono_stack_walk_async_safe (&async_walk_stack, context, sample);
- uintptr_t elapsed = (now - profiler->startup_time) / 10000;
-
- sample->elapsed = elapsed;
+ sample->time = current_time ();
sample->tid = thread_id ();
sample->ip = ip;
if (do_debug) {
int len;
char buf [256];
- snprintf (buf, sizeof (buf), "hit at %p in thread %p after %llu ms\n", ip, (void *) thread_id (), (unsigned long long int) elapsed / 100);
+ snprintf (buf, sizeof (buf), "hit at %p in thread %p after %llu ms\n", ip, (void *) sample->tid, (unsigned long long int) ((sample->time - profiler->startup_time) / 10000 / 100));
len = strlen (buf);
ign_res (write (2, buf, len));
}
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* load address */ +
LEB128_SIZE /* offset */ +
LEB128_SIZE /* size */ +
nlen /* file name */
);
- uint64_t now = current_time ();
-
- emit_byte (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_UBIN);
- emit_time (logbuffer, now);
+ emit_event (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_UBIN);
emit_svalue (logbuffer, load_addr);
emit_uvalue (logbuffer, offset);
emit_uvalue (logbuffer, size);
len /* name */
);
- emit_byte (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_USYM);
+ emit_event (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_USYM);
emit_ptr (logbuffer, (void*)value);
emit_value (logbuffer, size);
memcpy (logbuffer->cursor, name, len);
LogBuffer *logbuffer = ensure_logbuf (
EVENT_SIZE /* event */ +
BYTE_SIZE /* type */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* tid */ +
LEB128_SIZE /* count */ +
count * (
)
);
- emit_byte (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_HIT);
+ emit_event (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_HIT);
emit_byte (logbuffer, sample_type);
- emit_uvalue (logbuffer, s->timestamp - prof->startup_time);
/*
* No useful thread ID to write here, since throughout the
* profiler we use pthread_self () but the ID we get from
LogBuffer *logbuffer = ensure_logbuf (size);
- emit_byte (logbuffer, TYPE_SAMPLE_COUNTERS_DESC | TYPE_SAMPLE);
+ emit_event (logbuffer, TYPE_SAMPLE_COUNTERS_DESC | TYPE_SAMPLE);
emit_value (logbuffer, len);
for (agent = counters; agent; agent = agent->next) {
mono_os_mutex_lock (&counters_mutex);
size =
- EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */
+ EVENT_SIZE /* event */
;
for (agent = counters; agent; agent = agent->next) {
LogBuffer *logbuffer = ensure_logbuf (size);
- emit_byte (logbuffer, TYPE_SAMPLE_COUNTERS | TYPE_SAMPLE);
- emit_uvalue (logbuffer, timestamp);
+ emit_event_time (logbuffer, TYPE_SAMPLE_COUNTERS | TYPE_SAMPLE, timestamp);
for (agent = counters; agent; agent = agent->next) {
size_t size;
LogBuffer *logbuffer = ensure_logbuf (size);
- emit_byte (logbuffer, TYPE_SAMPLE_COUNTERS_DESC | TYPE_SAMPLE);
+ emit_event (logbuffer, TYPE_SAMPLE_COUNTERS_DESC | TYPE_SAMPLE);
emit_value (logbuffer, len);
for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
perfcounters_emit (profiler);
size =
- EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */
+ EVENT_SIZE /* event */
;
for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
LogBuffer *logbuffer = ensure_logbuf (size);
- emit_byte (logbuffer, TYPE_SAMPLE_COUNTERS | TYPE_SAMPLE);
- emit_uvalue (logbuffer, timestamp);
+ emit_event_time (logbuffer, TYPE_SAMPLE_COUNTERS | TYPE_SAMPLE, timestamp);
for (pcagent = perfcounters; pcagent; pcagent = pcagent->next) {
if (pcagent->deleted || !pcagent->updated)
static void
counters_and_perfcounters_sample (MonoProfiler *prof)
{
- static uint64_t start = -1;
- uint64_t now;
-
- if (start == -1)
- start = current_time ();
+ uint64_t now = current_time ();
- now = current_time ();
- counters_sample (prof, (now - start) / 1000/ 1000);
- perfcounters_sample (prof, (now - start) / 1000/ 1000);
+ counters_sample (prof, now);
+ perfcounters_sample (prof, now);
}
#define COVERAGE_DEBUG(x) if (debug_coverage) {x}
LEB128_SIZE /* entries */
);
- emit_byte (logbuffer, TYPE_COVERAGE_METHOD | TYPE_COVERAGE);
+ emit_event (logbuffer, TYPE_COVERAGE_METHOD | TYPE_COVERAGE);
emit_string (logbuffer, image_name, strlen (image_name) + 1);
emit_string (logbuffer, class_name, strlen (class_name) + 1);
emit_string (logbuffer, method_name, strlen (method_name) + 1);
LEB128_SIZE /* column */
);
- emit_byte (logbuffer, TYPE_COVERAGE_STATEMENT | TYPE_COVERAGE);
+ emit_event (logbuffer, TYPE_COVERAGE_STATEMENT | TYPE_COVERAGE);
emit_uvalue (logbuffer, method_id);
emit_uvalue (logbuffer, entry->offset);
emit_uvalue (logbuffer, entry->counter);
LEB128_SIZE /* partially covered */
);
- emit_byte (logbuffer, TYPE_COVERAGE_CLASS | TYPE_COVERAGE);
+ emit_event (logbuffer, TYPE_COVERAGE_CLASS | TYPE_COVERAGE);
emit_string (logbuffer, assembly_name, strlen (assembly_name) + 1);
emit_string (logbuffer, class_name, strlen (class_name) + 1);
emit_uvalue (logbuffer, number_of_methods);
LEB128_SIZE /* partially covered */
);
- emit_byte (logbuffer, TYPE_COVERAGE_ASSEMBLY | TYPE_COVERAGE);
+ emit_event (logbuffer, TYPE_COVERAGE_ASSEMBLY | TYPE_COVERAGE);
emit_string (logbuffer, name, strlen (name) + 1);
emit_string (logbuffer, guid, strlen (guid) + 1);
emit_string (logbuffer, filename, strlen (filename) + 1);
buf = ensure_logbuf_unsafe (
EVENT_SIZE /* event */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* method */ +
LEB128_SIZE /* start */ +
LEB128_SIZE /* size */ +
nlen /* name */
);
- emit_byte (buf, TYPE_JIT | TYPE_METHOD);
- emit_time (buf, info->time);
+ emit_event_time (buf, TYPE_JIT | TYPE_METHOD, info->time);
emit_method_inner (buf, info->method);
emit_ptr (buf, cstart);
emit_value (buf, csize);
LogBuffer *logbuffer = ensure_logbuf_unsafe (
EVENT_SIZE /* event */ +
BYTE_SIZE /* type */ +
- LEB128_SIZE /* time */ +
LEB128_SIZE /* tid */ +
LEB128_SIZE /* count */ +
1 * (
)
);
- emit_byte (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_HIT);
+ emit_event_time (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_HIT, sample->time);
emit_byte (logbuffer, sample_type);
- emit_uvalue (logbuffer, prof->startup_time + sample->elapsed * 10000);
emit_ptr (logbuffer, (void *) sample->tid);
emit_value (logbuffer, 1);