From 0128cbd747ba2c11a22a48a2e04b2c50cd353d65 Mon Sep 17 00:00:00 2001 From: Kevin Huck Date: Thu, 28 Jun 2018 17:03:23 -0700 Subject: [PATCH] Don't include PAPI code when PAPI not included in the configuration. --- src/apex/otf2_listener.cpp | 10 ++++++++++ src/apex/otf2_listener.hpp | 2 ++ src/apex/profiler_listener.hpp | 2 ++ 3 files changed, 14 insertions(+) diff --git a/src/apex/otf2_listener.cpp b/src/apex/otf2_listener.cpp index 77ecef5f..47f4294a 100644 --- a/src/apex/otf2_listener.cpp +++ b/src/apex/otf2_listener.cpp @@ -831,6 +831,7 @@ namespace apex { return; } +#if APEX_HAVE_PAPI void otf2_listener::write_papi_counters(OTF2_EvtWriter* writer, profiler* prof, uint64_t stamp) { // create a union for storing the value OTF2_MetricValue omv[1]; @@ -846,6 +847,7 @@ namespace apex { OTF2_EC(OTF2_EvtWriter_Metric( writer, NULL, stamp, idx, 1, omt, omv )); } } +#endif bool otf2_listener::on_start(std::shared_ptr &tt_ptr) { task_identifier * id = tt_ptr->get_task_id(); @@ -874,13 +876,17 @@ namespace apex { // thread 0 in monotonic order. stamp = get_time(); OTF2_EC(OTF2_EvtWriter_Enter( local_evt_writer, al, stamp, idx /* region */ )); +#if APEX_HAVE_PAPI // write PAPI metrics! write_papi_counters(local_evt_writer, tt_ptr->prof, stamp); +#endif } else { stamp = get_time(); OTF2_EC(OTF2_EvtWriter_Enter( local_evt_writer, al, stamp, idx /* region */ )); +#if APEX_HAVE_PAPI // write PAPI metrics! write_papi_counters(local_evt_writer, tt_ptr->prof, stamp); +#endif } // delete the attribute list OTF2_AttributeList_Delete(al); @@ -917,13 +923,17 @@ namespace apex { std::unique_lock lock(_comm_mutex); stamp = get_time(); OTF2_EC(OTF2_EvtWriter_Leave( local_evt_writer, al, stamp, idx /* region */ )); +#if APEX_HAVE_PAPI // write PAPI metrics! write_papi_counters(local_evt_writer, p.get(), stamp); +#endif } else { stamp = get_time(); OTF2_EC(OTF2_EvtWriter_Leave( local_evt_writer, al, stamp, idx /* region */ )); +#if APEX_HAVE_PAPI // write PAPI metrics! write_papi_counters(local_evt_writer, p.get(), stamp); +#endif } // delete the attribute list OTF2_AttributeList_Delete(al); diff --git a/src/apex/otf2_listener.hpp b/src/apex/otf2_listener.hpp index 231d0469..227244d3 100644 --- a/src/apex/otf2_listener.hpp +++ b/src/apex/otf2_listener.hpp @@ -160,7 +160,9 @@ namespace apex { std::map reduced_region_map; std::map reduced_metric_map; std::unique_ptr, std::map > > reduce_node_properties(std::string&& str); +#if APEX_HAVE_PAPI void write_papi_counters(OTF2_EvtWriter* writer, profiler* prof, uint64_t stamp); +#endif public: otf2_listener (void); //~otf2_listener (void) { shutdown_event_data data(my_saved_node_id,0); on_shutdown(data); }; diff --git a/src/apex/profiler_listener.hpp b/src/apex/profiler_listener.hpp index d6d3f994..eeb3536c 100644 --- a/src/apex/profiler_listener.hpp +++ b/src/apex/profiler_listener.hpp @@ -212,7 +212,9 @@ class profiler_listener : public event_listener { static void consumer_process_profiles_wrapper(void); void public_process_profile(std::shared_ptr &p) { process_profile(p,0); }; bool concurrent_cleanup(int i); +#if APEX_HAVE_PAPI std::vector& get_metric_names(void) { return metric_names; }; +#endif }; }