Math question....
Posted: Tue Jun 25, 2019 4:12 pm
So, I was doodling around with a math problem, and I am not sure I understand it correctly, so even though I got a result, I was hoping someone could illustrate where I might be going wrong, if I am going wrong.
The numbers in the equation are for calculating the cpu load on linux. I read (and think I understand) the explanation given on the pages I've read in this area.
The numbers for the equation come in from one line in a file. The equation is laid out like this:
The first part, 842486413, comes from item 4 of the second part. Rather than put the items in the parts of the equation, I was trying to think of another way to arrive at the same answer. This is the code I used to put it together:
So am I completely missing it, or does that look like it should arrive at the correct answer? And yes, I am sure there are better ways to do it hee hee, but right now I am just trying to arrive at a level of understanding.
The numbers in the equation are for calculating the cpu load on linux. I read (and think I understand) the explanation given on the pages I've read in this area.
The numbers for the equation come in from one line in a file. The equation is laid out like this:
Code: Select all
X % = ( 842486413 * 100 ) / ( 79242 + 0 + 74306 + 842486413 + 756859 + 6140 + 67701 + 0 ) = ( 842486413100 ) / ( 843470661 ) = 99.8833 %
Code: Select all
on checkProc
//other code unrelated...
put line 1 of url("File:~/theFile") into tmpProc # the file changes constantly...
set the itemDelimiter to space
put (item 2 to -1 of line 1 of tmpProc) into tmpAvg
delete character 1 of tmpAvg # space I don't want converted to comma...
replace space with comma in tmpAvg
put sum(tmpAvg) into tmpAvgSum # total of the 2nd part of the equation...
set the itemDelimiter to comma
put item 4 of tmpAvg *100 into tmpAvgIdle # first part of the equation....
put tmpAvgIdle/ tmpAvgSum into tmpAvgPrcnt # the part I'm not sure is right...
end checkProc