summaryrefslogtreecommitdiff
path: root/runtime/trace.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/trace.h')
-rw-r--r--runtime/trace.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/runtime/trace.h b/runtime/trace.h
index b3b9f75c7f..952c996d63 100644
--- a/runtime/trace.h
+++ b/runtime/trace.h
@@ -111,7 +111,10 @@ enum class TraceOutputMode {
// We need 3 entries to store 64-bit timestamp counter as two 32-bit values on 32-bit architectures.
static constexpr uint32_t kNumEntriesForWallClock =
(kRuntimePointerSize == PointerSize::k64) ? 2 : 3;
-static constexpr uint32_t kNumEntriesForDualClock = kNumEntriesForWallClock + 1;
+// Timestamps are stored as two 32-bit balues on 32-bit architectures.
+static constexpr uint32_t kNumEntriesForDualClock = (kRuntimePointerSize == PointerSize::k64)
+ ? kNumEntriesForWallClock + 1
+ : kNumEntriesForWallClock + 2;
// These define offsets in bytes for the individual fields of a trace entry. These are used by the
// JITed code when storing a trace entry.
@@ -203,7 +206,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
@@ -341,8 +344,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.
@@ -416,7 +419,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_;
@@ -518,7 +521,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_);
@@ -604,12 +607,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.