Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 889125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:31:03+00:00 2026-05-15T13:31:03+00:00

What is the easiest to time execution in Android? I have looked around a

  • 0

What is the easiest to time execution in Android?

I have looked around a bit and I found TimingLogger on the Android SDK,
and instructions here. It looks very convenient.
But I can’t get it work. This is my code:

TimingLogger timings = new TimingLogger("TopicLogTag", "Parsing html");
   My code to time here...
timings.dumpToLog();

It’s supposed to dump the times in LogCat. But I can’t see anything.. I What am I doing wrong? Eclipse doesn’t show any varnings. I guess it has something with verbose ouput, but I have set LogCat to show Verbose.
Thank you..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:31:04+00:00Added an answer on May 15, 2026 at 1:31 pm

    I gave it a test run and I am experiencing the same thing. It all boils down to this little bit of the description in the Javadoc for TimingLogger:

    If the Log.isLoggable is not enabled
    to at least the Log.VERBOSE level for
    that tag at creation time then the
    addSplit and dumpToLog call will do
    nothing.

    I did a test locally:

    TimingLogger timings = new TimingLogger("MyTag", "Initialization");
    Log.d("MyTag", "Is Loggable? " + Log.isLoggable("MyTag", Log.VERBOSE));
    timings.dumpToLog();
    

    And oddly, I get an output to the log:

    06-28 08:35:18.693: DEBUG/MyTag(24366): Is Loggable? false
    

    But that’s it. And since it’s false, I doubt TimingLogger is doing anything, based on the TimingLogger code:

      90     /**
      91      * Clear and initialize a TimingLogger object that will log using
      92      * the tag and label that was specified previously, either via
      93      * the constructor or a call to reset(tag, label). If the
      94      * Log.isLoggable is not enabled to at least the Log.VERBOSE
      95      * level for that tag at creation time then the addSplit and
      96      * dumpToLog call will do nothing.
      97      */
      98     public void reset() {
      99         mDisabled = !Log.isLoggable(mTag, Log.VERBOSE);
     100         if (mDisabled) return;
     101         if (mSplits == null) {
     102             mSplits = new ArrayList<Long>();
     103             mSplitLabels = new ArrayList<String>();
     104         } else {
     105             mSplits.clear();
     106             mSplitLabels.clear();
     107         }
     108         addSplit(null);
     109     }
    

    I’m not sure why Log.isLoggable is returning false when it’s obviously logging at above VERBOSE, since my Log.d obviously logged.

    You can enable logging for that tag manually from the [Log class Javadoc][3]:

    You can change the default level by
    setting a system property: ‘setprop
    log.tag. ‘ Where
    level is either VERBOSE, DEBUG, INFO,
    WARN, ERROR, ASSERT, or SUPPRESS.
    SUPPRESS will turn off all logging for
    your tag. You can also create a
    local.prop file that with the
    following in it:
    ‘log.tag.=’ and
    place that in /data/local.prop.

    Which I did through adb shell:

    $ adb shell
    # setprop
    usage: setprop <key> <value>
    # setprop log.tag.MyTag VERBOSE
    # 
    

    Results in:

    06-28 08:53:42.447: DEBUG/MyTag(24739): Is Loggable? true
    06-28 08:53:44.744: DEBUG/MyTag(24739): Initialization: begin
    06-28 08:53:44.744: DEBUG/MyTag(24739): Initialization: end, 0 ms
    

    See droidgren’s comment on this answer – apparently a call to addSplit is also necessary.

    [3]: http://developer.android.com/reference/android/util/Log.html#isLoggable(java.lang.String, int)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Very simple question this time, basically I have a group of folders and some
What's the easiest way to calculate the execution time of a Python script?
What is the easiest-to-code-in technology that would give me real time access to a
I have very general problem on DNN 6.0 web site that I am working
We use very simple php function to display time and date. <div class=datedata><?=date(l, F
I have some .gz compressed files which is around 5-7gig uncompressed. These are flatfiles.
What's the easiest way to give a Time object representing a given time (say
What is the easiest way to convert military (24 hour time) to HH:MM format
I probably have one of the easiest questions of the day, but I'm having
I have a Shell script which uses the date and time parameters entered by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.