[rrd-users] Re: Display and all...
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:
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:
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)?
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
More information about the rrd-users