+
+#if HAVE_PAPI
+ /**
+ * An MPI function has been called and now is the right time to update
+ * our PAPI counters for this process.
+ */
+ if (xbt_cfg_get_string("smpi/papi-events")[0] != '\0') {
+ papi_counter_t& counter_data = smpi_process_papi_counters();
+ int event_set = smpi_process_papi_event_set();
+ std::vector<long long> event_values = std::vector<long long>(counter_data.size());
+
+ if (PAPI_stop(event_set, &event_values[0]) != PAPI_OK) { // Error
+ XBT_CRITICAL("Could not stop PAPI counters.\n");
+ xbt_die("Error.");
+ } else {
+ for (unsigned int i = 0; i < counter_data.size(); i++) {
+ counter_data[i].second += event_values[i];
+ // XBT_DEBUG("[%i] PAPI: Counter %s: Value is now %lli (got increment by %lli\n", smpi_process_index(),
+ // counter_data[i].first.c_str(), counter_data[i].second, event_values[i]);
+ }
+ }
+ }
+#endif
+