ML Reference
mlModuleProfiling.h
Go to the documentation of this file.
1
/*************************************************************************************
2
**
3
** Copyright 2014, MeVis Medical Solutions AG
4
**
5
** The user may use this file in accordance with the license agreement provided with
6
** the Software or, alternatively, in accordance with the terms contained in a
7
** written agreement between the user and MeVis Medical Solutions AG.
8
**
9
** For further information use the contact form at https://www.mevislab.de/contact
10
**
11
**************************************************************************************/
12
13
#ifndef ML_MODULE_PROFILING_H
14
#define ML_MODULE_PROFILING_H
15
16
#include <
mlTypeDefs.h
>
17
#include <mlProfilingManager.h>
18
19
ML_START_NAMESPACE
20
namespace
internal
21
{
23
class
ProfilingScope
{
24
25
public
:
26
ProfilingScope
():_profile(nullptr) {}
27
~ProfilingScope
() {
28
if
(_profile) {
29
_profile->stopMeasuring(_handle);
30
}
31
}
32
33
void
startMeasuring
(MLMetaProfile* profile,
const
std::string& function,
int
userId,
void
* userData)
34
{
35
_profile = profile;
36
_handle = profile->startMeasuring(function, userId, userData);
37
}
38
39
private
:
40
MLTimeProfileHandle _handle;
41
MLMetaProfile* _profile;
42
};
43
}
44
ML_END_NAMESPACE
45
48
#define ML_PROFILING_SCOPE(ProfilingIdentifier) \
49
internal::ProfilingScope internal_scope; \
50
if (MLProfilingManager::isProfilingEnabled()) { \
51
MLMetaProfile* internal_metaProfile = NULL; \
52
internal_metaProfile = getMetaProfile().get(); \
53
if (internal_metaProfile) { \
54
internal_scope.startMeasuring(internal_metaProfile, ProfilingIdentifier, MLMetaProfile::MLCall, this); \
55
} \
56
}
57
58
#endif
59
60
ml::internal::ProfilingScope
Helper class that stops measuring when it gets out of scope.
Definition
mlModuleProfiling.h:23
ml::internal::ProfilingScope::startMeasuring
void startMeasuring(MLMetaProfile *profile, const std::string &function, int userId, void *userData)
Definition
mlModuleProfiling.h:33
ml::internal::ProfilingScope::~ProfilingScope
~ProfilingScope()
Definition
mlModuleProfiling.h:27
ml::internal::ProfilingScope::ProfilingScope
ProfilingScope()
Definition
mlModuleProfiling.h:26
mlTypeDefs.h
MeVis
Foundation
Sources
ML
include
mlModuleProfiling.h
Generated by
1.10.0