diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-03-25 00:20:05 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-03-25 00:20:05 +0100 |
commit | 7666c09923bfc56132e9332133650a256a478c14 (patch) | |
tree | 90efbbeddd8a3291d7ea831028d23404157116c9 /qtmips_cli/reporter.cpp | |
parent | 742d48d1462523c89087551e683e824f922bb629 (diff) | |
download | qtmips-7666c09923bfc56132e9332133650a256a478c14.tar.gz qtmips-7666c09923bfc56132e9332133650a256a478c14.tar.bz2 qtmips-7666c09923bfc56132e9332133650a256a478c14.zip |
qtmips_cli: include dump of cache statistic in command line tool.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_cli/reporter.cpp')
-rw-r--r-- | qtmips_cli/reporter.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
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; } } |