Skip to content

Commit

Permalink
Preserve the type of the trace time in Task::trace_time()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sidkshatriya authored and rocallahan committed Apr 17, 2024
1 parent 9a9fccc commit b8ed44a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/StdioMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Task.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Task.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b8ed44a

Please sign in to comment.