@@ -27,15 +27,17 @@ namespace coreneuron {
2727
2828namespace detail {
2929
30- /* ! \class Instrumentor
31- * \brief Instrumentation infrastructure for benchmarking and profiling.
32- *
33- * The Instrumentor class exposes static methods that can be used to
34- * toggle with fine-grained resolution the profiling of specific
35- * areas within the code.
36- */
30+ /* ! \class Instrumentor
31+ * \brief Instrumentation infrastructure for benchmarking and profiling.
32+ *
33+ * The Instrumentor class exposes static methods that can be used to
34+ * toggle with fine-grained resolution the profiling of specific
35+ * areas within the code.
36+ */
3737template <class ... TProfilerImpl>
3838struct Instrumentor {
39+ #pragma clang diagnostic push
40+ #pragma clang diagnostic ignored "-Wunused-value"
3941 /* ! \fn phase_begin
4042 * \brief Activate the collection of profiling data within a code region.
4143 *
@@ -128,6 +130,7 @@ struct Instrumentor {
128130 inline static void finalize_profile () {
129131 std::initializer_list<int >{(TProfilerImpl::finalize_profile (), 0 )...};
130132 }
133+ #pragma clang diagnostic pop
131134};
132135
133136#if defined(CORENEURON_CALIPER)
@@ -220,29 +223,26 @@ struct Tau {
220223#if defined(LIKWID_PERFMON)
221224
222225struct Likwid {
223- inline static void phase_begin (const char * name){
226+ inline static void phase_begin (const char * name) {
224227 LIKWID_MARKER_START (name);
225228 };
226229
227- inline static void phase_end (const char * name){
230+ inline static void phase_end (const char * name) {
228231 LIKWID_MARKER_STOP (name);
229232 };
230233
231- inline static void start_profile () {};
234+ inline static void start_profile (){};
232235
233- inline static void stop_profile () {};
236+ inline static void stop_profile (){};
234237
235- inline static void init_profile (){
238+ inline static void init_profile () {
236239 LIKWID_MARKER_INIT;
237240
238241#pragma omp parallel
239- {
240- LIKWID_MARKER_THREADINIT;
241- }
242-
242+ { LIKWID_MARKER_THREADINIT; }
243243 };
244244
245- inline static void finalize_profile (){
245+ inline static void finalize_profile () {
246246 LIKWID_MARKER_CLOSE;
247247 };
248248};
@@ -258,9 +258,7 @@ struct NullInstrumentor {
258258 inline static void finalize_profile (){};
259259};
260260
261- } // namespace detail
262-
263- using Instrumentor = detail::Instrumentor<
261+ using InstrumentorImpl = detail::Instrumentor<
264262#if defined CORENEURON_CALIPER
265263 detail::Caliper,
266264#endif
@@ -277,5 +275,41 @@ using Instrumentor = detail::Instrumentor<
277275 detail::Likwid,
278276#endif
279277 detail::NullInstrumentor>;
278+ } // namespace detail
279+
280+ namespace Instrumentor {
281+ struct phase {
282+ phase (const char * name) {
283+ detail::InstrumentorImpl::phase_begin (name);
284+ }
285+ ~phase () {
286+ detail::InstrumentorImpl::phase_end (" " );
287+ }
288+ };
289+
290+ inline static void start_profile () {
291+ detail::InstrumentorImpl::start_profile ();
292+ }
293+
294+ inline static void stop_profile () {
295+ detail::InstrumentorImpl::stop_profile ();
296+ }
297+
298+ inline static void phase_begin (const char * name) {
299+ detail::InstrumentorImpl::phase_begin (name);
300+ }
301+
302+ inline static void phase_end (const char * name) {
303+ detail::InstrumentorImpl::phase_end (name);
304+ }
305+
306+ inline static void init_profile () {
307+ detail::InstrumentorImpl::init_profile ();
308+ }
309+
310+ inline static void finalize_profile () {
311+ detail::InstrumentorImpl::finalize_profile ();
312+ }
313+ }
280314
281315} // namespace coreneuron
0 commit comments