#include "ati_get_group_and_counter_list.h" #include 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; }