2 Replies - 3325 Views - Last Post: 08 August 2012 - 09:09 AM

#1 shehzad99  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 07-August 12

Creating a 'profiling' program for the android platfrom

Posted 07 August 2012 - 07:44 PM

Hi,

I am using shiVa and eclipse and I have been asked to make a profiling program that would check the time it takes by each function.

Can anyone help me with the basic structure?

I'll need two functions.
onstartTime() and onendTime() and the output should should the difference.
Is This A Good Question/Topic? 0
  • +

Replies To: Creating a 'profiling' program for the android platfrom

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8342
  • View blog
  • Posts: 31,880
  • Joined: 06-March 08

Re: Creating a 'profiling' program for the android platfrom

Posted 08 August 2012 - 03:42 AM

System.nanoTime()
http://docs.oracle.c...html#nanoTime()
will return the more precise time you can get mut you will have to call your methods a few thousand times to get a valuable value

That should do it if Android has a System.nanoTime() method


public class Profiling {
    private long start;
    
    Profiling() {
    	reset();
    }
    
    long elapsed() {
    	long end = System.nanoTime();
    	return end - start;
    }
    
    void reset() {
    	start = System.nanoTime();
    }
}


If not you will have to find what ii the Android librray equivalent

This post has been edited by pbl: 08 August 2012 - 03:49 AM
Reason for edit:: Oups.... it is for Android. nanoTimme() might not exist

Was This Post Helpful? 0
  • +
  • -

#3 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10669
  • View blog
  • Posts: 39,635
  • Joined: 27-December 08

Re: Creating a 'profiling' program for the android platfrom

Posted 08 August 2012 - 09:09 AM

Moved to Android.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1