From 84a134e983d6e5820a3de690ee63f7fb3a9b27a0 Mon Sep 17 00:00:00 2001 From: Kevin Huck Date: Thu, 14 Nov 2019 09:53:11 -0800 Subject: [PATCH] Fixing OTF output of papi metrics --- src/apex/otf2_listener.cpp | 19 +++++++++++++------ src/apex/otf2_listener.hpp | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/apex/otf2_listener.cpp b/src/apex/otf2_listener.cpp index 73c722d9..8e0d5b42 100644 --- a/src/apex/otf2_listener.cpp +++ b/src/apex/otf2_listener.cpp @@ -906,7 +906,7 @@ namespace apex { #if APEX_HAVE_PAPI void otf2_listener::write_papi_counters(OTF2_EvtWriter* writer, profiler* - prof, uint64_t stamp) { + prof, uint64_t stamp, bool is_enter) { // create a union for storing the value OTF2_MetricValue omv[1]; // tell the union what type this is @@ -916,7 +916,11 @@ namespace apex { uint64_t idx = 0L; for (auto metric : apex::instance()->the_profiler_listener->get_metric_names()) { - omv[0].floating_point = prof->papi_start_values[i++]; + if (is_enter) { + omv[0].floating_point = prof->papi_start_values[i++]; + } else { + omv[0].floating_point = prof->papi_stop_values[i++]; + } idx = get_metric_index(metric); // write our counter into the event stream OTF2_EC(OTF2_EvtWriter_Metric( writer, nullptr, stamp, idx, @@ -955,7 +959,8 @@ namespace apex { stamp, idx /* region */ )); #if APEX_HAVE_PAPI // write PAPI metrics! - write_papi_counters(local_evt_writer, tt_ptr->prof, stamp); + write_papi_counters(local_evt_writer, tt_ptr->prof, + stamp, true); #endif } else { stamp = get_time(); @@ -964,7 +969,7 @@ namespace apex { #if APEX_HAVE_PAPI // write PAPI metrics! write_papi_counters(local_evt_writer, tt_ptr->prof, - stamp); + stamp, true); #endif } // delete the attribute list @@ -1006,7 +1011,8 @@ namespace apex { stamp, idx /* region */ )); #if APEX_HAVE_PAPI // write PAPI metrics! - write_papi_counters(local_evt_writer, p.get(), stamp); + write_papi_counters(local_evt_writer, p.get(), + stamp, false); #endif } else { stamp = get_time(); @@ -1014,7 +1020,8 @@ namespace apex { stamp, idx /* region */ )); #if APEX_HAVE_PAPI // write PAPI metrics! - write_papi_counters(local_evt_writer, p.get(), stamp); + write_papi_counters(local_evt_writer, p.get(), + stamp, false); #endif } // delete the attribute list diff --git a/src/apex/otf2_listener.hpp b/src/apex/otf2_listener.hpp index e169ffff..514f6b32 100644 --- a/src/apex/otf2_listener.hpp +++ b/src/apex/otf2_listener.hpp @@ -167,7 +167,7 @@ namespace apex { reduce_node_properties(std::string&& str); #if APEX_HAVE_PAPI void write_papi_counters(OTF2_EvtWriter* writer, profiler* prof, - uint64_t stamp); + uint64_t stamp, bool is_enter); #endif public: otf2_listener (void);