ug4
runtime_profile_info.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2015: G-CSC, Goethe University Frankfurt
3  * Author: Martin Rupp
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 
34 #ifndef __H__UG__COMMON__PROFILER__RUNTIME_PROFILE_INFO__
35 #define __H__UG__COMMON__PROFILER__RUNTIME_PROFILE_INFO__
36 
37 #ifdef UG_PROFILER
38 
39 #include "profiler.h"
40 #include "common/log.h"
41 #include "common/util/stringify.h"
42 
55 class RuntimeProfileInfo
56 {
57 public:
58  RuntimeProfileInfo(const char* name = NULL, bool bCopyName = false,
59  const char* groups = NULL, bool bCopyGroup = false,
60  const char* file = NULL, bool bCopyFile = false,
61  int line = 0);
62 
63  ~RuntimeProfileInfo();
64 
65  inline void beginNode()
66  {
67 #ifdef UG_PROFILER_SHINY
68  Shiny::ProfileManager::instance._beginNode(&profilerCache, &profileInformation);
70 #endif
71 #ifdef UG_PROFILER_SCALASCA
72  EPIK_USER_START(pName);
73 #endif
74 #ifdef UG_PROFILER_VAMPIR
75  VT_USER_START((char*)pName);
76 #endif
77 #ifdef UG_PROFILER_SCOREP
78  SCOREP_USER_REGION_BEGIN( m_pHandle, pName,
79  SCOREP_USER_REGION_TYPE_COMMON )
80 #endif
81  }
82 
83  inline void endNode()
84  {
85 #ifdef UG_PROFILER_SHINY
86  Shiny::ProfileManager::instance._endCurNode();
88 #endif
89 #ifdef UG_PROFILER_SCALASCA
90  EPIK_USER_END(pName);
91 #endif
92 #ifdef UG_PROFILER_VAMPIR
93  VT_USER_END((char*)pName);
94 #endif
95 #ifdef UG_PROFILER_SCOREP
96  SCOREP_USER_REGION_END(m_pHandle);
97 #endif
98  }
99 
100 
101  const char *name() const
102  {
103  return pName;
104  }
105 
106  const char *group() const
107  {
108  return pGroup;
109  }
110 
111  const char *file() const
112  {
113  return pFile;
114  }
115 
116  int line() const
117  {
118  return iLine;
119  }
120 
121  private:
122  bool bNameCopied;
123  bool bGroupCopied;
124  bool bFileCopied;
125  const char* pName;
126  const char* pGroup;
127  const char* pFile;
128  int iLine;
129 
130 #ifdef UG_PROFILER_SHINY
131  Shiny::ProfileZone profileInformation;
132  Shiny::ProfileNodeCache profilerCache;
133 #endif
134 #ifdef UG_PROFILER_SCOREP
135  SCOREP_User_RegionHandle m_pHandle;
136 #endif
137 };
138 
139 static inline std::ostream& operator << (std::ostream& os, const RuntimeProfileInfo &pi)
140 {
141  os << "RuntimeProfileInfo name=" << pi.name() << " group=" << pi.group() << " @ " << pi.file() << ":" << pi.line();
142  return os;
143 }
144 
145 typedef RuntimeProfileInfo* pRuntimeProfileInfo;
146 #endif
147 
148 
149 #endif /* __H__UG__COMMON__PROFILER__RUNTIME_PROFILE_INFO__ */
location name
Definition: checkpoint_util.lua:128
std::ostream & operator<<(std::ostream &outStream, const ug::MathMatrix< 2, 2 > &m)
Definition: math_matrix.cpp:38
#define PROFILE_LOG_CALL_START()
Definition: shiny_call_logging.h:48
#define PROFILE_LOG_CALL_END()
Definition: shiny_call_logging.h:49