summaryrefslogtreecommitdiff
path: root/runtime/trace.h
diff options
context:
space:
mode:
author Mythri Alle <mythria@google.com> 2025-01-13 12:00:33 +0000
committer Mythri Alle <mythria@google.com> 2025-01-24 01:05:24 -0800
commit1a9a8abf19e7641149fcaed3971bf0aa99f4dfb8 (patch)
tree74cc6c1c49a2fe36b29807ed2256b26073df9628 /runtime/trace.h
parent2576b59a2dad4ee542eb50fb451ff88a4b8902ad (diff)
Use nanoseconds for v2 method tracing
Update the precision of timestamps to be nanoseconds and use nanosecond precision in method trace format v2. For format v1 we use microsecond precision for backwards compatability. Bug: 259258187 Test: art/test.py -t 2246 Change-Id: I099e21f5d143c5444193e7886b5281b32f87d5d3
Diffstat (limited to 'runtime/trace.h')
-rw-r--r--runtime/trace.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/runtime/trace.h b/runtime/trace.h
index 63c96f927c..ff24538901 100644
--- a/runtime/trace.h
+++ b/runtime/trace.h
@@ -200,7 +200,7 @@ class TraceWriter {
size_t buffer_size,
int num_trace_buffers,
int trace_format_version,
- uint32_t clock_overhead_ns);
+ uint64_t clock_overhead_ns);
// This encodes all the events in the per-thread trace buffer and writes it to the trace file /
// buffer. This acquires streaming lock to prevent any other threads writing concurrently. It is
@@ -342,8 +342,8 @@ class TraceWriter {
uint16_t thread_id,
uint32_t method_index,
TraceAction action,
- uint32_t thread_clock_diff,
- uint32_t wall_clock_diff) REQUIRES(trace_writer_lock_);
+ uint64_t thread_clock_diff,
+ uint64_t wall_clock_diff) REQUIRES(trace_writer_lock_);
// Encodes the header for the events block. This assumes that there is enough space reserved to
// encode the entry.
@@ -417,7 +417,7 @@ class TraceWriter {
size_t num_records_;
// Clock overhead.
- const uint32_t clock_overhead_ns_;
+ const uint64_t clock_overhead_ns_;
std::vector<std::atomic<size_t>> owner_tids_;
std::unique_ptr<uintptr_t[]> trace_buffer_;
@@ -519,7 +519,7 @@ class Trace final : public instrumentation::InstrumentationListener, public Clas
static void RemoveListeners() REQUIRES(Locks::mutator_lock_);
void MeasureClockOverhead();
- uint32_t GetClockOverheadNanoSeconds();
+ uint64_t GetClockOverheadNanoSeconds();
void CompareAndUpdateStackTrace(Thread* thread, std::vector<ArtMethod*>* stack_trace)
REQUIRES_SHARED(Locks::mutator_lock_);
@@ -605,12 +605,12 @@ class Trace final : public instrumentation::InstrumentationListener, public Clas
// how to annotate this.
NO_THREAD_SAFETY_ANALYSIS;
- void ReadClocks(Thread* thread, uint32_t* thread_clock_diff, uint64_t* timestamp_counter);
+ void ReadClocks(Thread* thread, uint64_t* thread_clock_diff, uint64_t* timestamp_counter);
void LogMethodTraceEvent(Thread* thread,
ArtMethod* method,
TraceAction action,
- uint32_t thread_clock_diff,
+ uint64_t thread_clock_diff,
uint64_t timestamp_counter) REQUIRES_SHARED(Locks::mutator_lock_);
// Singleton instance of the Trace or null when no method tracing is active.