[rrd-users] Re: CDEF, RPN and multiple calculations using paranthesis

Alex van den Bogaerdt alex at ergens.op.HET.NET
Tue Jun 11 15:52:25 MEST 2002


Gerhard Ecaroh Froehlich wrote:

> I have to sum up Oracle's cachehitratio. To get an result in percent i have to
> calculate (the real world values) from snmpget:
> 
> a = consistentgets = 3314928
> b = blockgets = 263352
> c = phyreads = 173783
> 
> ( ( 3314928 + 263352 - 173783 ) / (  3314928 + 263352 ) ) * 100 = 95 

> Step:	1|2|3|4|5|6|7|8|9| 10|11
> ---------|-|-|-|-|-|-|-|-|---|--
> RPN:	a,b,+,c,-,a,b,+,/,100,*

(  (a+b-c) / (a+b)  ) * 100

      p  /  q  * 100

result=p,q,/,100,*

fill in p and q:

p:  a,b,+,c,-
q:  a,b,+

result = a,b,+,c,-,a,b,+,/,100,*

You seem to do alright so far.

> 
> 0	||
> 1       |3314928|   
> 2       |3314928|263352|
> 3       |3314928|263352|+|
> 4       |3578280|173783|
> 5       |3578280|173783|-|
> 6       |3404497|3314928|
> 7       |3404497|3314928|263352|
> 8       |3404497|173783|263352|+|	# Processing with 3 in stack?
> 9       |3667849|437135|/|
> 10	|8.39|100|			# which should be wrong
> 11	|8.39|100|*
> 12	|839|				# PERCENT

this is wrong.  See what happens:

result = a,b,+,c,-,a,b,+,/,100,*
a == 3314928
b ==  263352
c ==  173783

action      content of stack            numeric
--------    ----------------            --------
init ""
push "a"    a                           3314928
push "b"    a,b                         3314928,263352
cmd  "+"    (a+b)                       3578280
push "c"    (a+b),c                     3578280,173783
cmd  "-"    (a+b-c)                     3404497
push "a"    (a+b-c),a                   3404497,3314928
push "b"    (a+b-c),a,b                 3404497,3314928,263352
cmd  "+"    (a+b-c),(a+b)               3404497,3578280
cmd  "/"    ((a+b-c)/(a+b))             0.9514339291
push 100    ((a+b-c)/(a+b)),100		0.9514339291,100
cmd  "*"    (((a+b-c)/(a+b))*100)       95.1433929100

> This is not the expected 95%.

this is :)
-- 
   __________________________________________________________________
 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+
| Technical questions sent directly to me will be nuked. Use the list. | 
+----------------------------------------------------------------------+
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |
+----------------------------------------------------------------------+

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list