Skip to content

Commit

Permalink
Don't include PAPI code when PAPI not included in the
Browse files Browse the repository at this point in the history
configuration.
  • Loading branch information
khuck committed Jun 29, 2018
1 parent 8ec5510 commit 0128cbd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/apex/otf2_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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<task_wrapper> &tt_ptr) {
task_identifier * id = tt_ptr->get_task_id();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -917,13 +923,17 @@ namespace apex {
std::unique_lock<std::mutex> 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);
Expand Down
2 changes: 2 additions & 0 deletions src/apex/otf2_listener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ namespace apex {
std::map<std::string,uint64_t> reduced_region_map;
std::map<std::string,uint64_t> reduced_metric_map;
std::unique_ptr<std::tuple<std::map<int,int>, std::map<int,std::string> > > 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); };
Expand Down
2 changes: 2 additions & 0 deletions src/apex/profiler_listener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ class profiler_listener : public event_listener {
static void consumer_process_profiles_wrapper(void);
void public_process_profile(std::shared_ptr<profiler> &p) { process_profile(p,0); };
bool concurrent_cleanup(int i);
#if APEX_HAVE_PAPI
std::vector<std::string>& get_metric_names(void) { return metric_names; };
#endif
};

}
Expand Down

0 comments on commit 0128cbd

Please sign in to comment.