Skip to content

Commit eb04548

Browse files
committed
#2302: Fix guards
1 parent 822df4b commit eb04548

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/vt/runnable/runnable.cc

+10-8
Original file line numberDiff line numberDiff line change
@@ -199,23 +199,26 @@ void RunnableNew::run() {
199199
#endif
200200
}
201201

202+
#if vt_check_enabled(perf) || vt_check_enabled(papi)
202203
void RunnableNew::startMetrics() {
203204
#if vt_check_enabled(papi)
204-
contexts_.lb.startPAPIMetrics();
205+
if (contexts_.has_lb)
206+
{
207+
contexts_.lb.startPAPIMetrics();
208+
}
205209
#elif vt_check_enabled(perf)
206210
vt::thePerfData()->startTaskMeasurement();
207-
#else
208-
#error "vt wasn't configured with measurement options"
209211
#endif
210212
}
211213

212214
void RunnableNew::stopMetrics() {
213215
#if vt_check_enabled(papi)
214-
contexts_.lb.stopPAPIMetrics();
216+
if (contexts_.has_lb)
217+
{
218+
contexts_.lb.stopPAPIMetrics();
219+
}
215220
#elif vt_check_enabled(perf)
216221
vt::thePerfData()->stopTaskMeasurement();
217-
#else
218-
#error "vt wasn't configured with measurement options"
219222
#endif
220223
}
221224

@@ -227,10 +230,9 @@ std::unordered_map<std::string, uint64_t> RunnableNew::getMetrics() {
227230
}
228231
#elif vt_check_enabled(perf)
229232
return vt::thePerfData()->getTaskMeasurements();
230-
#else
231-
#error "vt wasn't configured with measurement options"
232233
#endif
233234
}
235+
#endif
234236

235237
void RunnableNew::start(TimeType time) {
236238
contexts_.setcontext.start();

src/vt/runnable/runnable.h

+2
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ struct RunnableNew {
323323
*/
324324
BaseMsgType* getMsg() const { return msg_.get(); }
325325

326+
#if vt_check_enabled(perf) || vt_check_enabled(papi)
326327
/**
327328
* \brief Start metrics associated to this runnable for the running context
328329
*/
@@ -342,6 +343,7 @@ struct RunnableNew {
342343
* \return the dictionnary
343344
*/
344345
std::unordered_map<std::string, uint64_t> getMetrics();
346+
#endif
345347

346348
#if vt_check_enabled(fcontext)
347349
/**

0 commit comments

Comments
 (0)