My program take 40 % of the CPU usage ( PIII 500 )
I want to put an option in the program:
Maximum CPU usage: X %
is it possible ??
Printable View
My program take 40 % of the CPU usage ( PIII 500 )
I want to put an option in the program:
Maximum CPU usage: X %
is it possible ??
please..
if it's not possible, just confirm !
You can't, sorry.
Maybe, maybe if you check the CPU usage regulary and then slow down the usage if it's over a specified rate
I think it's very hard to make, but it's possible. Your program must have some sort of loop that does the main thing the program needs to do. On first run, execute the loop for exactly 1 second and see how many times it passsed the loop. Now you can put a sleep command in your program for sometime that you must calculate on the first run.
Sorry if I explained it bad, my English is not very good.
Any loops or other coding that you do in VB will use CPU, no matter what you do.
Specially if you do any kind of database development.
Sleep API, will that use CPU? just curious, i don't have vb on this comp so i can't test...
It that's not the case then maybe use SetTimer to call an event for a small interval and execute a small amount of code, would be best with a loop that exits when gettickcount reaches a value each time
Also thank'x anyway ..
I found another solution .
jsut réduce the code and if the long one is really neacesairy ,take it.. else do the sort one..
double size but work good..