473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Cpu Usage (Second Posting)

Hi, all!

Thanks a lot for your responses. We are using the GetProcessTimes for
calculation of cpu usage. We are using the following calcution for get cpu
usage:

(((NUserTime - OUserTime) + (NKernelTime - OKernelTime))*100) / (NTime -
OTime)/NumProcessors,
where
NUserTime - is the user time during process execution
OUserTime - is the last user time during process execution
NKernelTime - is the kernel time during process execution
OKernelTime- is the kernel time during process execution
NTime - is the current time
OTime - is the last time
NumProcessors - is the number of processors.

Are we right?

Thanks a lot in advance.

Best regards,
Paulo Eduardo


Nov 17 '05 #1
2 1105
Paulo Eduardo <Pa**********@discussions.microsoft.com> wrote:
[...]
Are we right?
That depends on what you want to do.
From what I read in the other thread, you want
your thread/process to never use more than 20%
of the CPU time. Actually, as a user, I wouldn't
want this. What I wanted instead is that it uses
all idle time. Why throttle it back if my machine
sits around idly?
Which is where setting priorities comes in. If my
machine is busy, it will prevent a low-priority
thread/process from getting much CPU time. if my
machine is idle, it will even give CPU time to
the low-priority threads/processes.
That's what the OS' scheduler is for.
Thanks a lot in advance.

Best regards,
Paulo Eduardo


Schobi

--
Sp******@gmx.de is never read
I'm Schobi at suespammers dot org

"Coming back to where you started is not the same as never leaving"
Terry Pratchett
Nov 17 '05 #2
Paulo Eduardo <Pa**********@discussions.microsoft.com> wrote:
[...]
Are we right?
That depends on what you want to do.
From what I read in the other thread, you want
your thread/process to never use more than 20%
of the CPU time. Actually, as a user, I wouldn't
want this. What I wanted instead is that it uses
all idle time. Why throttle it back if my machine
sits around idly?
Which is where setting priorities comes in. If my
machine is busy, it will prevent a low-priority
thread/process from getting much CPU time. if my
machine is idle, it will even give CPU time to
the low-priority threads/processes.
That's what the OS' scheduler is for.
Thanks a lot in advance.

Best regards,
Paulo Eduardo


Schobi

--
Sp******@gmx.de is never read
I'm Schobi at suespammers dot org

"Coming back to where you started is not the same as never leaving"
Terry Pratchett
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Murat Tasan | last post by:
hi, i have a java application that can be fairly memory intensive. so, when i run the program, i use the -Xmx option to prevent out of memory errors. in particular, i have been using -Xmx512m,...
17
by: Eternally | last post by:
Hey folks, I'm writing a simple C++ application which runs continuously. I'm running the program from the command line in Cygwin from XP, and it's cross-compatible with Linux. While running...
2
by: JosR | last post by:
I have a memory problem when running a VB.Net application. The application uses a from frmMain from which another form can be opened: Private Sub OpenTheNewForm() dim frm as New frmSecondform...
3
by: Ian Taite | last post by:
Hello, I'm exploring why one of my C# .NET apps has "high" memory usage, and whether I can reduce the memory usage. I have an app that wakes up and processes text files into a database...
26
by: Bruno Jouhier [MVP] | last post by:
I'm currently experiencing a strange phenomenon: At my Office, Visual Studio takes a very long time to compile our solution (more than 1 minute for the first project). At home, Visual Studio...
7
by: LBT | last post by:
I have a window service written using VB.NET. This window service will scan folders for file and grab the file content to be inserted to SQL Server on file detection. There are altogether 18...
5
by: Dave | last post by:
Hi, In awk I can do this: var1="x"; temp = sprintf("Variable 1: %s Variable 2: %%s", var1); # now the value of temp is "Variable 1: x Variable 2: %s" var2="y"; printf(temp,var2);
6
by: =?Utf-8?B?bGlnaHRkb2xs?= | last post by:
Hello everyone. i want to know how to decrease the cpu usage in my program. i have to update quickly many data on gui, so i tried to decrease the cpu usage on gui but i couldn't solve the...
26
by: rao | last post by:
On some of the compilers integer size is 2 and on some other it is 4 bytes. My doubt is who decides the size of the integer? is it plainly the compiler? Does OS or Processor also has any control...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.