ARM Community: Driver compile with profiling option - ARM Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Driver compile with profiling option

#1 User is offline   yoda 

  • Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 10-May 12

Posted 10 May 2012 - 10:59 AM

Hello!

I am trying to use Mali GPU performance analyzer.

At first, I thought that performance analyzer can be connected to target embedded device by installing "libmaliinstr.so" library file to target embedded platform.

But it didn't work.

In user guide, there is a requirement that an instrumented driver should be used for profiling.

Does it mean Mali Linux kernel device driver should be compiled with profiling option? (USING_PROFILING in Makefile)

When I try this, I get error messages.

FIrst, mali_cinstr_profiling_events_m200.h header file doesn't exist , it is included by mali_kernel_profiling.h

And some undeclared define values make problem

drivers/media/video/samsung/mali/common/mali_kernel_MALI200.c:646: error: 'MALI_PROFILING_EVENT_TYPE_START' undeclared (first use in this function)

drivers/media/video/samsung/mali/common/mali_kernel_MALI200.c:718: error: 'MALI_PROFILING_EVENT_TYPE_STOP' undeclared (first use in this function)








0

#2 User is offline   KarthikH 

  • Moderator
  • Pip
  • Group: Moderators
  • Posts: 28
  • Joined: 14-April 10

Posted 10 May 2012 - 11:19 AM

Hi Yoda,

As the user guide mentions, an instrumented driver is needed for profiling. The instrumented drivers requires modifications to both the user space and kernel drivers. The drivers you have modified belong to the kernel space.

These drivers are typically not included in release versions and you would have to request them from the silicon vendor. Could you let us know what performance problems you are facing so we can better advise you?

Thanks
Karthik
0

#3 User is offline   yoda 

  • Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 10-May 12

Posted 10 May 2012 - 11:57 AM

Hi KarthikH

I am just trying to use performance analyzer for research purpose.

It's frustrating if we need to require the instrumented driver from Samsung (We are using exynos 4210 SoC)

It's nearly impossible.

We only need to get FPS(Frame Per Second) while a target graphic application is running.

Is there any way we can get FPS without performance analyzer ?
0

#4 User is offline   KarthikH 

  • Moderator
  • Pip
  • Group: Moderators
  • Posts: 28
  • Joined: 14-April 10

Posted 11 May 2012 - 10:43 AM

Hi Yoda,

To measure FPS, you can do it directly from your application. It depends on whether you are using Linux or Android.

If you are using Linux, you can measure the time taken for consecutive calls to eglSwapBuffers. The following piece of code will print out the FPS every second.
You can insert this code, before you call eglSwapBuffers,

  
  static int first = 0;
  static int cFrames = 0;
  static struct timeval sNow, sLast;
  long int lElapsed = 0;
  if(first == 0)
  {
 	gettimeofday(&sLast, NULL);
 	first = 1;
  }
  else
  {
   	gettimeofday(&sNow, NULL);

  	/* Cacluate time elapsed from the last call to swap buffers */
  	lElapsed = (sNow.tv_sec - sLast.tv_sec) * 1000000L + (sNow.tv_usec - sLast.tv_usec);
  	/* is time elapsed more than one second */
   	if(lElapsed >= 1000000)
     	{
    		/* Update FPS. */
    		float fFPS = 1000000.0f * cFrames / (float)lElapsed;
        	printf("FPS - %.2f\n", fFPS);
   		sLast = sNow;
   		cFrames = 0;
    	}
   	cFrames++;
   }



If you are using Android, then you would be using android.opengl.GLSurfaceView.Renderer for drawing your frame. One of the functions in this interface is onDrawFrame(). You can profile the time taken between successive calls to onDrawFrame() by using code similar to the above for java and it should print you the FPS.

private static boolean first = true;
private static long prev, curr;
private static int numFrames;

long timeElapsed;
if(first){
   	prev = System.nanoTime();
   	first = false;
}
else{
   	curr = System.nanoTime();
   	/* In micro seconds */
   	timeElapsed = (curr - prev)/1000; 
   	if(timeElapsed > 1000000){
   	float fFPS = 1000000.0f * numFrames / (float)timeElapsed;
   	Log.i("AppLog", "FPS - " + fFPS);
   	numFrames = 0;
   	prev = curr;
   	}else{
      		numFrames++;
   	}
}


Please let me know if you need any more clarifications with the above.

Regards
Karthik

This post has been edited by KarthikH: 11 May 2012 - 10:49 AM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic