watchface low power mode execution monitoring question

I'm experimenting with execution options in the onPartialUpdate() method, and it got me to wondering, are the 3 execution times weighted equally in terms of power consumption?

In other words, if I reduce the execution time by 50us, at the expense of adding 50us to the graphics time, or vice-versa, is that a wash, or does one consume more power per us of execution than the others?

Also, the "display time" seems constant relative to the other two, what is that parameter exactly, and can it be varied by changing programming elements?

  • You can vary stuff based on the side of the clip region - the smaller the better.  And if you have more than one, it's the top row of the top one to the bottom row of the lowest one (they are combined) so you want then to be close to each other.  

  • yeah, that's part of what I'm doing, but it didn't really answer my question fully.

    If I do a conditional test to decide if I need a smaller or larger clip region, I spend more execution time to make that decision.  So, if I add 50us execution time for the conditional test, but save 50us in graphics time because of the smaller clip, did I improve, stay the same, or get worse in power consumption?

  • Consider the case of seconds and heart rate.  Seconds change, well, every second, while heart rate, only a few times a minute.  So unless heart rate has chanced since what's being displayed, no need to set a clip region for it just to display what's already shown.  It's the average over a minute, so while Watch Face Diagnostics shows what happened for the last second, you don't see the average for the current minute, so things like I do for heart rate can help a lot overall.

  • In this case I'm updating a field every second, namely the seconds display for the time of day.  So, I only need to update the 10's digit once every 10 seconds, but I need to update the 1's digit every second.

    I do the conditional test to see if I need to update the 10's digit.  If I do then my clip region includes both digits, otherwise my clip region includes just the 1's digit.  So, the smaller clip region saves me 50us of graphics time 9 out of 10 times, but the conditional test adds about 50us of execution time, maybe a little less.  So, I'm not sure if its worth going through the trouble unless 50us of graphics time consumes more power than 50us of execution time.

  • I mention the number of rows when combining clip regions, as number of columns is far less important.  So updating ony part of seconds doesn't do much and will lead to head aches with fonts that are not a fixed width.

    In watch face diagnostics, what do you see as a total?  If it's consistently in the high 20's, you may want to look at some tuning.  If it's 10 or below, you are already in really good shape.

    Also, note that using custom fonts for seconds takes more time than using native fonts.

  • I'm right at ~9000 total time, so you're saying that's good enough to not bother for incremental improvements.

    I've got another question regarding following execution of code with println statements.

    Is there a system timer value that I can print out so I can follow the difference in execution between two programs by inserting a System.println() in each method and have it report the exact system time it reaches various instructions.  I have two different versions of essentially the same program, with a few minor differences, and I'm seeing a difference in execution timing that I can't figure out.  If I could see how many milli-seconds or micro-seconds elapse between a few sections of code that would probably explain the differences I'm seeing.  Is there a way to do that?

  • Yes and no.  There is System.getTimer(), but I've never found it that accurate in the sim and only trust it on a real device.

    Have you tried the profiler in the 4.1.0-beta1 SDK?

  • no, but I found the cause of the issue I wanted to trace, even though it made no sense.  Not worth going into the details, but by adding the conditional test code to decide if I needed to update one or two digits, another part of the code executed at what appears to be about one second later.  When I removed that conditional test, the one second delay went away.  Can't explain why adding 50us of execution time would have that visible effect of one second delay, but it did.

  • What I generally do is in onLayout() I have

    secondsWidth=dc.getTextWidthInPixels("88",secondsFont);

    //"88" as that will probably be the widest

    (that's also where I get the secondsHeight based on the font, and have set the x/y for the clip)

    And then use that for the clip with no additional calculations and always show both digits.