File: performance_monitor.py

package info (click to toggle)
pyopengl 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 11,184 kB
  • ctags: 21,473
  • sloc: python: 80,468; makefile: 4
file content (71 lines) | stat: -rw-r--r-- 3,045 bytes parent folder | download | duplicates (12)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
'''OpenGL extension AMD.performance_monitor

This module customises the behaviour of the 
OpenGL.raw.GL.AMD.performance_monitor to provide a more 
Python-friendly API

Overview (from the spec)
	
	This extension enables the capture and reporting of performance monitors.
	Performance monitors contain groups of counters which hold arbitrary counted 
	data.  Typically, the counters hold information on performance-related
	counters in the underlying hardware.  The extension is general enough to
	allow the implementation to choose which counters to expose and pick the
	data type and range of the counters.  The extension also allows counting to 
	start and end on arbitrary boundaries during rendering.

The official definition of this extension is available here:
http://www.opengl.org/registry/specs/AMD/performance_monitor.txt
'''
from OpenGL import platform, constant, arrays
from OpenGL import extensions, wrapper
import ctypes
from OpenGL.raw.GL import _types, _glgets
from OpenGL.raw.GL.AMD.performance_monitor import *
from OpenGL.raw.GL.AMD.performance_monitor import _EXTENSION_NAME

def glInitPerformanceMonitorAMD():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )

glGetPerfMonitorGroupsAMD=wrapper.wrapper(glGetPerfMonitorGroupsAMD).setOutput(
    'numGroups',size=(1,),orPassIn=True
).setOutput(
    'groups',size=lambda x:(x,),pnameArg='groupsSize',orPassIn=True
)
glGetPerfMonitorCountersAMD=wrapper.wrapper(glGetPerfMonitorCountersAMD).setOutput(
    'numCounters',size=(1,),orPassIn=True
).setOutput(
    'maxActiveCounters',size=(1,),orPassIn=True
).setOutput(
    'counters',size=lambda x:(x,),pnameArg='counterSize',orPassIn=True
)
glGetPerfMonitorGroupStringAMD=wrapper.wrapper(glGetPerfMonitorGroupStringAMD).setOutput(
    'groupString',size=lambda x:(x,),pnameArg='bufSize',orPassIn=True
).setOutput(
    'length',size=(1,),orPassIn=True
)
glGetPerfMonitorCounterStringAMD=wrapper.wrapper(glGetPerfMonitorCounterStringAMD).setOutput(
    'length',size=(1,),orPassIn=True
).setOutput(
    'counterString',size=lambda x:(x,),pnameArg='bufSize',orPassIn=True
)
glGetPerfMonitorCounterInfoAMD=wrapper.wrapper(glGetPerfMonitorCounterInfoAMD).setOutput(
    'data',size=_glgets._glget_size_mapping,pnameArg='pname',orPassIn=True
)
glGenPerfMonitorsAMD=wrapper.wrapper(glGenPerfMonitorsAMD).setOutput(
    'monitors',size=lambda x:(x,),pnameArg='n',orPassIn=True
)
glDeletePerfMonitorsAMD=wrapper.wrapper(glDeletePerfMonitorsAMD).setOutput(
    'monitors',size=lambda x:(x,),pnameArg='n',orPassIn=True
)
glSelectPerfMonitorCountersAMD=wrapper.wrapper(glSelectPerfMonitorCountersAMD).setOutput(
    'counterList',size=lambda x:(x,),pnameArg='numCounters',orPassIn=True
)
glGetPerfMonitorCounterDataAMD=wrapper.wrapper(glGetPerfMonitorCounterDataAMD).setOutput(
    'data',size=lambda x:(x,),pnameArg='dataSize',orPassIn=True
).setOutput(
    'bytesWritten',size=(1,),orPassIn=True
)
### END AUTOGENERATED SECTION