yashsingh1/xdaforums huggingface dataset:
[Windows Mobile Apps and Games] ZuinigeRijder:
Thanks for the testing effort. Indeed BattClock was slow, because it was continuously getting the network statistics, once per second, logging a lot of network statistics. If I would implement the real network statistics, I would of course only get the interesting statistics. But because I am still investigating, I just log as much as I could, to know where to look for.

Unfortunately you only posted the BattConfig log files and not the big BattClock log files. Maybe my instructions were wrong? Maybe disabling the Debug logging while BattClock was still running, made also that log empty? I hope you still have the other log files too :eek:

If not, that means you did the hard work for nothing :mad:
[Windows Mobile Apps and Games] ZuinigeRijder:
On itself adding this feature is possible. Because also for the Wifi and Mobile counters BattClock keeps track of them (via the Registry). But the tricky part is when to reset the counters really. It would be possible to fully charge the battery with phone off. And then when BattClock is started not on the charger, it thinks it has been reset?

Another possibility would be to have a manual reset possibility. E.g. a command parameter to BattConfig. So you can make a shortcut to reset the counters? Is that not a better solution. Although you still have not to forget to do the resetting. Note that it also makes it possible to count how long a battery has been used, when someone never changes battery. So BattClock keeps tracking the total battery usage time.......
[Windows Mobile Apps and Games] AnartzJavier:
Thank you Marangoni has been I of great help. Gero arte!!!
[Windows Mobile Apps and Games] Joe Bleau:
BattClock CPU Usage?

Users reported in the NRG Rhodium thread (Touch Pro2/Tilt 2) this:

And I posted this here: the CPU usage fluctuates between 1.25 (rarely 1.68%) to 0.00% as reported by Start->Tools->Task manager. I guess it's depending on it refreshing the data shown on the Taskbar that you selected. I can't notice any UI fluidity impact vs. killing BattClock with said Task Manger or Winstart.

I took a bunch of screen captures of the BattClock CPU usage according to the cooked-in NRG ROM Feb.27 Task Manager v3.1 within a few minutes, cropped & pasted them toguether (time consuming!):

but there's something fishy in Task Manager:

My current BattClock display settings:

Like Jake & cajunflavoredbob, BattClock is running fine on my Tilt 2 w/ NRG ROM Feb.27. My current ROM on HTC Tilt 2: Energy.RHODIUM.28244.Sense2.5.Cookie.2.0.Feb.27.

I attached a rar to this message that contains: battclock.csv (logged CPU usage idling, w/o SIM nor WiFi or BT, plugged, display not dimming nor phone going to sleep), BattClock.reg.txt (exported my BattConfig settings), ZuinigeRijder.reg (export of registry key of BattClock) and BattClock.xml for good measure.

Edit: Check also this post: Re: Taskmanager v3.1 CPU Usage Data?
[Windows Mobile Apps and Games] ephestione:
My idea was that, while battclock keeps checking the current batt% and comparing it to the reg value for stored batt% and time/date, it would keep counting on the timer as long as the current batt% is equal or lower than the stored batt%, otherwise reset the counter if the stored batt% is higher than the current batt%.

So, as in your example, if you charge the phone while it's off, and turn it on out of the charger, battclock checks that the current batt% (probably 100% or almost) is still higher than the value that it "remembered" in the registry, so it knows the battery either was charged or switched to another charged one in the meantime, and automatically resets the timer, and saves into the registry the new batt% for comparison (100 in this case) and the current time/date value.

In other words, I know it's "rough", in the sense that with this design, you just need to plug the phone into the charger to have the timer reset without your control, but there's always space for polishing (adding option to reset manually instead of automatically, adding option to "allow maximum charging time before resetting timer", that is, if you only plug the battery to the usb cable for one-two minutes, for syncing, you will have a "grace period" in which the uptime timer goes on without being reset).

This kind of feature is thought for those who either only use an external desktop charger for the spare batteries they later switch (like me), or only charge the phone fully and take it out when it's 100%, to charge it again when it's 20% or lower.

In other words, it is to measure the "real life" battery life; I suppose the already built-in uptime function ("time since battclock start") would be fine for those other people charging the phone regularly no matter the starting and ending batt% of the charge.
[Windows Mobile Apps and Games] ZuinigeRijder:
BattClock in itself is efficient as possible. But the most CPU time used will be spent in actually updating the display. So BattClock is made as efficient as possible. Gather the info in a background thread and only update the display when there is an actual change in value. So dependent how often the screen needs to be updated, more CPU is used. Actually, I think monitoring to a BattCLock.csv file, without displaying it, will cost less CPU then if you display it without logging to a file.

You can see that the CPU% increases, when you show something which is constantly (once per second) is updating the display. For example enable the feature to show seconds on the display. You will see the difference in CPU%, constantly updating the screen. Note that Windows Mobile is so smart, that with the screen off, the actual updates are not done. So then the extra CPU is not used.

It is also possible that polling the Battery driver for current is for those devices slugish. But that is then related to the Battery driver, I think.

So in general it is best to choose values/display stuff which does not change every second. You can make use of the DivideBy feature, to have less frequent changes of the values shown on screen (e.g. MB instead of KB).

BattClock uses a Microsoft API GetIdleTime() to get the CPU%.

DWORD dwStopTick = GetTickCount();
DWORD dwIdleEd = GetIdleTime();
DWORD delta = dwStopTick - dwStartTick;
if (delta > 0) { // avoid divide by zero
int percentBusy = 100 - ((100 * (dwIdleEd - dwIdleStart)) / delta);
....

This is different that Task Managers do. They count the CPU% per process. So which is more accurate, I do not know. What I do know, however, someone found out that for his use case a TaskManager did report less CPU% than BattClock did. It turned out this had to do with Sense interface to find constantly music on the SDCard, consuming extra CPU and draining battery. Luckily he could find the problem and resolve it. Without the BattClock CPU% method he would not have found out.

Some Samsung (Omnia) users have reported that BattClock method did not work on their devices. There constantly a high CPU% is reported. I do not know if there is a monitor process which consumes the IDLE time, to also find the used CPU%. Because that is another method. Make a Thread with the lowest priority and measure the CPU% that thread gets. Then you know how much the rest is using. But this affects the Microsoft API of measuring idle time.

So, shortly, I think both CPU values are useful, from BattClock and detail CPU percentages in Task Managers.

Hope that explains something :rolleyes:
[Windows Mobile Apps and Games] ZuinigeRijder:
Still there is a possible problem. When you reboot, sometimes the battery driver reports more battery% than before. So there should be some really big delta, e.g. 20% or so or even more. I will think about it.
[Windows Mobile Apps and Games] Tokl:
This was an side effect i see often on custom ROMs... :(

(This is also in the Stock ROMs, but less intensitive)

Try to kill Sense and the album manager (manila.exe and audioeng.exe)

You can also disable sense with HKLM\Software\Microsoft\Today\Items\HTC Sense "enabled" set to "0" (re enabling again with "1") and do an softreset.

Once Sense is disabled, i hope you will see BattClock is also showing nearly 0%.

That means Sense is trying to hide from Taskmanagers, so nobody sees how cpu intensitive it is :mad:

For an solution, rever to my older posts (and some posts around) ;)

http://xdaforums.com/showpost.php?p=7919004&postcount=958

http://xdaforums.com/showpost.php?p=7955943&postcount=974

Greetz Tokl
[Windows Mobile Apps and Games] JVH3:
When I was seeing the battclock always using 0.65% of the CPU or more, it was displaying CPU usage and battery mA. Both change values frequently, so the display was constantly being updated.

I am no longer displaying CPU usage. This has virtually elliminated any CPU usage from battclock.exe. Of course there is some when something needs updating, but that is way less frequent now.
[Windows Mobile Apps and Games] ZuinigeRijder:
Good to hear that you could eliminate the CPU usage by not displaying the CPU usage :rolleyes:

Displaying needs to be done on the UI thread, so no other updates can be done at that same time (for other processes). So when constantly the screen is repainted (once per second), the phone may become a bit sluggish. So always think what info you would want to see on the display and the consequences. The Battery driver will normally only give back changed info e.g. once per 20 seconds, so that is normally not a problem.

Maybe I should make the display update time configurable, in the Display Formats Settings screen. So everyone can put their own display update value......
[Windows Mobile Apps and Games] Joe Bleau:
Re: Display Update & CPU Usage

That would be useful. Meanwhile, what is the registry key we could modify ourselves to have a lower "display update value"?
[Windows Mobile Apps and Games] reidler:
Hi. I'm sorry that I did not send the correct log file. BUT - that was the only log file I saw. The log file was being built in the same folder as I ran the 3.5.3 test right? I just looked in that folder and I do not see any other log files. I'll be happy to do this again. It will go faster for me to do it again. But I'm not sure what I should do differently to get you the correct log file.

I will tell you that I had looked in the folder and I had seen a very large log file of about 8 megabytes. Then after I stopped Battclock I saw the log file was only 51KB and I wondered how did that happen. Maybe there was another log file of 8 MB that disappeared. So what should I do? Should I not disable the debugging from the ABOUT screen before ending Battclock? Should I just close Battclock without stopping the debugging and then then the file will still be there? Please let me know and I'll get to it soon as I can and send you the correct files.

Also - you did say to check the log that is in the ABOUT screen, right? Not the log from the menu. The logs in the menu - both the one that says log to registry and log to file - are both not checked.

Thank you.

Eli
[Windows Mobile Apps and Games] jcmm:
Hello ZuinigeRijder,

I noticed that the upper line to indicate the charge status of the battery increases the CPU concumo significantly. I've turned off, leaving only a two-line column 3 data in total: more than the hour and minute of the day (fixed data), and the lower the level of battery charge (%) and total KB / MB of GPRS rotating with 5 seconds of rotation, and refresh data every 120 seconds.

If not get better battery consumption of my HTC Touch Pro, which is rather high consumption (so I believe), despite all the measures I have taken to improve it. Not if you can further modify a parameter in the Windows registry (I have original ROM with WM6.1 Pro).

I note that when you reboot (soft-reset) there is sometimes a big difference in% battery status (between 5% and 8 %)...

Regards,
[Windows Mobile Apps and Games] ZuinigeRijder:
This is not yet possible, the current values are hardcoded. So I have to implement that than.
[Windows Mobile Apps and Games] ZuinigeRijder:
As alternative you could bring down the CPU value to a number between 0 and 10, by filling in "Divide By" 10 in the Display Formats settings screen for the CPU value. That way the CPU will be less sensitive, and only change when it is a bigger change in CPU. So there will e.g. no difference between 1 and 9 CPU%, so less display updates.

Also check this posts of Tokl.
[Windows Mobile Apps and Games] ZuinigeRijder:
Indeed it is only Debug logging enabling in the About Screen.

The problem is in the step:

8. Disable Debug logging and stop BattClock

9. Post the log file BattClock.log.txt

It should be:

8. Stop BattClock

9. Post the log file BattClock.log.txt

10. Disable Debug logging in the About Screen.

When you Disable Debug logging, while BattClock is still running, it will start with an empty BattClock.log.txt file :mad:

Sorry for the wrong instructions.
[Windows Mobile Apps and Games] Joe Bleau:
Re: CPU% Divide by 10

Sorry, I tried "Divide By" 10 in the Display Formats settings screen for the CPU value and checking BattClock's own CPU usage in Task Manger, it actually went up. :confused: Maybe because it had to divide the CPU/Time data all the time by 10?

Edit: Simply removing the CPU% from Content dramatically reduced BattClock's own CPU usage with this config:

Too bad, I liked seeing the CPU activity. :(
[Windows Mobile Apps and Games] ZuinigeRijder:
Below 1% CPU usage will likely not drain battery. Especially, when in a deep sleep no CPU is used. But apparently the Microsoft API use more CPU than the other monitor facilities of BattClock. I do not understand that divide by 10 will increase the CPU usage. Probably I need to test myself to believe it :cool:

Polling the battery driver too often, that is something what will be for sure drain battery.
[Windows Mobile Apps and Games] reidler:
Ok. Try try again. I hope I got it right this time. Please let me know if I did not get what you need and I'll try try try again. I attached the two Batclock.log files. (zipped). One for mobile (about 11 meg) and one for wifi (about 8 meg).

Thanks.

Eli
[Windows Mobile Apps and Games] ZuinigeRijder:
Thanks for the testing effort.

Strangely enough in your logs there is no trace of GetTCPStatistics() info. I assume you downloaded some data (mobile and Wifi).

That means that the log file of cichmen gives interesting information and your not for the network information part. I will analyze further this evening.
[Windows Mobile Apps and Games] reidler:
Well, my phone is always saying that my mobile data and wifi data is 0 in all the fields. I don't know. Maybe my phone is not doing something it is supposed to.

(Sprint Touch Pro 2). If I did something wrong or you need me to do something else please leet me know. Yes, I did open a webpage and did some browsing. I browsed the battclock pages. I did that for mobile and for wifi. Good luck.

Eli
[Windows Mobile Apps and Games] ephestione:
You indeed speak the truth ;) I noticed that too.

I agree on the delta idea. Given the premises, that is, adding this special kind of "battery uptime" info would be useful only to some users ("battery switchers" and "full chargers") the 20% delta wouldn't be a problem, since none in this category would charge his battery when at 80%, nor would charge it starting from 10% to get up only to 30%.

Even if the highest "battery jump" I've seen is like 3-4% more after reboot, so 20% is maybe a little too much, it still wouldn't hinder the kind of use as I said before.

In case you implement the (configurable?) delta, it may be a good idea, after reboot/restart of battclock, to check if the value is withint delta, and if yes, also update the batt% stored in the registry to the new, higher one, without touching the time/date value to count from.
[Windows Mobile Apps and Games] omek07:
Hello

It is normal to saw me 90*-100* CPU always ????

this * is the free percend ???? or is something else ????
[Windows Mobile Apps and Games] reidler:
Screen Shot.

Hi. I found this program called ShakeAndSave. It takes a picture of your screen on your mobile phone. You start the program and then it runs in the background. You navigate to the screen you wish and then you shake the phone and it snaps a picture and saves it in a folder on the main memory called ShakeAndSave. You can save it in one of 4 formats. I attached the cab for anyone that might be interested. I also attached a picture of my screen. I have been wanting to show the Battclock set up that I have. I have not had time to play with MyMobiler. I don't know how to insert the screen picture in to this message but at least it's attached if you wish to see it (and comment on it).

I have Battclock show me the battery level in the top right corner. Underneath that it shows me the Uptime minutes. Across the top is the battery stripe indicator. At the top left corner it shows me the day of the week, date and time. To the right of that it shows me how many missed calls, voice mails, Text messages, Emails and unread Reminders. 6 fields shown in two columns of three rows. If there is a number 1 or more it is displayed in green. If the number is 0 then the marker (M=missed calls, V=voicemail, T=text messages, E=emails, R=reminders) is displayed in dark. Next to the R (to its right) is a reminder for all day events. You cannot see anything. That field is invisible unless there is at least 1 or more. To the right of this I built 5 stripes going from top to bottom indicating the same information. The letters across the bottom of that field indicate what each stripe is for. These last stripes I did to learn how to build stripes. It's a bit redundant so I may use the stripes for better things like volume indicators when we're ready for that.

Thanks.

Eli
[Windows Mobile Apps and Games] ephestione:
ShakeAndSave has been around quite a while! There are "funnier" variations like "Whip2Snap", where you shake the phone as you would snap a whip, and the phone makes the sound of a slashing whip while taking a screenshot :p
[Windows Mobile Apps and Games] Joe Bleau:
Re: Whip2Snap Screen Capture App

Whip2Snap is not just "funnier", you can choose the file type (jpeg, png, etc) of the screen capture, the file naming prefix & most importantly to save to a custom folder in the memory card. All things that ShakeAndSave can't do as it saves to phone & that's why I switch to Whip2Snap.
[Windows Mobile Apps and Games] reidler:
OK. whip2snap it is. I just got it. Thanks. :)
[Windows Mobile Apps and Games] ZuinigeRijder:
I checked the log files more thorough, but my conclusion is that this new network statistics is not working for you. So I need to decide if I want to make an alternative implementation, yes or no, for other ones. But for you it will not bring anything. I still do not understand why the 'normal' Wifi and Mobile data is not showing for your phone. I remember you did sent those logs too some time ago. And I could not find why it did not work for you then too :mad:
[Windows Mobile Apps and Games] ZuinigeRijder:
No, it is the non-idle CPU time. People on Samsung reported that the Microsoft API was not working for them. See also this post.

So maybe another task manager is running using a Thread with lowest priority to get the CPU%?
[Windows Mobile Apps and Games] ZuinigeRijder:
Nice screenshot and use of the BattClock features :) You almost used up all the 12 display items :eek:
[Windows Mobile Apps and Games] ZuinigeRijder:
I was thinking about the following counters:

- MinutesUptime, the number of minutes since starting BattClock (already available)

- MinutesTotalUptimeBattery, the number of minutes for all sessions monitored by BattClock on Battery (survives reboot)

- MinutesTotalUptimeCharging, the number of minutes for all sessions monitored by BattClock on Charger (survives reboot)

- MinutesUptimeBattery, the number of minutes for all sessions monitored by BattClock, reset when the delta Battery% is more than 20% (for battery switchers or full chargers)
[Windows Mobile Apps and Games] ephestione:
woah, that's "going overboard" for you :D

Sounds overkill, but I suppose that once you're at it, you just feel like completing the job nicely!

I still would like a configurable delta, even only from registry without cranking up the BattCponfig UI, as I would put it to not higher than 10%.

So, to make sure I understand, being the MinutesUptimeBattery timer clear enough, what would be the full difference between MinutesTotalUptimeBattery and MinutesUptimeBattery? The latter will auto-reset after delta-increase is met, while the former needs manual reset? Or there's more?
[Windows Mobile Apps and Games] ZuinigeRijder:
MinutesUptimeBattery is indeed reset automatically. Note that for this measurement, there is no distinction between charging and not. So I do not know if that is valuable too? I do not think so.

I will add a delta configuration possibility in the registry. The same I will do for the update ratefor some items, so people can tune the CPU usage if they do not like the default values:

batteryPollSeconds;

detectBackgroundSeconds;

cpuSeconds;

cpuSpeedSeconds;

freeMemorySeconds;

regkeyPollSeconds;

processInfoSeconds;

wifiSeconds;

internetSeconds;
[Windows Mobile Apps and Games] ZuinigeRijder:
Did you see the high CPU when your phone is on Power? Because then the polling once per 120 seconds is not valid. I would expect that the CPU is 0 when not on power, showing only time, Battery% and GPRS.
[Windows Mobile Apps and Games] ephestione:
Well... if you do it like this, this is going to become even better than the SQM service installed in vanilla WM builds.

Let me explain: you would keep counting the timer since stored timestamp even if you momentarily plug the battery to the charger, instead of autoresetting it as I proposed... but still, as long as you keep charging, if you keep it on power until it goes beyond delta the battery will reset automatically anyway; with SQM, this kind of behaviour was obviously not available.

Also, with SQM, the uptime was reset if you either pressed the hardware reset button, or physically took outthe battery (survived only to a sotware reboot), while with MinutesUptimeBattery this won't happen, unless there is a delta change in the battery, so battclock's timer will be indeed surviving also a proper reset or battery switch, better than SQM.

So, props for the job ;)

Also, and this is a sidenote, so please take it with a lot of salt... I was thinking that another special "meter" would be interesting to be added to BattClock.

Together with BatteryCurrent(Force), you could add a BatteryCurrentAvg, where you have battclock check the battery current value each (let's say) 15 seconds, and display the average of the values measured in the last (let's say) 2 minutes.

This would be more useful to check the battery drain for those activities that drain a roughly average mA for a long time, like watching videos, reading anime, reading ebooks, listening to MP3s.

Usually, if you go and suddenly check the mA in those situations, you get the "last reading", which, you never know, could be different from normal because of some background service running, the auto-backlight randomly kicking in, a glitch in the driver, whatever.

Instead, if you have the avg of the last x minutes of the values picked up each y seconds, you could get a good idea of the proper battery drain for a long-lasting activity. Naturally, X mnutes and Y seconds would be configurable even if just by registry, with default values of whatever you may see fit.
[Windows Mobile Apps and Games] jcmm:
Hello ZuinigeRijder,

Do I stop right then 60 seconds as standard on this parameter BattClock?. Is there some other setting in the Windows registry to optimize battery consumption?. Thanks.

Regards,
[Windows Mobile Apps and Games] ZuinigeRijder:
It does not make sense to optimize battery consumption when charging, because it will not use battery ;)

So the question was, does it also take so much CPU when *NOT* charging.