From b8ed44ad4d813c00baee4e30d9bfbfb0961f27a9 Mon Sep 17 00:00:00 2001 From: Sidharth Kshatriya Date: Mon, 15 Apr 2024 13:35:57 +0530 Subject: [PATCH] Preserve the type of the trace time in Task::trace_time() FrameTime is a long (int64 in the trace) while trace_time() casts it to a u32. Preserve the original type by making the function return type FrameTime. --- src/StdioMonitor.cc | 2 +- src/Task.cc | 2 +- src/Task.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/StdioMonitor.cc b/src/StdioMonitor.cc index 7549d4106f7..b4335f43098 100644 --- a/src/StdioMonitor.cc +++ b/src/StdioMonitor.cc @@ -13,7 +13,7 @@ namespace rr { Switchable StdioMonitor::will_write(Task* t) { if (t->session().mark_stdio()) { char buf[256]; - snprintf(buf, sizeof(buf) - 1, "[rr %d %d]", t->tgid(), t->trace_time()); + snprintf(buf, sizeof(buf) - 1, "[rr %d %ld]", t->tgid(), t->trace_time()); ssize_t len = strlen(buf); if (write(original_fd, buf, len) != len) { ASSERT(t, false) << "Couldn't write to " << original_fd; diff --git a/src/Task.cc b/src/Task.cc index 34a6051434a..85471278c8b 100644 --- a/src/Task.cc +++ b/src/Task.cc @@ -1974,7 +1974,7 @@ const string& Task::trace_dir() const { return trace->dir(); } -uint32_t Task::trace_time() const { +FrameTime Task::trace_time() const { const TraceStream* trace = trace_stream(); return trace ? trace->time() : 0; } diff --git a/src/Task.h b/src/Task.h index 25f219ce866..4259290a57e 100644 --- a/src/Task.h +++ b/src/Task.h @@ -704,7 +704,7 @@ class Task { * events. |task_time()| returns that "time" wrt this task * only. */ - uint32_t trace_time() const; + FrameTime trace_time() const; /** * Call this to reset syscallbuf_hdr->num_rec_bytes and zero out the data