summaryrefslogtreecommitdiffstats
path: root/src/util/amd_performance_monitor/ati_get_group_and_counter_list.c (plain)
blob: cb6419be157d1dbbf8f8c67f52f4ccdae022dd36
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
#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;
}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.