Which cpu usage is correct?? plz help

hi all,
im using suse 11.1 installed in core 2 duo processor…my laptop is an ASUS K501N series laptop. Im having a dual boot with windows XP and OpenSUSE 11.1.(hope this info help)…im trying to obtain the cpu usage for my program from suse 11.1, so i tried using the system monitor application and it shows that the CPU usage for my program is 49%…the problem is, when i type the “top” command in the console, the CPU usage for my program shows a shocking 99%…i even tried displaying the system monitor and the “Top” command together, but the cpu usage for my program still displays 49%and the top is 99%…My question is?

1.Why is there a difference on CPU percentage between the “top” command display and the system monitor display ?
2.Which CPU Percentage should i observe?
3.Does Core 2 duo processor caused it to differ?
4.Does linux (SUSE 11.1) only uses 1 processor?
5.If No.4 Question ans is Yes, how to “ask”(any perticular command) to use both processor?
6.How to obtain the CPU usage for a perticular program?

hope any1 can help me in this matter?:wink:

Run top, then press ‘1’ to view processor use individually.

Trust top more than GUI apps - it’s old, low level, and close to foolproof.

What is ‘your program’? Sounds like it could be a configuration or graphics error. Maybe try creating a new user in YaST - does this user suffer the same problem?

Run top, then press ‘1’ to view processor use individually.

Trust top more than GUI apps - it’s old, low level, and close to foolproof.

What is ‘your program’? Sounds like it could be a configuration or graphics error. Maybe try creating a new user in YaST - does this user suffer the same problem?

My program is a virtual architecture that i run in both windows and suse to evaluate its performance in terms of memory usage and cpu usage between both OS…in windows i just use the task manager to get its performance but in suse…im having a bit of problem of which reading should i take??

can u answer other of my questions??
Thabk Yourotfl!

Top is the one to go with - and it will tell you how much a program is using (each thing in the list is a task), and on which cpu (just press ‘1’).

htop does the same thing, but prettier.

I’m afraid I have no idea why other system monitors come out with different load levels.

I still suggest creating a new user, and if that doesn’t work, maybe trying to check graphics - disable desktop effects, try a different driver…

gomz,

Confuseling has given you good advice in two responses, so far…
i’ll try my best to help you with the following six questions and
another you mentioned in your second post…

>> 1.Why is there a difference on CPU percentage between the “top” command
>> display and the system monitor display ?

i believe the GUI system monitor display you see (in both Windows and
Linux) is of the ‘total load’…

however, the top display can be for the two different cores…

in top, one core might be shown at 99% and the other at 0% and the GUI
system say the load 49% and all three observations be absolutely
correct (99 + 0 = 99, since and 99 divided by 2 = 49.5 the average
load of both cores is ~49%)

>> 2.Which CPU Percentage should i observe?

that depends on how the program you are trying to observe is
written…if it is specifically written with the capability to spawn
separate threads to do different things at the same time on different
CPUs/cores, then it might have some parts of the program on one core,
and other parts of the program running on the other core…in that
case you would need to look at both cores at the same instant to know
the total load…

however, if it is a simple program not written for multiprocessors, or
running in only one thread then you can expect it to be on only one core…

>> 3.Does Core 2 duo processor caused it to differ?

yes and no,

no: the existence of two cores does not cause the observed
difference, it only allows it to occur IF the program can take
advantage of multi-cores, and is in that part of the execution in
which multi-cores are needed…

yes: if there were only one core there could be no observed difference
regardless of the way the program is written/executed…

>> 4.Does linux (SUSE 11.1) only uses 1 processor?

no, the kernel in openSUSE 11.1 will automatically see and address
many cores (i forget how many, over 64 i think)…

>> 5.If No.4 Question ans is Yes, how to “ask”(any perticular command) to
>> use both processor?

it is automatic

>> 6.How to obtain the CPU usage for a perticular program?

that depends on the program…if it is a single threaded program you
can look in top at the loaded core and then do the arithmetic to
determine the percentage of the total cycles which are being
allocated; or, if it is a multi-threaded, symmetrical multiprocessing
program you may look at the GUI

to do more you would need better tools than just top or the GUI system
monitor–because very seldom is only one program running (i mean,
think about the parts of the cores drawing windows, checking to see if
there have been mouse or keyboard inputs, generating sounds, entering
data into logs, checking to see if there is new mail, or just keeping
the correct time…to know the actual program needs you have to
factor out all those background variables…not so easy to do, i mean
just look at the very long list of stuff going on in top!

and, in one posting you say: “in windows i just use the task manager
to get its performance but in suse…im having a bit of problem of
which reading should i take?” which i would answer this way: since you
are reading the Windows Task Manager (i’ve never seen one, but i
assume) it is showing the average total use as will the GUI system
monitor…then you should use those…

HOWEVER, since you are not bothering to try to factor out all of the
background things going on in either Windows OR openSUSE you need to
have some idea of when to take your readings…because if you happen
to look at Linux when the system is quiet, and then compare it to the
observation when Windows is busy (say) calling home to tell Bill if
you have stolen any of his software…then you will think that Linux is
much more efficient (which is true)…but, if you check Linux while it
its beagle is indexing your home you will think it is a dog (which it
is when beagle is sniffing)…

therefore, the best way to get an idea of the relative efficiency of
windows vs linux is to search for scientifically sound
studies…using a wide variety of programs…because it would be
relatively easy to build a program which would make one system look
better than the other, despite their actual relative merits…

ok?


palladium

Thank you Confuseling for your ideas and advice…and thanx a million to Palladium…you have indeed answered my questions…thank you for your time and detailed answers…tc
-Gomz-rotfl!:wink:

happy to be of service.


palladium