[rrd-users] Re: Display and all...

Tobias Weingartner weingart at cs.ualberta.ca
Thu Mar 2 20:20:05 MET 2000


On Thursday, March 2, Tobias Weingartner wrote:
> 
> An "interesting" generalization of the above, would be to allow the possibility
> of having an arbitrary number of CDEF/rpn expressions to be run, one after the
> other.  Then by adding a "VALUE" operator, which pushes the VALUE of the value
> of an RRA at a certain position onto the stack (relative to current position,
> which is signified by the number 0), you could implement running averages using
> the CDEF/rpn construct.

After spouting off, I took another look at the CDEF/rpn parser/exec code.
I think it should be possible to extend the parsing of the vname parts,
to be able to do an optional "[number]" to come after it.  So you should
be able to do something like:

DEF:vname1=rrd:ds-name:CF
CDEF:vname2=vname1[0],2,*

Where the number (0 in this case) would be a relative position from the
current value.  (IE: -1 means previous value, +1 the next value).  At
this point you can then implement weighted averaging such as:

CDEF:vname2=vname1[-3],0.1,*,vname1[-2],0.2,*,vname1[-1],0.3,*,vname1,0.5,*,
+,+,+,+,etc...

I believe that the rpnp_t will have to change slightly (so you can store
the offset), and also the scanning of the vnames (to add in the scanning
and parsing of the offsets).  In other words, the changes to str2rpn()
seem to be minimal...

Then later in the actual running of the RPN expression, the offsets would
have to be taken into account.  There a slightly larger reworking may be
needed.  So, data_calc() needs a reworking, the depth of which depends a
little on the extent to which you wish this to work "correctly".  The first
part that looks like it needs a little rework, is the part that find the
LCD of all step sized of the data sources involved.  In particular the start
and end points may need to be modified to take into account the max/min
offsets given to vars in the CDEF.

Then a little further down, the 'case OP_VARIABLE' needs to take into account
which value it pushes onto the stack, based on the offset given in the CDEF.

Could someone who knows the *im->gdes[gdi].rpnp[rpi].data a little better
comment?  Would doing something like: '*(im->gdes[gdi.rpnp[rpi].data+offset)'
do the work (with appropriate bounds checking of course)?

--Toby.

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



More information about the rrd-users mailing list