[rrd-users] Re: Graph problem when using a more complicated CDEF

Alex van den Bogaerdt alex at ergens.op.het.net
Wed Apr 16 01:08:13 MEST 2003


On Tue, Apr 15, 2003 at 09:51:32PM +0200, Bas Rijniersce wrote:

> I want to plot an area memtot and stack swaptot on it
> Over that i draw a line2 of (swaptot-swapfree)+(memtot-memfree)

[...]

> As a test I used CDEF:memuse=memtot,memfree,- on the stacked areas, that
> worked fine. But when I change the statement to:
> CDEF:memuse=memfree,swapfree,memtot,swaptot,+,-,-


Process the function when you put them on the stack:


push memfree:  memfree                              -> no action
push swapfree: memfree,swapfree                     -> no action
push memtot:   memfree,swapfree,memtot              -> no action
push swaptot:  memfree,swapfree,memtot,swaptot      -> no action
push +:        memfree,swapfree,memtot,swaptot,+    -> pull two values, add, push back
result:        memfree,swapfree,result1             where result1 ::= memtot+swaptot
push -:        memfree,swapfree,result1,-           -> pull two values, subtract, push back
result:        memfree,result2                      where result2 ::= swapfree-result1
push -:        memfree,result2,-                    -> pull two, subtract, push
end result:    result3                              where result3 ::= memfree-result2

Your CDEF does:  memfree-(swapfree-(memtot+swaptot))
which is memfree-(swapfree-memtot-swaptot)
which is memfree-swapfree+memtot+swaptot

which is:           memtot+swaptot  +   memfree   -  swapfree
whereas you want:   memtot+swaptot  -   memfree   -  swapfree


Your function into CDEF:

(swaptot-swapfree)+(memtot-memfree)

First things first; between brackets:
   result1   swaptot,swapfree,-
   result2   memtot,memfree,-

Then the addition:
   result1,result2,+

complete CDEF when substituted:

   swaptot,swapfree,-,memtot,memfree,-,+


Other calculation, same result:

You want:   (memtot+swaptot) - (memfree+swapfree)

   memtot,swaptot,+,memfree,swapfree,+,-

You want:   (memtot+swaptot) - (memfree+swapfree)
this is:    memtot+swaptot - memfree - swapfree

   memtot,swaptot,+,memfree,-,swapfree,-

You want:   (memtot+swaptot) - (memfree+swapfree)
this is:    memtot - memfree + swaptot - swapfree

   memtot,memfree,-,swaptot,+,swapfree,-

As you can see:   a,b,-  means (a-b)


NOTE:  I didn't verify my results.  If there is an error or an ommision,
just read past it and try to see the big picture.  I need no lectures.
This is not intended for the poster of *this* question by the way.

HTH
Alex
-- 
Much of what looks like rudeness in hacker circles is not intended to give
offence. Rather, it's the product of the direct, cut-through-the-bullshit
communications style that is natural to people who are more concerned about
solving problems than making others feel warm and fuzzy.

http://www.tuxedo.org/~esr/faqs/smart-questions.html

--
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