[rrd-users] reuse of CDEF var for use in loops

Simon Hobson linux at thehobsons.co.uk
Thu Nov 17 10:06:15 CET 2011


josef wrote:

>i have created this ressource wasting sript, but it works, and i want to
>optimize !
>
>$prev=0;
>for ( $x  .... ){
>  if  ($x > 0){
>     CDEF:sum$x=sum$prev,ds$x,+
>     $prev++;
>} else {
>     CDEF:sum$x=ds$x,1,*
>}

That's about what I do. I use Bash and rrdcgi, but the basic process 
is the same.

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the rrd-users mailing list