3 files changed, 62 insertions, 0 deletions
diff --git a/src/util/amd_performance_monitor/ati_get_group_and_counter_list.c b/src/util/amd_performance_monitor/ati_get_group_and_counter_list.c new file mode 100644 index 0000000..cb6419b --- a/dev/null +++ b/src/util/amd_performance_monitor/ati_get_group_and_counter_list.c | |||
@@ -0,0 +1,36 @@ | |||
1 | #include "ati_get_group_and_counter_list.h" | ||
2 | #include <stdlib.h> | ||
3 | |||
4 | extern void glGetPerfMonitorGroupsAMD (int* numGroups, int groupsSize, | ||
5 | void *groups); | ||
6 | |||
7 | void | ||
8 | ati_get_group_and_counter_list (GLuint ** groupsList, int *numGroups, | ||
9 | ATI_Counter_Info ** counterInfo) | ||
10 | { | ||
11 | GLint n; | ||
12 | GLuint *groups; | ||
13 | ATI_Counter_Info *counters; | ||
14 | |||
15 | glGetPerfMonitorGroupsAMD (&n, 0, NULL); | ||
16 | groups = (GLuint *) malloc (n * sizeof (GLuint)); | ||
17 | glGetPerfMonitorGroupsAMD (NULL, n, groups); | ||
18 | *numGroups = n; | ||
19 | |||
20 | *groupsList = groups; | ||
21 | counters = (ATI_Counter_Info *) malloc (sizeof (ATI_Counter_Info) * n); | ||
22 | for (int i = 0; i < n; i++) | ||
23 | { | ||
24 | glGetPerfMonitorCountersAMD (groups[i], &counters[i].numCounters, | ||
25 | &counters[i].maxActiveCounters, 0, NULL); | ||
26 | counters[i].counterList = (GLuint *) malloc (counters[i].numCounters * | ||
27 | sizeof (int)); | ||
28 | glGetPerfMonitorCountersAMD (groups[i], NULL, NULL, | ||
29 | counters[i].numCounters, | ||
30 | counters[i].counterList); | ||
31 | } | ||
32 | |||
33 | *counterInfo = counters; | ||
34 | |||
35 | return; | ||
36 | } | ||