summaryrefslogtreecommitdiffstats
Side-by-side diff
-rw-r--r--src/util/amd_performance_monitor/ati_counter_info.h13
-rw-r--r--src/util/amd_performance_monitor/ati_get_group_and_counter_list.c36
-rw-r--r--src/util/amd_performance_monitor/ati_get_group_and_counter_list.h13
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 @@
+#ifndef ATI_COUNTER_INFO_H
+#define ATI_COUNTER_INFO_H
+
+#include <GL/glut.h>
+
+typedef struct
+{
+ GLuint *counterList;
+ int numCounters;
+ int maxActiveCounters;
+} ATI_Counter_Info;
+
+#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 @@
+#include "ati_get_group_and_counter_list.h"
+#include <stdlib.h>
+
+extern void glGetPerfMonitorGroupsAMD (int* numGroups, int groupsSize,
+ void *groups);
+
+void
+ati_get_group_and_counter_list (GLuint ** groupsList, int *numGroups,
+ ATI_Counter_Info ** counterInfo)
+{
+ GLint n;
+ GLuint *groups;
+ ATI_Counter_Info *counters;
+
+ glGetPerfMonitorGroupsAMD (&n, 0, NULL);
+ groups = (GLuint *) malloc (n * sizeof (GLuint));
+ glGetPerfMonitorGroupsAMD (NULL, n, groups);
+ *numGroups = n;
+
+ *groupsList = groups;
+ counters = (ATI_Counter_Info *) malloc (sizeof (ATI_Counter_Info) * n);
+ for (int i = 0; i < n; i++)
+ {
+ glGetPerfMonitorCountersAMD (groups[i], &counters[i].numCounters,
+ &counters[i].maxActiveCounters, 0, NULL);
+ counters[i].counterList = (GLuint *) malloc (counters[i].numCounters *
+ sizeof (int));
+ glGetPerfMonitorCountersAMD (groups[i], NULL, NULL,
+ counters[i].numCounters,
+ counters[i].counterList);
+ }
+
+ *counterInfo = counters;
+
+ return;
+}
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 @@
+#ifndef ATI_GET_GROUP_AND_COUNTER_LIST_H
+#define ATI_GET_GROUP_AND_COUNTER_LIST_H
+
+#include "ati_counter_info.h"
+
+/*
+ * Code from
+ * http://www.opengl.org/registry/specs/AMD/performance_monitor.txt
+ */
+void ati_get_group_and_counter_list (GLuint ** groupsList, int *numGroups,
+ ATI_Counter_Info ** counterInfo);
+
+#endif // ATI_GET_GROUP_AND_COUNTER_LIST_H

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.