From f775c92d728fbccea1f56ac0e0fe4b8458f7f2b7 Mon Sep 17 00:00:00 2001 From: Michael Lenz Date: Wed, 26 Feb 2014 14:22:27 +0100 Subject: [PATCH] dump-trace: keep track of read/written bytes This change adds access-size tracking to dump-trace and output thereof in mode "-s". Change-Id: I5647d7b16c89499b7813faaf8c3844f275bc552a --- tools/dump-trace/DumpTrace.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tools/dump-trace/DumpTrace.cc b/tools/dump-trace/DumpTrace.cc index 875dd67d..0015cec2 100644 --- a/tools/dump-trace/DumpTrace.cc +++ b/tools/dump-trace/DumpTrace.cc @@ -84,7 +84,8 @@ int main(int argc, char *argv[]) ProtoIStream ps(&openStream(cmd.parser()->nonOption(0), normal_stream, gz_stream)); uint64_t acctime = 0; - uint64_t stats_instr = 0, stats_reads = 0, stats_writes = 0, starttime = 0; + uint64_t stats_instr = 0, stats_reads = 0, stats_writes = 0; + uint64_t stats_read_b = 0, stats_write_b = 0, starttime = 0; while (ps.getNext(&ev)) { if (ev.has_time_delta()) { @@ -137,16 +138,23 @@ int main(int argc, char *argv[]) << dec << " t=" << acctime << ext.str() << "\n"; } - stats_reads += (ev.accesstype() == Trace_Event_AccessType_READ); - stats_writes += (ev.accesstype() == Trace_Event_AccessType_WRITE); + if (ev.accesstype() == Trace_Event_AccessType_READ) { + stats_reads++; + stats_read_b += ev.width(); + } else { + stats_writes++; + stats_write_b += ev.width(); + } } } if (stats_only) { cout << "#instructions: " << stats_instr << "\n" - << "#memR: " << stats_reads << "\n" - << "#memW: " << stats_writes << "\n" - << "duration: " << (acctime - starttime + 1) << endl; + << "#memR: " << stats_reads << "\n" + << "#memR_bytes " << stats_read_b << "\n" + << "#memW: " << stats_writes << "\n" + << "#memW_bytes " << stats_write_b << "\n" + << "duration: " << (acctime - starttime + 1) << endl; } return 0;