From 7666c09923bfc56132e9332133650a256a478c14 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Mon, 25 Mar 2019 00:20:05 +0100 Subject: qtmips_cli: include dump of cache statistic in command line tool. Signed-off-by: Pavel Pisa --- qtmips_cli/reporter.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'qtmips_cli/reporter.cpp') diff --git a/qtmips_cli/reporter.cpp b/qtmips_cli/reporter.cpp index a7db4a8..70803a8 100644 --- a/qtmips_cli/reporter.cpp +++ b/qtmips_cli/reporter.cpp @@ -51,6 +51,7 @@ Reporter::Reporter(QCoreApplication *app, QtMipsMachine *machine) : QObject() { connect(machine->core(), SIGNAL(stop_on_exception_reached()), this, SLOT(machine_exception_reached())); e_regs = false; + e_cache_stats = false; e_fail = (enum FailReason)0; } @@ -58,6 +59,10 @@ void Reporter::regs() { e_regs = true; } +void Reporter::cache_stats() { + e_cache_stats = true; +} + void Reporter::expect_fail(enum FailReason reason) { e_fail = (enum FailReason)(e_fail | reason); } @@ -166,6 +171,21 @@ void Reporter::report() { else cout << endl; } - + } + if (e_cache_stats) { + cout << "Cache statistics report:" << endl; + cout << "i-cache:reads:" << machine->cache_program()->memory_reads() << endl; + cout << "i-cache:hit:" << machine->cache_program()->hit() << endl; + cout << "i-cache:miss:" << machine->cache_program()->miss() << endl; + cout << "i-cache:hit-rate:" << machine->cache_program()->hit_rate() << endl; + cout << "i-cache:stalled-cycles:" << machine->cache_program()->stalled_cycles() << endl; + cout << "i-cache:improved-speed:" << machine->cache_program()->speed_improvement() << endl; + cout << "d-cache:reads:" << machine->cache_data()->memory_reads() << endl; + cout << "d-cache:writes:" << machine->cache_data()->memory_writes() << endl; + cout << "d-cache:hit:" << machine->cache_data()->hit() << endl; + cout << "d-cache:miss:" << machine->cache_data()->miss() << endl; + cout << "d-cache:hit-rate:" << machine->cache_data()->hit_rate() << endl; + cout << "d-cache:stalled-cycles:" << machine->cache_data()->stalled_cycles() << endl; + cout << "d-cache:improved-speed:" << machine->cache_data()->speed_improvement() << endl; } } -- cgit v1.2.3