This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Driver compile with profiling option

Note: This was originally posted on 10th May 2012 at http://forums.arm.com

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)







Parents
  • Note: This was originally posted on 11th May 2012 at http://forums.arm.com

    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
Reply
  • Note: This was originally posted on 11th May 2012 at http://forums.arm.com

    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
Children
No data