From d296f15652b22e93441c5a320461874c4c94b676 Mon Sep 17 00:00:00 2001 From: Christian Dietrich Date: Tue, 24 Nov 2020 14:05:06 +0100 Subject: [PATCH] dump-trace: record the number of memory fault locations With the number of accessed memory addresses and the duration of the trace, we can deduce the size of the rectangular memory fault space. This will be used in testing. --- tools/dump-trace/DumpTrace.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/dump-trace/DumpTrace.cc b/tools/dump-trace/DumpTrace.cc index d86ee5e9..d1568f59 100644 --- a/tools/dump-trace/DumpTrace.cc +++ b/tools/dump-trace/DumpTrace.cc @@ -1,6 +1,7 @@ #include #include #include +#include #include "comm/TracePlugin.pb.h" #include "util/ProtoStream.hpp" #include "../../src/core/util/Logger.hpp" @@ -93,6 +94,7 @@ int main(int argc, char *argv[]) uint64_t acctime = 0; uint64_t stats_instr = 0, stats_reads = 0, stats_writes = 0; uint64_t stats_read_b = 0, stats_write_b = 0, starttime = 0; + std::set stats_mem_locations; while (ps.getNext(&ev)) { if (ev.has_time_delta()) { @@ -144,6 +146,10 @@ int main(int argc, char *argv[]) << hex << " IP " << ev.ip() << dec << " t=" << acctime << ext.str() << "\n"; + } else { + for (uint64_t addr = ev.memaddr(); addr < ev.memaddr() + ev.width(); addr++){ + stats_mem_locations.insert(addr); + } } if (ev.accesstype() == Trace_Event_AccessType_READ) { stats_reads++; @@ -157,10 +163,11 @@ int main(int argc, char *argv[]) if (stats_only) { cout << "#instructions: " << stats_instr << "\n" + << "#memLocations: " << stats_mem_locations.size() << "\n" << "#memR: " << stats_reads << "\n" - << "#memR_bytes " << stats_read_b << "\n" + << "#memR_bytes: " << stats_read_b << "\n" << "#memW: " << stats_writes << "\n" - << "#memW_bytes " << stats_write_b << "\n" + << "#memW_bytes: " << stats_write_b << "\n" << "duration: " << (acctime - starttime + 1) << endl; }