Skip to content

Commit

Permalink
Fixing OTF output of papi metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Dec 3, 2019
1 parent 524bd68 commit 84a134e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions src/apex/otf2_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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();
Expand All @@ -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
Expand Down Expand Up @@ -1006,15 +1011,17 @@ 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();
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);
write_papi_counters(local_evt_writer, p.get(),
stamp, false);
#endif
}
// delete the attribute list
Expand Down
2 changes: 1 addition & 1 deletion src/apex/otf2_listener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 84a134e

Please sign in to comment.