BioDynaMo  v1.05.120-25dc9790
vtune.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 //
3 // Copyright (C) 2021 CERN & University of Surrey for the benefit of the
4 // BioDynaMo collaboration. All Rights Reserved.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // See the LICENSE file distributed with this work for details.
10 // See the NOTICE file distributed with this work for additional information
11 // regarding copyright ownership.
12 //
13 // -----------------------------------------------------------------------------
14 
15 // Define empty function bodies if Vtune wasn't found on your system.
16 // Functions will emit a warning on the first invocation.
17 
18 #ifndef CORE_UTIL_VTUNE_H_
19 #define CORE_UTIL_VTUNE_H_
20 
21 #ifdef USE_VTUNE
22 #include <ittnotify.h>
23 #else
24 
25 #include "core/util/log.h"
26 
29 #define BDM_VTUNE_LOG_WARNING() \
30  static bool warning_logged = false; \
31  if (!warning_logged) { \
32  bdm::Log::Warning( \
33  "Vtune", \
34  "Vtune was not found on your system. Call to %s won't have any " \
35  "effect", \
36  __FUNCTION__); \
37  warning_logged = true; \
38  }
39 
40 struct __itt_domain {}; // NOLINT
41 struct __itt_string_handle {}; // NOLINT
42 struct __itt_null_t {}; // NOLINT
43 
44 static constexpr __itt_null_t __itt_null; // NOLINT
45 
46 inline __itt_domain* __itt_domain_create(const char*) { // NOLINT
48  return nullptr;
49 }
50 
51 inline __itt_string_handle* __itt_string_handle_create(const char*) { // NOLINT
53  return nullptr;
54 }
55 
56 inline void __itt_task_begin(__itt_domain*, __itt_null_t, // NOLINT
59 }
60 
61 inline void __itt_task_end(__itt_domain*) { // NOLINT
63 } // NOLINT
64 
65 inline void __itt_pause() { BDM_VTUNE_LOG_WARNING(); } // NOLINT
66 
67 inline void __itt_resume() { BDM_VTUNE_LOG_WARNING(); } // NOLINT
68 
69 #endif // USE_VTUNE
70 
71 #endif // CORE_UTIL_VTUNE_H_
__itt_pause
void __itt_pause()
Definition: vtune.h:65
__itt_domain_create
__itt_domain * __itt_domain_create(const char *)
Definition: vtune.h:46
__itt_task_begin
void __itt_task_begin(__itt_domain *, __itt_null_t, __itt_null_t, __itt_string_handle *)
Definition: vtune.h:56
__itt_string_handle_create
__itt_string_handle * __itt_string_handle_create(const char *)
Definition: vtune.h:51
__itt_null_t
Definition: vtune.h:42
log.h
__itt_resume
void __itt_resume()
Definition: vtune.h:67
BDM_VTUNE_LOG_WARNING
#define BDM_VTUNE_LOG_WARNING()
Definition: vtune.h:29
__itt_string_handle
Definition: vtune.h:41
__itt_task_end
void __itt_task_end(__itt_domain *)
Definition: vtune.h:61
__itt_domain
Definition: vtune.h:40