3 files changed, 62 insertions, 0 deletions
diff --git a/src/util/amd_performance_monitor/ati_counter_info.h b/src/util/amd_performance_monitor/ati_counter_info.h new file mode 100644 index 0000000..36fdfdc --- a/dev/null +++ b/src/util/amd_performance_monitor/ati_counter_info.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef ATI_COUNTER_INFO_H | ||
2 | #define ATI_COUNTER_INFO_H | ||
3 | |||
4 | #include <GL/glut.h> | ||
5 | |||
6 | typedef struct | ||
7 | { | ||
8 | GLuint *counterList; | ||
9 | int numCounters; | ||
10 | int maxActiveCounters; | ||
11 | } ATI_Counter_Info; | ||
12 | |||
13 | #endif // ATI_COUNTER_INFO_H | ||
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 | } | ||
diff --git a/src/util/amd_performance_monitor/ati_get_group_and_counter_list.h b/src/util/amd_performance_monitor/ati_get_group_and_counter_list.h new file mode 100644 index 0000000..e30096e --- a/dev/null +++ b/src/util/amd_performance_monitor/ati_get_group_and_counter_list.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef ATI_GET_GROUP_AND_COUNTER_LIST_H | ||
2 | #define ATI_GET_GROUP_AND_COUNTER_LIST_H | ||
3 | |||
4 | #include "ati_counter_info.h" | ||
5 | |||
6 | /* | ||
7 | * Code from | ||
8 | * http://www.opengl.org/registry/specs/AMD/performance_monitor.txt | ||
9 | */ | ||
10 | void ati_get_group_and_counter_list (GLuint ** groupsList, int *numGroups, | ||
11 | ATI_Counter_Info ** counterInfo); | ||
12 | |||
13 | #endif // ATI_GET_GROUP_AND_COUNTER_LIST_H | ||