forked from GPUOpen-Tools/gpu_performance_api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
GPACounterGeneratorSchedulerManager.cpp
83 lines (65 loc) · 2.5 KB
/
GPACounterGeneratorSchedulerManager.cpp
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//==============================================================================
// Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved.
/// \author AMD Developer Tools Team
/// \file
/// \brief Class that will get the correct Generator and Scheduler for an API/Generation combination
//==============================================================================
#include "GPACounterGeneratorSchedulerManager.h"
CounterGeneratorSchedulerManager::CounterGeneratorSchedulerManager()
{
}
CounterGeneratorSchedulerManager::~CounterGeneratorSchedulerManager()
{
}
void CounterGeneratorSchedulerManager::RegisterCounterGenerator(GPA_API_Type apiType, GDT_HW_GENERATION generation, GPA_CounterGeneratorBase* pCounterGenerator, bool replaceExisting)
{
GenerationGeneratorMap localMap;
if (0 < m_counterGeneratorItems.count(apiType))
{
localMap = m_counterGeneratorItems[apiType];
}
if (0 == localMap.count(generation) || replaceExisting == true)
{
localMap[generation] = pCounterGenerator;
}
m_counterGeneratorItems[apiType] = localMap;
}
bool CounterGeneratorSchedulerManager::GetCounterGenerator(GPA_API_Type apiType, GDT_HW_GENERATION generation, GPA_CounterGeneratorBase*& pCounterGeneratorOut)
{
bool retVal = false;
if (0 < m_counterGeneratorItems.count(apiType))
{
if (0 < m_counterGeneratorItems[apiType].count(generation))
{
pCounterGeneratorOut = m_counterGeneratorItems[apiType][generation];
retVal = true;
}
}
return retVal;
}
void CounterGeneratorSchedulerManager::RegisterCounterScheduler(GPA_API_Type apiType, GDT_HW_GENERATION generation, IGPACounterScheduler* pCounterScheduler, bool replaceExisting)
{
GenerationSchedulerMap localMap;
if (0 < m_counterSchedulerItems.count(apiType))
{
localMap = m_counterSchedulerItems[apiType];
}
if (0 == localMap.count(generation) || replaceExisting == true)
{
localMap[generation] = pCounterScheduler;
}
m_counterSchedulerItems[apiType] = localMap;
}
bool CounterGeneratorSchedulerManager::GetCounterScheduler(GPA_API_Type apiType, GDT_HW_GENERATION generation, IGPACounterScheduler*& pCounterSchedulerOut)
{
bool retVal = false;
if (0 < m_counterSchedulerItems.count(apiType))
{
if (0 < m_counterSchedulerItems[apiType].count(generation))
{
pCounterSchedulerOut = m_counterSchedulerItems[apiType][generation];
retVal = true;
}
}
return retVal;
}