Revision c57c846a simpletrace.c
b/simpletrace.c | ||
---|---|---|
12 | 12 |
#include <stdint.h> |
13 | 13 |
#include <stdio.h> |
14 | 14 |
#include <time.h> |
15 |
#include "qemu-timer.h" |
|
15 | 16 |
#include "trace.h" |
16 | 17 |
|
17 | 18 |
/** Trace file header event ID */ |
... | ... | |
140 | 141 |
uint64_t x4, uint64_t x5, uint64_t x6) |
141 | 142 |
{ |
142 | 143 |
TraceRecord *rec = &trace_buf[trace_idx]; |
143 |
struct timespec ts; |
|
144 |
|
|
145 |
/* TODO Windows? It would be good to use qemu-timer here but that isn't |
|
146 |
* linked into qemu-tools. Also we should avoid recursion in the tracing |
|
147 |
* code, therefore it is useful to be self-contained. |
|
148 |
*/ |
|
149 |
clock_gettime(CLOCK_MONOTONIC, &ts); |
|
150 | 144 |
|
151 | 145 |
if (!trace_list[event].state) { |
152 | 146 |
return; |
153 | 147 |
} |
154 | 148 |
|
155 | 149 |
rec->event = event; |
156 |
rec->timestamp_ns = ts.tv_sec * 1000000000LL + ts.tv_nsec;
|
|
150 |
rec->timestamp_ns = get_clock();
|
|
157 | 151 |
rec->x1 = x1; |
158 | 152 |
rec->x2 = x2; |
159 | 153 |
rec->x3 = x3; |
Also available in: Unified diff