yashsingh1/xdaforums huggingface dataset:
[Windows Mobile Development and Hacking General] :
Guys, please DONT program this in .NET. Its crucial for such an app that it runs native! Otherwise it wont really speed up your device that much because it a) needs much more horsepower and it b) need a lot of RAM to run and a significant time to start up.

Otherwise the idea is just fantastic. I hope this will be added to OMAPClock or programmed natively.

And btw: The app should also be compatible with MS Smartphone 2003 / Win Mobile 5 Smartphone if possible!
[Windows Mobile Development and Hacking General] Oliy:
Well, I've written this in .Net and it appears to take the following:

1mb RAM.

Virtually no processor usage - even when running underclocked it reports typically < 2% load, which includes all background processes etc.

Startup time is approx 10 seconds, but you only need to run it once and then it will live in the background.

I agree, this isn't great for such a small app, but .NET has an excellent API.

I can program in C++ and Java but the fastest way to get this project off the ground was to write in .NET.

I am hoping that this program can give significant savings in battery life as well as speed up intensive operations.

Guybrush,

Correct, I used QueryPerformanceFrequency and QueryPerformanceCounter.

Oliy
[Windows Mobile Development and Hacking General] Guybrush:
Just a tip... it's could be useful divide application in two :

1) program with GUI to set up configuration file

(directory and parameter and levels to manage OMAPClock and the timer for CPU monitor )

2) basic program without GUI maybe in CPP that read conf file on startup and run CPU monitor.

it could be the best solution for me.

if you use that two functions CPU Load Monitor should be enogh simple to develop and not expancive for resources.... Just two ticks and check the difference between two... the thing i don't understand is the step how to transform the ms between the two tips in % of load CPU :(
[Windows Mobile Development and Hacking General] Oliy:
Guybrush, that sounds like a good idea. The GUI adds quite a lot of bloat and, once the program is set up how you like it, unnecessary.

Currently it all works in the "heavy" version, which is good to use to set up your preferences as it allows you to monitor CPU load and has a nice interface to set your configuration.

In order to clear up it's operation, here is a UML statechart diagram.

Note, the 80% and 30% load thresholds are arbitrary and can be set by the user.

In order to determine the average CPU load over a given period, you determine the amount of cpu idle time in a given period, and divide it by the period as illustrated below:

Use the code on MSDN linked below to get a sample code, this just gives the principles if you wish to go about it another way.

Oliy
[Windows Mobile Development and Hacking General] Guybrush:
many thanks ;)

yes i had found something like that on MSDN

------------------------------------

dwStartTick = GetTickCount();

dwIdleSt = GetIdleTime();

Sleep();

dwStopTick = GetTickCount();

dwIdleEd = GetIdleTime();

PercentIdle = ((100*(dwIdleEd - dwIdleSt)) / (dwStopTick - dwStartTick));

-----------------------------------

;) i saw only now... tomorrow i'll try to develop something me too, it could be useful in future and i like to learn new things :P

I'm glad u liked the idea... because the CPU Monitor don't need the GUI, it makes application heavy for nothing :)

I'm sorry for my bad english :P
[Windows Mobile Development and Hacking General] Oliy:
Release v0.1

Attached is release v0.1, it should be used for testing only and I make no guarantees as to it's stability or danger it may cause to your device / data etc.

Simply put the exe on your device and run it, you will be presented with a tabbed page which shows the current state and load on the main screen.

The settings page contains self-explanatory settings which have been referred to in this text.

The only one which may require explanation is "Clock threshold" - this determines how many past values to take into account when determining the next state, e.g.

Clock threshold = 2

Program will only overclock if last 2 consecutive samples of the cpu load are above the overclock threshold.

You will also need to have OmapClock.exe in the windows directory.

Please let me know if it works for you, and if anyone can think up a way of measuring its impact on a) performance and b) battery life.

Oliy

** edit - updated version attached
[Windows Mobile Development and Hacking General] Guybrush:
good work Oliy, interface looks good, but i'll try tomorrow :)
[Windows Mobile Development and Hacking General] jwzg:
I agree concerning the interface. However, OmapClock and your program report different values. In addition, does your program set a notification so it will continue to run, or does it need an .ini? This has lots of potential.
[Windows Mobile Development and Hacking General] topcaser:
Re: Release v0.1

The user if looks really great. Good job. I dont understand the setting clock

threshold.

Is it possible to have an initial time until omap scaler enters the default state. i explained it already: Omapclock starts after power on and sets the maximum speed. after 1 minute e.g. the OMAP scaler begins to work and scales down the speed if necessary.

I have played around a bit. One setting is lost if i leave the program and restart it although the config.xml is just right in the folder: It is the checkbox of the underrun. It is gone after restart the scaler (have i understand right that the checkboxes enables/Disables the over/underruning to the default state? So if i only want to do an underruning, i set the default clock to 264 MHz check the underruning and set this value to 200 MHz. Right?)
[Windows Mobile Development and Hacking General] laggflor:
Thanks Oliy!

I'll try it this evening - maybe i find the time doing some measurements to post here tomorrow. I know some tools to measure battery consumption and speed.

Thanks to all liking my idea. I hope it has wished effects :D
[Windows Mobile Development and Hacking General] Oliy:
Hi topcaser,

The checkboxes to "enable" overclock and underclock don't work yet, the program will just take the values of overclock and underclock and use them whether the boxes are ticked or not.

When you start up and Omapclock sets the speed you want, if there is sufficient load then OmapScaler will not interfere with it.

I will consider adding the feature you want but my next goal is to write a very small and efficient program in C++ as mentioned earlier.

jwzg, at the moment because it has a GUI it will just keep running on its own. This is the first program I've built from scratch so I haven't researched that area yet!

I couldn't figure out how to make my program read the current clockspeed, so it just reports the number you enter in the settings. This is also the number sent to Omapclock in the command line, but as Omapclock sets and reads the clock slightly differently I think this will account for the difference.

Oliy
[Windows Mobile Development and Hacking General] Guybrush:
:cry: i have one problem... "idle time" and "sample time" are always the same.... if i use GetIdleTime it's always 0.... using QueryPerformanceCounter i have the same time of GetTickCount that i use for calc sample time, may u give me some tips ?
[Windows Mobile Development and Hacking General] Oliy:
private double getLoad( int sampleInterval )
{
int idleStart = GetIdleTime();

System.Int64 freq = 0;
if ( QueryPerformanceFrequency( ref freq ) != 0 )
{
System.Int64 startTime = 0;
System.Int64 endTime = 0;

if ( QueryPerformanceCounter( ref startTime ) != 0 )
{
System.Threading.Thread.Sleep( sampleInterval );
QueryPerformanceCounter( ref endTime );
int idleEnd = GetIdleTime();

System.Int64 sampleTime = ( endTime - startTime ) * 1000 / freq;
int idleTime = idleEnd - idleStart;
double percentIdle = ( idleTime / ( Double )sampleTime ) * 100;
double percentLoad = Math.Round( ( 100 - percentIdle ), 2 );

return percentLoad;
}
}
return 0.0;

}

If these methods are returning 0 then they are not supported.
[Windows Mobile Development and Hacking General] Guybrush:
i tried your function it's similar to mine but give me always the same result on me... 100% load CPU and i think it's not possible... :cry:
[Windows Mobile Development and Hacking General] Oliy:
What device are you using? Did you import the function from coredll.dll correctly?
[Windows Mobile Development and Hacking General] Guybrush:
I'm using an HTC Wizard.

[DllImport("CoreDll.dll")]

public static extern int QueryPerformanceFrequency(ref Int64 lpFrequency);

[DllImport("CoreDll.dll")]

public static extern int QueryPerformanceCounter(ref Int64 lpPerformanceCount);

[DllImport("CoreDll.dll")]

public static extern int GetIdleTime();
[Windows Mobile Development and Hacking General] Guybrush:
also OmapScaler sign 100% always... it's so strange... i don't have strange application on background
[Windows Mobile Development and Hacking General] Oliy:
That all seems correct, and I am running on a Wizard too and it appears to report the cpu load correctly (although I don't have anything to compare it to!).

Perhaps when I implement this in C++ it will work better, as these functions should be native.

Oliy
[Windows Mobile Development and Hacking General] Guybrush:
i did a softreset but always 100% usage CPU i have that running processes

filesys.exe

gwes.exe

shell32.exe

device.exe

PhotoContacts.exe

cprog.exe

services.exe

connmgr.exe

sddaemon.exe

mstli.exe

BTIcon.exe

srvtrust.exe

redial.exe

poutlook.exe

CapNotify.exe

Wifitray.exe

NK.exe

now i try to kill something to understand if one of them is using my CPU too much...
[Windows Mobile Development and Hacking General] Guybrush:
none... always the same on my wizard it signs always 100% CPU load...
[Windows Mobile Development and Hacking General] maddoc:
Measure CPU usage is not a problem, the problem is set the cpu clock !

I don't want to call an external EXE to do this, i would like to directly set the cpu clock in my application !
[Windows Mobile Development and Hacking General] laggflor:
Maybe in a second stage we should talk to the makers of omapclock, for now i think we should test this way.
[Windows Mobile Development and Hacking General] laggflor:
@Guybrush:

There must be a difference between the devices - is the ms .net framework correctly installed? Maybe you should compare firmware versions...

hope this helps ;-)
[Windows Mobile Development and Hacking General] Guybrush:
I have the last one 2.0 CF but these functions aren't .NET they are imported from coredll so I don't think it's a difference of framework remarkable...

Am I the only one with CPU load 100% const ?

my rom is 2.18.9.1 ITA
[Windows Mobile Development and Hacking General] laggflor:
I encountered another problem:

I used the following values:

Overclock to 240 MHz @ 80 %

Underclock to 100 MHz @ 30 %

Default speed is 200 MHz

Clocking down is working perfectly. If I start an Application that uses nearly 100 % the program tries to overclock. At this approach the device softresets.

Then I tried it with omapclock directly.

I can underclock from 240 MHz down to 100 MHz without problems.

If I try to overclock from 100 MHz to 240 MHz the device softresets again.

If I overclock in smaller steps it works without problems: 100 --> 150 --> 204 --> 240

It seems that we are not able to overclock the device in one big step.

I have an idea i want the community to think about - the application could work like this:

1. We define a lower and upper value for cpu-speed: (100 MHz - 240 MHz)

2. We define cpu-load-margins when to over- or underclock: (20 % - 80 %)

3. We define a percentage how much the app should over- or underclock: (30 %)

If these margins (2.) are reached for an defined number of periods (thresholds as in the v0.1) we raise/lower the cpu speed by the percentage in 3. (minimal by 1 MHz, maximal to the margins defined in 2.)

This is repeated until the cpu-load is in the margins defined in 2.

This makes sure ...

* that the cpu is only overclocked when needed

* that we do not overclock too big steps

I hope my thaughts are understandable ;-)

Coding it in C++ would be great - but I can live with the .NET-version either.
[Windows Mobile Development and Hacking General] laggflor:
As I am an supporter (not a programmer) excuse my loss of knowledge. I use a Charmer and get correct values.

As I'm not a programmer (I think i mentioned it some times now) I just post a thread I found on google:

http://groups.google.at/group/micro...GetIdleTime+100&rnum=4&hl=de#ab00fb5a0f41dfa6

they discuss a malfunction of these functions and a workaround.
[Windows Mobile Development and Hacking General] levenum:
Hi everybody!

I am not really interested in overclocking, as I just don't dare to do this to my devices, but I was curios about monitoring CPU load.

I haven't researched the subject so the code posted here was really interesting, but when I started coding I found there is one alternative.

Rather than using QueryPerformanceCounter you can use GetTickCount

which returns the number of milliseconds since system boot.

I think this technique will be more reliable as it doesn't depend on the timer frequency which varies dramatically from device to device.

Example: on my iPaq 1710 (Intel 200MHz) timer frequency is 201 KHz, while on the Jamin/Prophet (OMAP 195MHz) it is only 1KHz.

I attached a sample app I wrote to measure CPU load this way. If it helps those of you who get 100% all the time you can use the following code in the switching app:

startIdle = GetIdleTime();
startCount = GetTickCount();
Sleep(200);
endIdle = GetIdleTime();
endCount = GetTickCount();

By the way my formula is:

load = 100 - (DWORD)(100.0 * ((double)(endIdle - startIdle) / (endCount - startCount)));

Sorry I don't know C#, and the app is a bit fat because I was in a hurry and used MFC. But it is just for testing purposes.
[Windows Mobile Development and Hacking General] Guybrush:
this app give me constancy 100% CPU load on my wizard

Counter delta 201 ms

CPU Load 100%

Counter Sperrk 1.00 KHz

Idle delta 0 ms
[Windows Mobile Development and Hacking General] Oliy:
Hi Levenum,

The QueryPerformanceCounter defaults to GetTickCount if it is not overloaded, I believe.

Could you send me the source code of your app? I'm trying to write the basic monitor / overclocker in C++ but I don't know how to go about it for a mobile device - I have embedded VC++.

Thanks!

Oliy
[Windows Mobile Development and Hacking General] Guybrush:
:cry: i have to found another way to create a CPU monitor... my wizard sign always 100% CPU load... i checked that "Count delta" change when i start heavy applications.
[Windows Mobile Development and Hacking General] levenum:
The deltas are there to make sure I did not screw up with the formula.

(It's clean endIdle - startIdle)

I guess GetIdleTiem doesn't function properly / isn't implemented on your device.

I wonder if some KernelIOControl code could be used... Or maybe I am way off?
[Windows Mobile Development and Hacking General] Charlie Mouse:
It seems to work perfectly on my Prophet.

Underclocks to 150, defaults to 200 and overclocks to 240 without any problems or soft-resets.

Keep up the good work!!!!
[Windows Mobile Development and Hacking General] kevev:
Thanks Oliy! 8) Awsome battery life. All day and my battery is only at 50%!!!

I finally got it running stable. Here are my most efficient settings that are still stable and have no screen flicker.

Overclock-->200MHz

above-->75%

Underclock-->100MHz

below-->30%

Default speed-->150MHz

Update period-->2000ms

Clock threshold-->2 periods
[Windows Mobile Development and Hacking General] Guybrush:
i think it's my GetIdleTime() function bad... i tryed also with a hard reset but still 100% CPU load....
[Windows Mobile Development and Hacking General] cizake:
Just found out about this new app. I will give it try later today.
[Windows Mobile Development and Hacking General] Panja:
I'm trying it now but its not working for me...

Does omapscaler need to run in the background?

Because I'm using intelliclose to really close applications.
[Windows Mobile Development and Hacking General] laggflor:
Yes.
[Windows Mobile Development and Hacking General] laggflor:
May I ask which device you are using?

Is your cpu running at 150 MHz by default?

I tried to clock from 100 to 200 and had a soft reset.
[Windows Mobile Development and Hacking General] kevev:
I have a T-Mobile MDA(aka HTC Wizard).

Default is set to 150MHz but the device stay underclocked at 100MHz most of the time because of low cpu load. I am using the T-Mobile custom 2.24 rom.
[Windows Mobile Development and Hacking General] laggflor:
Well, this should be an OMAP-850 195MHz.

So you dont really overclock it much with 200 MHz maximum.

What happens if you run in underclocked mode, and then start an application which uses nearly 100 % cpu load for some seconds (at least 4 s with your config)

--- edited ---

Maybe an easier way to test: could you use omapclock.exe directly to switch to 100 MHz and afterwards directly to 200 MHz? Are there any problems?

There the device should go from 100 to 200 MHz in one step --> does this work on your device?

Did you encounter problems with other settings?

What cpu-stessing applications do you use?

I want to post some benchmarks here - but this is not possible when the device resets all the time.
[Windows Mobile Development and Hacking General] kyphur:
Gonna disable OMAP overclocker and see how this works...
[Windows Mobile Development and Hacking General] rkisling:
My experience

First .... thanks for all the work put into this app. I am trying it and it seems to be working fine. I can see the CPU demand change on the Main Omap Scaler screen and the underclock change to overclock etc, depending on the apps that are running. The current status in Omap clock mirrors that speed in Omapscaler as it changes (approximately).

Appears stable overclocking to 240; as long as I limit underclocking to 150 (normal at ~200). From the other posts, it seems that crashes are caused by too big a gap between the underclock speed and overclock speed.

I'll have to try this out for a few days and see how it works.
[Windows Mobile Development and Hacking General] kevev:
I have changed Update period to 1000ms. This helps prevent long hang times when cpu scales from 100MHz to 150MHz when opening an aplication. I also upgraed to the latest version of OmapClock "OmapClock_v0.2.zip". My Wizard will scale the cpu up to 200Mhz when load is up near 100%. Jumping from 100MHz to 200MHz usually crashes my device.

Yes I encountered problems with large clock jumps up or down. I tried setting low to 50MHz but device freezes(probably too low for radio :roll: ).

I set normal to 195MHz and High to 225HMz and device freezes.

For cpu-stress I use TCPMP playing streaming music. This test the radio, cpu, video, and sound at same time. I also used IE.

So it seems that large clock jumps(up or down) cause crashes. I believe that is OmapScaler had 4 or 5 cpu stepings we could clock higher and lower without crashing. :wink:
[Windows Mobile Development and Hacking General] Oliy:
I think I'll add an option to scale in steps, so that you can set something like this:

Max step: 20MHz

Then, if you are scaling from 200 to 240MHz, it will go 200 -> 220 -> 240.

My device happily goes from 150 -> 200 -> 240 but from the posts here it is obvious that other devices cannot cope with the jumps some people require.

I'll hopefully get this done soon, before the England match!
[Windows Mobile Development and Hacking General] thrawn:
Great tool Oily!!!

I just have one reservation:

Has anyone actually checked whether underclocking really saves battery?

I think the OMAP 850 already has cpu frequency and voltage scaling support in hardware check http://focus.ti.com/pdfs/wtbu/ti_wireless_solutions_guide_2006.pdf on pages 28 and 7.

But this tool is still great for enabling more speed just when it's demanded. What I am wondering is, whether the native frequency scaling of the OMAP still works after the frequency has been set with OmapClock :roll:
[Windows Mobile Development and Hacking General] e-x-e:
personally i think instead of making a program that does this,

just make a simple program that allows user to use softkey to change the clock speed or make a oampclock todays plugin would be enough

well, i guess i like total control of the device by myself
[Windows Mobile Development and Hacking General] Oliy:
v0.11 incorporating maxClockStep

I've added a "Max clock step" setting which allows you to specify the size of the step that the program can underclock / overclock in one go.

It should also prevent "cycling" where a device has too little power in underclocked mode but too much in default mode (or vice versa for overclocked), as it is able to pick a clock value in between underclocked and overclocked.

This has changed the clock value from a three state variable (underclocked, default clock, overclocked) to a sliding scale, where the nodes are determined by the clock step you set. The underclock and overclock values are now merely hard limits of the clock.

Note, the device will still have nodes at the three values you set, regardless of whether the clock step will divide into it without remainder.

If you don't want to use it, just set it to 1000 or something.

Please let me know if it works, I have tested it on my device using 5MHz steps etc and it appears to do so. Please also let me know if it solves the problem some people were having with large clock steps.
[Windows Mobile Development and Hacking General] laggflor:
This exists. just use a shortcut to omapclock and define the parameters there. The idea here is to switch automatically.

Interessting: My device is overclocking if I get a phone call :lol:
[Windows Mobile Development and Hacking General] laggflor:
Re: v0.11 incorporating maxClockStep

I just tried it with following settings:

Overclock = 240 MHz

above 80 %

Underclock = 80 MHz

below 20 %

Default Speed = 200 MHz

Max clock step = 50 MHz

Update period = 500 ms

Clock threshold = 2 periods

These settings work as wanted. What period is used to wait between clock steps? Is this the update period?

If so - could you define a second parameter? I think it should work if I set these intervals much lower but I do not want to set the Update period that low.

Thank you Oliy
[Windows Mobile Development and Hacking General] Guybrush:
There aren't alternative way to check CPU load without using GetIdleTime() ? On my ROM GetIdleTime seem not work :(

what about your coredll.dll ? my dll is 599608 bytes.
[Windows Mobile Development and Hacking General] laggflor:
Looks like it is not implemented on any device - try here:

http://www.eggheadcafe.com/ng/microsoft.public.windowsce.app.development/Jun2005/post23163404.asp
[Windows Mobile Development and Hacking General] laggflor:
Oliy good work so far. I think the application is fairly stable now. Thanks.

Could you implement an option to open the program without showing the gui?

Maybe as commandline param: omapscaler.exe /hidden

I will do some performance and (if I find the time) battery tests tomorrow morning. I'll post results as soon as possible.
[Windows Mobile Development and Hacking General] jmel:
dunno why, but the first version was more stable on my cingular 8125...

I switched back to it actually because of really really lagged type freezes... it wouldnt lock up per se, but it would slow badly enough that i couldnt do anything at all.

i'm really diggin the app tho, and would love to see what kinda of battery savings i can get out of this.
[Windows Mobile Development and Hacking General] oldsap:
i added omapclock.exe in my \windows folder, put the app in my storgae folder, then what do i do next?
[Windows Mobile Development and Hacking General] Turist:
Re: v0.11 incorporating maxClockStep

The same worked for me. Thanks a lot Oliy!

But it`s there is some batterylife statistics on downclocked CPU. i actually dont need overclocking part of this app (play games and watch movies on communicator? huh...), but i`d like to have possibility to spare a couple of hours by downclock.