@@ -53,17 +53,15 @@ void LBData::start(TimeType time) {
5353 }
5454
5555 /* -- PAPI START -- */
56-
5756 /* Start counting events in the Event Set */
58- // papi_retval_ = PAPI_start(EventSet_);
59- // if (papi_retval_ != PAPI_OK)
60- // handle_papi_error(papi_retval_, "LBData start: Starting counting events in the Event Set: ");
61-
62- /* Gets the starting time in clock cycles */
63- start_cycles_ = PAPI_get_real_cyc ();
57+ papi_retval_ = PAPI_start (EventSet_);
58+ if (papi_retval_ != PAPI_OK)
59+ handle_papi_error (papi_retval_, " LBData start: Starting counting events in the Event Set: " );
6460
65- /* Gets the starting time in microseconds */
66- start_usec_ = PAPI_get_real_usec ();
61+ start_real_cycles_ = PAPI_get_real_cyc ();
62+ start_real_usec_ = PAPI_get_real_usec ();
63+ start_virt_cycles_ = PAPI_get_virt_cyc ();
64+ start_virt_usec_ = PAPI_get_virt_usec ();
6765
6866 /* ---------------- */
6967}
@@ -74,30 +72,18 @@ void LBData::finish(TimeType time) {
7472 lb_data_->stop (time);
7573 }
7674
77- /* -- PAPI READ AND STOP -- */
78-
79- /* Read the counting events in the Event Set */
80- // papi_retval_ = PAPI_read(EventSet_, papi_values_);
81- // if (papi_retval_ != PAPI_OK)
82- // handle_papi_error(papi_retval_, "LBData finish: Reading the counting events in the Event Set: ");
83-
84- // printf("Counters after LBData::finish: %lld\n",papi_values_[0]);
85-
86- // /* Stop the counting of events in the Event Set */
87- // papi_retval_ = PAPI_stop(EventSet_, papi_values_);
88- // if (papi_retval_ != PAPI_OK)
89- // handle_papi_error(papi_retval_, "LBData finish: Stoping the counting of events in the Event Set: ");
75+ /* -- PAPI STOP -- */
76+ /* Stop the counting of events in the Event Set */
77+ papi_retval_ = PAPI_stop (EventSet_, papi_values_);
78+ if (papi_retval_ != PAPI_OK)
79+ handle_papi_error (papi_retval_, " LBData finish: Stoping the counting of events in the Event Set: " );
9080
91- /* Gets the ending time in clock cycles */
92- end_cycles_ = PAPI_get_real_cyc ();
81+ end_real_cycles_ = PAPI_get_real_cyc ();
82+ end_real_usec_ = PAPI_get_real_usec ();
83+ end_virt_cycles_ = PAPI_get_virt_cyc ();
84+ end_virt_usec_ = PAPI_get_virt_usec ();
9385
94- /* Gets the ending time in microseconds */
95- end_usec_ = PAPI_get_real_usec ();
96-
97- printf (" Wall clock cycles: %lld\n " , end_cycles_ - start_cycles_);
98- printf (" Wall clock time in microseconds: %lld\n " , end_usec_ - start_usec_);
99-
100- /* ------------------------ */
86+ /* -------------- */
10187}
10288
10389void LBData::send (elm::ElementIDStruct dest, MsgSizeType bytes) {
@@ -118,4 +104,12 @@ typename LBData::ElementIDStruct const& LBData::getCurrentElementID() const {
118104 return cur_elm_id_;
119105}
120106
107+ std::unordered_map<std::string, double > LBData::getPAPIMetrics () const {
108+ std::unordered_map<std::string, double > papi_metrics = {};
109+ for (size_t i = 0 ; i < native_events_.size (); i++) {
110+ papi_metrics[native_events_[i]] = papi_values_[i];
111+ }
112+ return papi_metrics;
113+ }
114+
121115}} /* end namespace vt::ctx */
0 commit comments