diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2010-10-23 15:24:07 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-10-23 15:24:07 +0000 |
commit | cf5d4b7110cb83534c2bc231cb03b708974ed8e2 (patch) | |
tree | 42fc65ee94c4c97e824b85c6d5b8b757fb2327aa /simpletrace.c | |
parent | 1193107912dbd80bc6601fc9c1de4119662f0178 (diff) | |
download | qemu-cf5d4b7110cb83534c2bc231cb03b708974ed8e2.tar.gz qemu-cf5d4b7110cb83534c2bc231cb03b708974ed8e2.tar.bz2 qemu-cf5d4b7110cb83534c2bc231cb03b708974ed8e2.zip |
qemu-timer: move commonly used timer code to qemu-timer-common
Move timer init functions to a new file, qemu-timer-common.c. Make other
critical timer functions inlined to preserve performance in
qemu-timer.c, also move muldiv64() (used by the inline functions)
to qemu-timer.h.
Adjust block/raw-posix.c and simpletrace.c to use get_clock() directly.
Remove a similar/duplicate definition in qemu-tool.c.
Adjust hw/omap_clk.c to include qemu-timer.h because muldiv64() is used
there.
After this change, tracing can be used also for user code and
simpletrace on Win32.
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'simpletrace.c')
-rw-r--r-- | simpletrace.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/simpletrace.c b/simpletrace.c index b488d51766..9ea0d1f984 100644 --- a/simpletrace.c +++ b/simpletrace.c @@ -12,6 +12,7 @@ #include <stdint.h> #include <stdio.h> #include <time.h> +#include "qemu-timer.h" #include "trace.h" /** Trace file header event ID */ @@ -140,20 +141,13 @@ static void trace(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4, uint64_t x5, uint64_t x6) { TraceRecord *rec = &trace_buf[trace_idx]; - struct timespec ts; - - /* TODO Windows? It would be good to use qemu-timer here but that isn't - * linked into qemu-tools. Also we should avoid recursion in the tracing - * code, therefore it is useful to be self-contained. - */ - clock_gettime(CLOCK_MONOTONIC, &ts); if (!trace_list[event].state) { return; } rec->event = event; - rec->timestamp_ns = ts.tv_sec * 1000000000LL + ts.tv_nsec; + rec->timestamp_ns = get_clock(); rec->x1 = x1; rec->x2 = x2; rec->x3 = x3; |