-
Notifications
You must be signed in to change notification settings - Fork 5
/
ROCProfilerModule.h
61 lines (47 loc) · 2.11 KB
/
ROCProfilerModule.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//==============================================================================
// Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved.
/// \author AMD Developer Tools
/// \file
/// \brief This class manages the dynamic loading of ROCProfiler entry points
//==============================================================================
#ifndef _ROC_PROFILER_MODULE_H_
#define _ROC_PROFILER_MODULE_H_
#include "DynamicLibraryModule.h"
#include "AutoGenerated/ROCProfilerModuleDecls.h"
#include "AutoGenerated/ROCProfilerModuleFuncTables.h"
/// This class handles the dynamic loading of librocprofiler64.so.
/// \note There will typically be one of these objects.
/// That instance will be global.
/// There is a trap for the unwary.
/// The order of global ctors is only defined within a single compilation unit.
/// So, one should not use these interfaces before "main" is reached.
/// This is different than calling these functions when the .dll/.so is linked against.
class ROCProfilerModule
{
public:
/// Default name to use for construction.
/// This is usually librocprofiler64.so.
static const char* s_defaultModuleName;
/// Constructor.
ROCProfilerModule();
/// Destructor.
~ROCProfilerModule();
/// Load module.
/// \param[in] name The module name.
/// \return true if successful, false otherwise.
bool LoadModule(const std::string& name = s_defaultModuleName);
/// Unload module.
void UnloadModule();
/// Indicates whether the ROCProfiler module has been loaded and all the expected entry points are valid.
/// \returns enumeration value to answer query.
bool IsModuleLoaded() { return m_isModuleLoaded; }
#define X(SYM) SYM##_fn_t SYM;
ROC_PROFILER_API_TABLE;
#undef X
private:
/// Initialize the internal data.
void Initialize();
bool m_isModuleLoaded; ///< Flag indicating whether the ROCProfiler module has been loaded and all the expected entry points are valid.
DynamicLibraryModule m_dynamicLibraryHelper; ///< Helper to load/initialize the ROCProfiler entry points.
};
#endif