Page 2 of 3
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 6:49 am
by Love4Boobies
bwat wrote:Love4Boobies wrote:
Definitions are defined, not proved.
So we'll just take your word for it, take it on faith?
Sigh. Are you on drugs? What is there to believe? Definitions are simply accepted. They are conventions.
bwat wrote:You were offered an argument as it was assumed you could handle reasoned discourse.
I was not offered an argument but also a definiton. Here's a summary of what happened: I provided my definition, you contradicted me and provided yours. I concluded explicitly saying those were two different
bookkeeping policies useful in different situations. Then you started being annoying, repeating your definition over and over, as if it weren't already clear what it was in the first place, almost demanding that I only measure load the way you want me to. I went out of my way to give an example of why these bookkeeping policies have different advantages. You went on to combine these policies: measuring the way I did and using the results the way yours were meant to, proving that my definition is inconsistent with your usage of it---big surprise.
If you could improve your reading comprehension, that'd be awesome!
bwat wrote:Instead of your self proclaimed axiomatic definitions, how about reasoned argument? Instead of specious analogical reasoning, how about logic?
I hope you realize that you are guilty of the same charge.
bwat wrote:I claimed policy was non-essential. Do you agree? If not prove me wrong. Can you tell us how policy is essential in the determination of idle CPU cycles?
Here you go again combining my bookkeeping policy that doesn't measure CPU cycles (i.e., your "non-axiomatic" definition of load) with your intentions (i.e., measuring CPU cycles).
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 7:01 am
by bwat
Love4Boobies wrote:
Sigh. Are you on drugs?
Love4Boobies wrote:
If you could improve your reading comprehension, that'd be awesome!
Two ad hominems in a single post. You lack argument. You offer nothing.
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 7:03 am
by Love4Boobies
I never claimed to offer arguments. I'm simply saying that we're talking about two different things. What arguments do you offer?
Also, those weren't ad hominems. Those were a mild insult and a suggestion. An "ad hominem" is supposedly argumentative.
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 7:42 am
by bwat
Love4Boobies wrote:I never claimed to offer arguments. I'm simply saying that we're talking about two different things. What arguments do you offer?
Also, those weren't ad hominems. Those were a mild insult and a suggestion. An "ad hominem" is supposedly argumentative.
Then let us all know you by your insults and lack of reasoned argument.
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 8:13 am
by Love4Boobies
You realized you're just inconsistent, right?
bwat wrote:Brendan wrote:Hi,
It depends which load you're measuring. There's "global CPU load" (time CPU spends not idle) that should include everything except idle time. There's also "per-process CPU load", which may or may not include CPU time consumed by other things on behalf of that process.
Yes, of course, it is a question of definition. You are quite correct to bring this up.
What I brought up were yet different kinds of loads. There is nothing to argument. These different kinds of loads represent different bookkeeping policies.
Was your last reply an ad hominem? Because I don't see what relevance who I am has... Either way, you purposely avoided the question regarding your own arguments.
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 8:22 am
by Combuster
bwat wrote:Love4Boobies wrote:Definitions are defined, not proved.
So we'll just take your word for it, take it on faith?
How often have you defined the variable "x"? or "main"? I'm sure the majority of your own definitions are contradicting each other.
i) But a load of 0% will also indicate idleness which means your method will lead to a possible ambiguous report. My method does not.
Not in the definition of load given.
ii) A load of 100% indicates lack of spare capacity and nothing else. What is being processed does not alter load, the fact it is being processed does.
So the fact that I do protein folding means my $800 computer has absolutely no clock cycles to spare for anything else?
iii) A given CPU load is the ratio of use time to idle time, that's it.
And wikipedia says it's something else. Do you still want to stick to absolutes and lose the credibility race?
It has nothing to do with policy. If you had no spare cycles and you altered policy then you would still have no spare cycles. In fact we can generalise, if you had X% of CPU cycles free then a change in policy wouldn't alter that X%. We can therefore draw the conclusion that policy is non-essential. It doesn't need to be understood, it can be safely ignored.
Except that policy changes do affect that X% in several direct and indirect ways, and the rest of your argument is therefore void.
I'm sure
your definition of troll doesn't include yourself, but the various ones several
other people are using will.
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 8:28 am
by bwat
Love4Boobies wrote:Was your last reply an ad hominem? Because I don't see what relevance who I am has... Either way, you purposely avoided the question regarding your own arguments.
Note that I wrote nothing that you didn't claim yourself, i.e., you admit to a lack of argument and making insulting comments. All I added was we have all had a chance to get to know you better.
I'm not continuing with this, yes because of your insults, but mostly because you offer no reasoned argument - it makes for sterile enquiry. I hope you don't take it the wrong way.
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 9:01 am
by Love4Boobies
I'm sorry if asking whether you are on drugs insulted you but let me get one thing straight. Although you knew that arguments were not relevant to the conversation, you contradicted me numerous times and asked me for arguments anyway. Then, you announced that you are done with the conversation because I had no arguments. So you started an illogical fight (because arguments were not relevant and because you were in the same position) out of thin air and I'm the bad guy? Next time, don't push your views, contradict, and claim you are right in such a scenario because that also tells something about you.
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 10:10 am
by bwat
Combuster wrote:
I'm sure your definition of troll doesn't include yourself, but the various ones several other people are using will.
Another ad hominem but this time you're using
several other people to strengthen your argument.
Why don't you just come straight out and call me a troll? Why do you need to invent these
several other people in your head to attack someone you've never even met, or do these people have names?
Why are you emotionally attached to this argument?
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 10:21 am
by Love4Boobies
Well, he is one and I am obviously another. So he is technically correct. There's at least another person that I know of who thinks so but I think the next step should be locking this thread, not starting a poll.
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 10:25 am
by bwat
Love4Boobies wrote:Well, he is one and I am obviously another. So he is technically correct. There's at least another person that I know of who thinks so but I think the next step should be locking this thread, not starting a poll.
The
axis of abuse has two members. Any more?
Edit: Love4Boobies was decent enough to throw his insults in first person. Doing it by proxy like Combuster is the mark of an insecure individual.
Edit2: I see you apologised Love4Boobies. Apology accepted. I'll get back to you with answers to your questions later today or tomorrow if I have time.
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 11:46 am
by tsdnz
Hi, all, I did not expect such a response.
It is a pitty there is such fighting and arguing.
Good to see I missed the global CPU counter for halts.
I will google this (Unless someone can point me in the right direction)
Thanks.
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 12:30 pm
by bwat
Combuster wrote:
bwat wrote:So we'll just take your word for it, take it on faith?
How often have you defined the variable "x"? or "main"? I'm sure the majority of your own definitions are contradicting each other.
Eh? In the case of a variable it isn't defined, it is quantified - in the case of anything I've written, universally qualified. Where does main come from? If you're
pretty sure then point it out, why wouldn't you?
Combuster wrote:
bwat wrote:i) But a load of 0% will also indicate idleness which means your method will lead to a possible ambiguous report. My method does not.
Not in the definition of load given.
No. Just no. If the processor was totally quiescent what would the load be? If the processor only dealt with interrupt service routines, what would the load be? With my method both are different. In Love4Boobies they would both be 0%. Please prove otherwise.
Combuster wrote:
bwat wrote:ii) A load of 100% indicates lack of spare capacity and nothing else. What is being processed does not alter load, the fact it is being processed does.
So the fact that I do protein folding means my $800 computer has absolutely no clock cycles to spare for anything else?
Cost of machine and application executed makes no difference. The fact that the machine is executing application instructions is what matters. There is no need to cloud your argument with these non-essential details.
Combuster wrote:
bwat wrote:iii) A given CPU load is the ratio of use time to idle time, that's it.
And wikipedia says it's something else. Do you still want to stick to absolutes and lose the credibility race?
Firstly, please explain what a credibility race is.
Secondly, you've made an appeal to authority using Wikipedia! Have you read what the pages on CPU load and CPU usage have to say? Just for starters they're UNIX specific, which is of no help to the original poster.
Combuster wrote:
bwat wrote:It has nothing to do with policy. If you had no spare cycles and you altered policy then you would still have no spare cycles. In fact we can generalise, if you had X% of CPU cycles free then a change in policy wouldn't alter that X%. We can therefore draw the conclusion that policy is non-essential. It doesn't need to be understood, it can be safely ignored.
Except that policy changes do affect that X% in several direct and indirect ways, and the rest of your argument is therefore void.
No it doesn't. The idle cycles haven't disappeared. The policy doesn't create new idle cycles either. Do you claim that policy creates or eliminates idle cycles? How else can idle cycles be created/eliminated?
Also, what is a
void argument? I've never heard of such a thing. I'm telling you here and now my argument is sound - it's the simplest of deductive arguments, just one application of modus ponens. You may not agree with my premise, and if so the say so, but what does
void mean??? Where is the problem with the argument? Point it out.
Combuster wrote:I'm sure your definition of troll doesn't include yourself, but the various ones several other people are using will.
I've dealt with this elsewhere. Note that I've never brought your character into question. If you want to continue with the insults then don't bother replying as your words will be falling on deaf ears. You'll have to find someone else to abuse.
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 3:43 pm
by Brendan
Hi,
bwat wrote:Brendan wrote:
Of course for most OS's, both "global CPU load" and "per process CPU load" is no better than a crude estimate, and is only ever accurate if you're lucky (in a "stopped clock is right twice a day" way).
Do you not think that with a timer with a period that was both relatively short and relatively prime to the system clock that the global CPU load result would be very accurate. On 32-bit machines with floats or with fixed-point reals, accuracy would be fairly good too.
Let's start by defining what you mean by "global CPU load". In my opinion, global CPU load is the actual (measured) amount of work the CPUs did in a specific period of time divided by the maximum amount of work the CPUs could have done in that same specific period of time. For a simple example, if there's only one CPU that was able to execute 2 billion instructions in a second but it only executed 1 billion instructions in that second, then the CPU was at 50% load for that second.
Let's define "maximum amount of work the CPU could have done". Is it constant? Surely if a CPU is temporarily over-clocked (e.g. Intel's "Turbo Boost") then the maximum amount of work the CPU can do increases; and if a CPU overheats and goes into hardware enforced thermal throttling mode the maximum amount of work the CPU can do will decrease.
Now; let's look at measuring the amount of work the CPU/s did. Given that the maximum amount of work that a CPU can do in a fixed length of time varies; it makes absolutely no sense to measure time and use that to estimate the amount of work done. Measuring "instructions retired" is a much better way to estimate work done, but different instructions take different amount of work, so this isn't ideal either. Measuring "micro-ops retired" is a better way, but that still isn't 100% accurate (as different micro-ops also represent different amounts of actual work). The most accurate way might be to determine the amount of work each instruction does in advance, then (as instructions are being executed) add the pre-determined "amount of work" for each individual instruction to a running total. Sadly, this is not practical (the overhead would be extreme). So; this leaves "micro-ops retired" as the most accurate way to estimate work done that is actually practical.
If "micro-ops retired" is being used to estimate (not measure) work done; then to avoid mixing different units, it makes a sense if "maximum number of micro-ops the CPU could've executed" is used instead of "the maximum amount of work the CPU could have done".
Finally; let's look at granularity. More correctly, let's look in the opposite direction to granularity. Instead of estimating average CPU load at regular (or irregular) intervals of time, you only need to estimate CPU load when maximum amount of work the CPU can do changes or when CPU load is being reported to user-space. Basically, you want some sort of log that might look like this:
- for the first 1234 nanoseconds, 567 micro-ops where retired and a maximum of 890 micro-ops could've been retired (63.70% CPU load for 1234 ns), then the CPU got "turboboost" (ending this period)
- while in "turboboost", 1000 micro-ops where retired and a maximum of 2000 micro-ops could've been retired (50% CPU load for 2345 ns), then the CPU overheated and got throttled (ending this period)
- while throttled, for the next 3333 nanoseconds 670 micro-ops where retired and a maximum of 670 micro-ops could've been retired (100% CPU load for 3333 ns), then some process asked for CPU load (ending this period)
- while still throttled, for the next 111 nanoseconds 8 micro-ops where retired and a maximum of 22 micro-ops could've been retired (36.36% CPU load for 111 ns), then the CPU returned to nominal speed (ending this period).
From a log like this, you can calculate the average load for any specific period of time without any accuracy loss caused by granularity. Of course you'd probably want a log like that for each CPU, so you can find the CPU load for individual CPUs and also find the total CPU load for all CPUs combined.
bwat wrote:Do you not think that with a timer with a period that was both relatively short and relatively prime to the system clock that the global CPU load result would be very accurate.
No, this would fail to meet my definition of "very accurate" by several orders of magnitude. It's what I called a "crude estimate" previously.
Of course I should point out that a crude estimate is often good enough to satisfy the requirements - it's hard to know how accurate the estimate needs to be without knowing what the requirements are. Often the only requirement is "make the stupid end-user think they've been given a useful statistic so they can feel good and ignore it", where any method of generating a number that seems to fluctuate would probably be good enough, even if it has nothing to do with CPU load at all (e.g. maybe just use CPU temperature and pretend it's CPU load - "Wow - our computer does less work on a cold night!"
).
Cheers,
Brendan
Re: Calculate CPU Load
Posted: Mon Oct 28, 2013 5:14 pm
by tsdnz
Cheers everyone, sounds like my code will do.
Basically I keep a time of maximum and slowly decrease it and compare it against actual.
If actual > maximum then maximum = actual.
I set maximum to a minimum calculated value.
This works when cpu is boosted etc.
I show each CPU and a total in the range 0 - 15 = 0 - F.
A basic lookup table.
Thanks for all the responses.