void MetricBackend_INTEL_perfquery::enumGroups(enumGroupsCallback callback,
                                               void* userData)
{
    unsigned gid;
    glGetFirstPerfQueryIdINTEL(&gid);
    while (gid) {
        callback(gid, 0, userData);
        glGetNextPerfQueryIdINTEL(gid, &gid);
    }
}
	bool initPerf()
	{
		GLint QueryNameMaxLength = 0;
		glGetIntegerv(GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL, &QueryNameMaxLength);
		GLint CounterNameMaxLength = 0;
		glGetIntegerv(GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL, &CounterNameMaxLength);
		GLint CounterDescMaxLength = 0;
		glGetIntegerv(GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL, &CounterDescMaxLength);

		const GLuint queryNameLen = 1024;
		GLchar queryName[queryNameLen];

		const GLuint counterNameLen = 1024;
		GLchar counterName[counterNameLen];

		const GLuint counterDescLen = 4096;
		GLchar counterDesc[counterDescLen];

		GLuint queryId;
		glGetFirstPerfQueryIdINTEL(&queryId);

		while(queryId)
		{
			GLuint dataSize = 0;
			GLuint noCounters = 0;
			GLuint noInstances = 0;
			GLuint capsMask = 0;

			memset(queryName, 0, sizeof(queryName));

			glGetPerfQueryInfoINTEL(
				queryId,
				QueryNameMaxLength,
				queryName,
				&dataSize,
				&noCounters,
				&noInstances,
				&capsMask);

			printf("%d - %s (%s)/ output size: %d, counters: %d, instances: %d\n", queryId, queryName, capsMask & GL_PERFQUERY_GLOBAL_CONTEXT_INTEL ? "global" : "local", dataSize, noCounters, noInstances);

			glGetNextPerfQueryIdINTEL(queryId, &queryId);

			for(GLuint counterId = 1; counterId <= noCounters; counterId++)
			{
				GLuint counterOffset = 0;
				GLuint counterDataSize = 0;
				GLuint counterTypeEnum = 0;
				GLuint counterDataTypeEnum = 0;
				GLuint64 rawCounterMaxValue = 0;

				memset(counterName, 0, sizeof(counterName));
				memset(counterDesc, 0, sizeof(counterDesc));

				glGetPerfCounterInfoINTEL(
					queryId,
					counterId,
					CounterNameMaxLength,
					counterName,
					CounterDescMaxLength,
					counterDesc,
					&counterOffset,
					&counterDataSize,
					&counterTypeEnum,
					&counterDataTypeEnum,
					&rawCounterMaxValue);

				printf("- %d - %s output: %s - %s - %d, max counter values: %lld\n", counterId, counterName, GetCounterTypeString(counterTypeEnum), GetCounterDataTypeString(counterDataTypeEnum), dataSize, rawCounterMaxValue);
				printf("\t%s\n", counterDesc);

				continue;
			}
		}

		return true;
	}