From 0f8b27385219efd77b6ab8e3441a172e91ede74e Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Tue, 4 Jun 2024 14:24:04 +0200 Subject: add a dfatool output format --- src/experiment.cpp | 2 ++ src/experiment.h | 2 +- src/output.cpp | 20 +++++++++++++++++++- src/output.h | 1 + 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/experiment.cpp b/src/experiment.cpp index 4b9e31a..60ae4bc 100644 --- a/src/experiment.cpp +++ b/src/experiment.cpp @@ -319,6 +319,8 @@ int Experiment::parse_args(int argc, char* argv[]) { this->output_mode = HEADER; } else if (strcasecmp(argv[i], "header") == 0) { this->output_mode = HEADER; + } else if (strcasecmp(argv[i], "dfatool") == 0) { + this->output_mode = DFATOOL; } else { snprintf(errorString, errorStringSize, "invalid output format -- '%s'", argv[i]); error = true; diff --git a/src/experiment.h b/src/experiment.h index 38aee3c..47716cf 100644 --- a/src/experiment.h +++ b/src/experiment.h @@ -63,7 +63,7 @@ public: enum { NONE, T0, T1, T2, NTA } prefetch_hint; // use of prefetching - enum { CSV, BOTH, HEADER, TABLE } + enum { CSV, BOTH, HEADER, TABLE, DFATOOL } output_mode; // results output mode enum { RANDOM, STRIDED } diff --git a/src/output.cpp b/src/output.cpp index 75ae845..7c65fc2 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -22,6 +22,7 @@ #include #include +#include // // Implementation @@ -37,10 +38,15 @@ void Output::print(Experiment &e, int64 ops, std::vector seconds, double Output::header(e, ops, ck_res); for (int i = 0; i < seconds.size(); i++) Output::csv(e, ops, seconds[i], ck_res); + } else if (e.output_mode == Experiment::DFATOOL) { + for (int i = 0; i < seconds.size(); i++) { + Output::dfatool(e, ops, seconds[i], ck_res); + } } else { long double averaged_seconds = 0; - for (int i = 0; i < seconds.size(); i++) + for (int i = 0; i < seconds.size(); i++) { averaged_seconds += seconds[i]; + } Output::table(e, ops, (double) (averaged_seconds/seconds.size()), ck_res); } } @@ -118,6 +124,18 @@ void Output::csv(Experiment &e, int64 ops, double secs, double ck_res) { fflush(stdout); } +void Output::dfatool(Experiment &e, int64 ops, double secs, double ck_res) { + printf("[::] pChase | pointer_B=%ld cacheline_B=%ld page_B=%ld chain_B=%ld thread_B=%ld test_B=%ld e_pattern=%s stride=%d cpu_numa_node=%d ram_numa_node=%d numa_distance_cpu_ram=%d", + e.pointer_size, e.bytes_per_line, e.bytes_per_page, e.bytes_per_chain, e.bytes_per_thread, e.bytes_per_test, + e.access(), e.stride, e.thread_domain[0], e.chain_domain[0][0], numa_distance(e.thread_domain[0], e.chain_domain[0][0]) + ); + printf(" | latency_ns=%.2f bandwidth_MBps=%.3f\n", + (secs / (ops * e.iterations)) * 1e9, + ((ops * e.iterations * e.chains_per_thread * e.num_threads * e.bytes_per_line) / secs) * 1e-6 + ); + fflush(stdout); +} + void Output::table(Experiment &e, int64 ops, double secs, double ck_res) { printf("pointer size = %ld (bytes)\n", e.pointer_size); printf("cache line size = %ld (bytes)\n", e.bytes_per_line); diff --git a/src/output.h b/src/output.h index af718f0..34a22fe 100644 --- a/src/output.h +++ b/src/output.h @@ -36,6 +36,7 @@ public: static void header(Experiment &e, int64 ops, double ck_res); static void csv(Experiment &e, int64 ops, double seconds, double ck_res); static void table(Experiment &e, int64 ops, double seconds, double ck_res); + static void dfatool(Experiment &e, int64 ops, double seconds, double ck_res); private: }; -- cgit v1.2.3