Imagination PowerVR SDK Blog

How can I measure the program performace on SGX


#1

I use gettimeofday to get the time the draw function takes after using glFinigh. However I don’t think that I get the correct result since the swaq function costs too long.
 
On the other hand, if I want to get some performace datas, is there any tool that is useful for me?


#2

I use gettimeofday to get the time the draw function takes after using

glFinish. However I don’t think that I get the correct result since the

swap function costs too long.
 
On the other hand, if I want to get some performace data, is there any tool that is useful for me?

Hardware: SGX 535

Thanks.


#3

Can you please post your usage of gettimeofday ? Are you converting correctly from microseconds ? Are you talking about eglswapbuffers call taking too long ?


#4

gettimeofday(&tv1,&tz);
glDrawArrays(GL_TRIANGLE_STRIP,0,4);
glFinish();
gettimeofday(&tv2,&tz);
printf("%ld",((tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec)));
gettimeofday(&tv1,&tz);
eglSwapBuffers(eglDisplay, eglSurface);


gettimeofday(&tv2,&tz);


printf("%ld",((tv2.tv_sec-tv1.tv_sec)*1000000+(tv2.tv_usec-tv1.tv_usec)));

I test this using two different fragment shader. If the shader code is simple, all above go fast, and after I saw the Swap time, I can immediately saw the result on screen. However, if the shader  contains a lot more computation, I can only saw the result after a small break when I saw the Swap time. I think, after calling glFinish, the client and server should synchronize their operations, then calling the eglSwqpBuffers function shouldn’t result in the latency difference.



#5

glFinish won’t do what you want. If you really want to make sure rendering is finished use glReadPixels to read a single pixel. In that case you don’t even need to measure eglSwapBuffers. However note that this only gives about the right results if all you draw is a full screen quad and you want to measure the time required for the fragment shader.


#6

Hi

Could you please explain more specifically why glFinish won't work here?

glReadPixels generates an error (GL_INVALID_OPERATION / 1282) when I try to use it on beagleboard.

hnyk2009-06-03 09:01:04

#7

What is the format/type combination you use, and what is the framebuffer/EGLSurface format?


#8

It works on emulator so there shouldn't be anything wrong with formats.  I've asked from google and it could be something with wrong thread executing the command, but I didn't find anything how to fix it.

Anyway, I would still be interested to know why glFinish won't work, since instruction description says that it synchronises CPU and GPU so I gather that it should work. But obviously I have tested it and it won't work, so why?

hnyk2009-06-04 07:28:37

#9
hnyk wrote:
It works on emulator so there shouldn't be anything wrong with formats.

This is not necessarily true. You could get a different surface format in the emulator, and thus a different format/type combination will work. The only format/type combination that is guaranteed to work in OpenGL ES, no matter the surface format, is GL_RGBA/GL_UNSIGNED_BYTE.



Quote:
Anyway, I would still be interested to know why glFinish won't work, since instruction description says that it synchronises CPU and GPU so I gather that it should work. But obviously I have tested it and it won't work, so why?

It's not implemented that way, partly because of applications which use glFinish improperly.