Code

Imported upstream SVN snapshot 1.4~rc2+20090928.
[pkg-rrdtool.git] / doc / rrdgraph_rpn.1
1 .\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.08)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 'br\}
42 .\"
43 .\" Escape single quotes in literal strings from groff's Unicode transform.
44 .ie \n(.g .ds Aq \(aq
45 .el       .ds Aq '
46 .\"
47 .\" If the F register is turned on, we'll generate index entries on stderr for
48 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
49 .\" entries marked with X<> in POD.  Of course, you'll have to process the
50 .\" output yourself in some meaningful fashion.
51 .ie \nF \{\
52 .    de IX
53 .    tm Index:\\$1\t\\n%\t"\\$2"
54 ..
55 .    nr % 0
56 .    rr F
57 .\}
58 .el \{\
59 .    de IX
60 ..
61 .\}
62 .\"
63 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
65 .    \" fudge factors for nroff and troff
66 .if n \{\
67 .    ds #H 0
68 .    ds #V .8m
69 .    ds #F .3m
70 .    ds #[ \f1
71 .    ds #] \fP
72 .\}
73 .if t \{\
74 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75 .    ds #V .6m
76 .    ds #F 0
77 .    ds #[ \&
78 .    ds #] \&
79 .\}
80 .    \" simple accents for nroff and troff
81 .if n \{\
82 .    ds ' \&
83 .    ds ` \&
84 .    ds ^ \&
85 .    ds , \&
86 .    ds ~ ~
87 .    ds /
88 .\}
89 .if t \{\
90 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96 .\}
97 .    \" troff and (daisy-wheel) nroff accents
98 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105 .ds ae a\h'-(\w'a'u*4/10)'e
106 .ds Ae A\h'-(\w'A'u*4/10)'E
107 .    \" corrections for vroff
108 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110 .    \" for low resolution devices (crt and lpr)
111 .if \n(.H>23 .if \n(.V>19 \
112 \{\
113 .    ds : e
114 .    ds 8 ss
115 .    ds o a
116 .    ds d- d\h'-1'\(ga
117 .    ds D- D\h'-1'\(hy
118 .    ds th \o'bp'
119 .    ds Th \o'LP'
120 .    ds ae ae
121 .    ds Ae AE
122 .\}
123 .rm #[ #] #H #V #F C
124 .\" ========================================================================
125 .\"
126 .IX Title "RRDGRAPH_RPN 1"
127 .TH RRDGRAPH_RPN 1 "2009-06-09" "1.3.999" "rrdtool"
128 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
129 .\" way too many mistakes in technical documents.
130 .if n .ad l
131 .nh
132 .SH "NAME"
133 rrdgraph_rpn \- About RPN Math in rrdtool graph
134 .SH "SYNOPSIS"
135 .IX Header "SYNOPSIS"
136 \&\fI\s-1RPN\s0 expression\fR:=\fIvname\fR|\fIoperator\fR|\fIvalue\fR[,\fI\s-1RPN\s0 expression\fR]
137 .SH "DESCRIPTION"
138 .IX Header "DESCRIPTION"
139 If you have ever used a traditional \s-1HP\s0 calculator you already know
140 \&\fB\s-1RPN\s0\fR (Reverse Polish Notation).
141 The idea behind \fB\s-1RPN\s0\fR is that you have a stack and push
142 your data onto this stack. Whenever you execute an operation, it
143 takes as many elements from the stack as needed. Pushing is done
144 implicitly, so whenever you specify a number or a variable, it gets
145 pushed onto the stack automatically.
146 .PP
147 At the end of the calculation there should be one and only one value left on
148 the stack.  This is the outcome of the function and this is what is put into
149 the \fIvname\fR.  For \fB\s-1CDEF\s0\fR instructions, the stack is processed for each
150 data point on the graph. \fB\s-1VDEF\s0\fR instructions work on an entire data set in
151 one run. Note, that currently \fB\s-1VDEF\s0\fR instructions only support a limited
152 list of functions.
153 .PP
154 Example: \f(CW\*(C`VDEF:maximum=mydata,MAXIMUM\*(C'\fR
155 .PP
156 This will set variable \*(L"maximum\*(R" which you now can use in the rest
157 of your \s-1RRD\s0 script.
158 .PP
159 Example: \f(CW\*(C`CDEF:mydatabits=mydata,8,*\*(C'\fR
160 .PP
161 This means:  push variable \fImydata\fR, push the number 8, execute
162 the operator \fI*\fR. The operator needs two elements and uses those
163 to return one value.  This value is then stored in \fImydatabits\fR.
164 As you may have guessed, this instruction means nothing more than
165 \&\fImydatabits = mydata * 8\fR.  The real power of \fB\s-1RPN\s0\fR lies in the
166 fact that it is always clear in which order to process the input.
167 For expressions like \f(CW\*(C`a = b + 3 * 5\*(C'\fR you need to multiply 3 with
168 5 first before you add \fIb\fR to get \fIa\fR. However, with parentheses
169 you could change this order: \f(CW\*(C`a = (b + 3) * 5\*(C'\fR. In \fB\s-1RPN\s0\fR, you
170 would do \f(CW\*(C`a = b, 3, +, 5, *\*(C'\fR without the need for parentheses.
171 .SH "OPERATORS"
172 .IX Header "OPERATORS"
173 .IP "Boolean operators" 4
174 .IX Item "Boolean operators"
175 \&\fB\s-1LT\s0, \s-1LE\s0, \s-1GT\s0, \s-1GE\s0, \s-1EQ\s0, \s-1NE\s0\fR
176 .Sp
177 Pop two elements from the stack, compare them for the selected condition
178 and return 1 for true or 0 for false. Comparing an \fIunknown\fR or an
179 \&\fIinfinite\fR value will always result in 0 (false).
180 .Sp
181 \&\fB\s-1UN\s0, \s-1ISINF\s0\fR
182 .Sp
183 Pop one element from the stack, compare this to \fIunknown\fR respectively
184 to \fIpositive or negative infinity\fR. Returns 1 for true or 0 for false.
185 .Sp
186 \&\fB\s-1IF\s0\fR
187 .Sp
188 Pops three elements from the stack.  If the element popped last is 0
189 (false), the value popped first is pushed back onto the stack,
190 otherwise the value popped second is pushed back. This does, indeed,
191 mean that any value other than 0 is considered to be true.
192 .Sp
193 Example: \f(CW\*(C`A,B,C,IF\*(C'\fR should be read as \f(CW\*(C`if (A) then (B) else (C)\*(C'\fR
194 .Sp
196 .IP "Comparing values" 4
197 .IX Item "Comparing values"
198 \&\fB\s-1MIN\s0, \s-1MAX\s0\fR
199 .Sp
200 Pops two elements from the stack and returns the smaller or larger,
201 respectively.  Note that \fIinfinite\fR is larger than anything else.
202 If one of the input numbers is \fIunknown\fR then the result of the operation will be
203 \&\fIunknown\fR too.
204 .Sp
205 \&\fB\s-1LIMIT\s0\fR
206 .Sp
207 Pops two elements from the stack and uses them to define a range.
208 Then it pops another element and if it falls inside the range, it
209 is pushed back. If not, an \fIunknown\fR is pushed.
210 .Sp
211 The range defined includes the two boundaries (so: a number equal
212 to one of the boundaries will be pushed back). If any of the three
213 numbers involved is either \fIunknown\fR or \fIinfinite\fR this function
214 will always return an \fIunknown\fR
215 .Sp
216 Example: \f(CW\*(C`CDEF:a=alpha,0,100,LIMIT\*(C'\fR will return \fIunknown\fR if
217 alpha is lower than 0 or if it is higher than 100.
218 .Sp
220 .IP "Arithmetics" 4
221 .IX Item "Arithmetics"
222 \&\fB+, \-, *, /, %\fR
223 .Sp
224 Add, subtract, multiply, divide, modulo
225 .Sp
226 \&\fB\s-1ADDNAN\s0\fR
227 .Sp
228 NAN-safe addition. If one parameter is \s-1NAN/UNKNOWN\s0 it'll be treated as
229 zero. If both parameters are \s-1NAN/UNKNOWN\s0, \s-1NAN/UNKNOWN\s0 will be returned.
230 .Sp
231 \&\fB\s-1SIN\s0, \s-1COS\s0, \s-1LOG\s0, \s-1EXP\s0, \s-1SQRT\s0\fR
232 .Sp
233 Sine and cosine (input in radians), log and exp (natural logarithm),
234 square root.
235 .Sp
236 \&\fB\s-1ATAN\s0\fR
237 .Sp
238 Arctangent (output in radians).
239 .Sp
240 \&\fB\s-1ATAN2\s0\fR
241 .Sp
242 Arctangent of y,x components (output in radians).
243 This pops one element from the stack, the x (cosine) component, and then
244 a second, which is the y (sine) component.
245 It then pushes the arctangent of their ratio, resolving the ambiguity between
246 quadrants.
247 .Sp
248 Example: \f(CW\*(C`CDEF:angle=Y,X,ATAN2,RAD2DEG\*(C'\fR will convert \f(CW\*(C`X,Y\*(C'\fR
249 components into an angle in degrees.
250 .Sp
251 \&\fB\s-1FLOOR\s0, \s-1CEIL\s0\fR
252 .Sp
253 Round down or up to the nearest integer.
254 .Sp
255 \&\fB\s-1DEG2RAD\s0, \s-1RAD2DEG\s0\fR
256 .Sp
257 Convert angle in degrees to radians, or radians to degrees.
258 .Sp
259 \&\fB\s-1ABS\s0\fR
260 .Sp
261 Take the absolute value.
262 .IP "Set Operations" 4
263 .IX Item "Set Operations"
264 \&\fB\s-1SORT\s0, \s-1REV\s0\fR
265 .Sp
266 Pop one element from the stack.  This is the \fIcount\fR of items to be sorted
267 (or reversed).  The top \fIcount\fR of the remaining elements are then sorted
268 (or reversed) in place on the stack.
269 .Sp
270 Example: \f(CW\*(C`CDEF:x=v1,v2,v3,v4,v5,v6,6,SORT,POP,5,REV,POP,+,+,+,4,/\*(C'\fR will
271 compute the average of the values v1 to v6 after removing the smallest and
272 largest.
273 .Sp
274 \&\fB\s-1AVG\s0\fR
275 .Sp
276 Pop one element (\fIcount\fR) from the stack. Now pop \fIcount\fR elements and build the
277 average, ignoring all \s-1UNKNOWN\s0 values in the process.
278 .Sp
279 Example: \f(CW\*(C`CDEF:x=a,b,c,d,4,AVG\*(C'\fR
280 .Sp
281 \&\fB\s-1TREND\s0, \s-1TRENDNAN\s0\fR
282 .Sp
283 Create a \*(L"sliding window\*(R" average of another data series.
284 .Sp
285 Usage:
286 CDEF:smoothed=x,1800,TREND
287 .Sp
288 This will create a half-hour (1800 second) sliding window average of x.  The
289 average is essentially computed as shown here:
290 .Sp
291 .Vb 8
292 \&                 +\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\->
293 \&                                                     now
294 \&                       delay     t0
295 \&                 <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
296 \&                         delay       t1
297 \&                     <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
298 \&                              delay      t2
299 \&                         <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
300 \&
301 \&
302 \&     Value at sample (t0) will be the average between (t0\-delay) and (t0)
303 \&     Value at sample (t1) will be the average between (t1\-delay) and (t1)
304 \&     Value at sample (t2) will be the average between (t2\-delay) and (t2)
305 .Ve
306 .Sp
307 \&\s-1TRENDNAN\s0 is \- in contrast to \s-1TREND\s0 \- NAN-safe. If you use \s-1TREND\s0 and one 
308 source value is \s-1NAN\s0 the complete sliding window is affected. The \s-1TRENDNAN\s0 
309 operation ignores all NAN-values in a sliding window and computes the 
310 average of the remaining values.
311 .Sp
312 \&\fB\s-1PREDICT\s0, \s-1PREDICTSIGMA\s0\fR
313 .Sp
314 Create a \*(L"sliding window\*(R" average/sigma of another data series, that also
315 shifts the data series by given amounts of of time as well
316 .Sp
317 Usage \- explicit stating shifts:
318 CDEF:predict=<shift n>,...,<shift 1>,n,<window>,x,PREDICT
319 CDEF:sigma=<shift n>,...,<shift 1>,n,<window>,x,PREDICTSIGMA
320 .Sp
321 Usage \- shifts defined as a base shift and a number of time this is applied
322 CDEF:predict=<shift multiplier>,\-n,<window>,x,PREDICT
323 CDEF:sigma=<shift multiplier>,\-n,<window>,x,PREDICTSIGMA
324 .Sp
325 Example:
326 CDEF:predict=172800,86400,2,1800,x,PREDICT
327 .Sp
328 This will create a half-hour (1800 second) sliding window average/sigma of x, that
329 average is essentially computed as shown here:
330 .Sp
331 .Vb 10
332 \& +\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\->
333 \&                                                                     now
334 \&                                                  shift 1        t0
335 \&                                         <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
336 \&                               window
337 \&                         <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
338 \&                                       shift 2
339 \&                 <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
340 \&       window
341 \& <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
342 \&                                                      shift 1        t1
343 \&                                             <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
344 \&                                   window
345 \&                             <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
346 \&                                            shift 2
347 \&                     <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
348 \&           window
349 \&     <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
350 \&
351 \& Value at sample (t0) will be the average between (t0\-shift1\-window) and (t0\-shift1)
352 \&                                      and between (t0\-shift2\-window) and (t0\-shift2)
353 \& Value at sample (t1) will be the average between (t1\-shift1\-window) and (t1\-shift1)
354 \&                                      and between (t1\-shift2\-window) and (t1\-shift2)
355 .Ve
356 .Sp
357 The function is by design NAN-safe. 
358 This also allows for extrapolation into the future (say a few days)
359 \&\- you may need to define the data series whit the optional start= parameter, so that 
360 the source data series has enough data to provide prediction also at the beginning of a graph...
361 .Sp
362 Here an example, that will create a 10 day graph that also shows the 
363 prediction 3 days into the future with its uncertainty value (as defined by avg+\-4*sigma)
364 This also shows if the prediction is exceeded at a certain point.
365 .Sp
366 rrdtool graph image.png \-\-imgformat=PNG \e
367  \-\-start=\-7days \-\-end=+3days \-\-width=1000 \-\-height=200 \-\-alt\-autoscale\-max \e
368  DEF:value=value.rrd:value:AVERAGE:start=\-14days \e
369  LINE1:value#ff0000:value \e
370  CDEF:predict=86400,\-7,1800,value,PREDICT \e
371  CDEF:sigma=86400,\-7,1800,value,PREDICTSIGMA \e
372  CDEF:upper=predict,sigma,3,*,+ \e
373  CDEF:lower=predict,sigma,3,*,\- \e
374  LINE1:predict#00ff00:prediction \e
375  LINE1:upper#0000ff:upper\e certainty\e limit \e
376  LINE1:lower#0000ff:lower\e certainty\e limit \e
377  CDEF:exceeds=value,UN,0,value,lower,upper,LIMIT,UN,IF \e
378  TICK:exceeds#aa000080:1
379 .Sp
380 Note: Experience has shown that a factor between 3 and 5 to scale sigma is a good 
381 discriminator to detect abnormal behaviour. This obviously depends also on the type 
382 of data and how \*(L"noisy\*(R" the data series is.
383 .Sp
384 This prediction can only be used for short term extrapolations \- say a few days into the future\-
385 .IP "Special values" 4
386 .IX Item "Special values"
387 \&\fB\s-1UNKN\s0\fR
388 .Sp
389 Pushes an unknown value on the stack
390 .Sp
391 \&\fB\s-1INF\s0, \s-1NEGINF\s0\fR
392 .Sp
393 Pushes a positive or negative infinite value on the stack. When
394 such a value is graphed, it appears at the top or bottom of the
395 graph, no matter what the actual value on the y\-axis is.
396 .Sp
397 \&\fB\s-1PREV\s0\fR
398 .Sp
399 Pushes an \fIunknown\fR value if this is the first value of a data
400 set or otherwise the result of this \fB\s-1CDEF\s0\fR at the previous time
401 step. This allows you to do calculations across the data.  This
402 function cannot be used in \fB\s-1VDEF\s0\fR instructions.
403 .Sp
404 \&\fB\s-1PREV\s0(vname)\fR
405 .Sp
406 Pushes an \fIunknown\fR value if this is the first value of a data
407 set or otherwise the result of the vname variable at the previous time
408 step. This allows you to do calculations across the data. This
409 function cannot be used in \fB\s-1VDEF\s0\fR instructions.
410 .Sp
411 \&\fB\s-1COUNT\s0\fR
412 .Sp
413 Pushes the number 1 if this is the first value of the data set, the
414 number 2 if it is the second, and so on. This special value allows
415 you to make calculations based on the position of the value within
416 the data set. This function cannot be used in \fB\s-1VDEF\s0\fR instructions.
417 .IP "Time" 4
418 .IX Item "Time"
419 Time inside RRDtool is measured in seconds since the epoch. The
420 epoch is defined to be \f(CW\*(C`Thu\ Jan\ \ 1\ 00:00:00\ UTC\ 1970\*(C'\fR.
421 .Sp
422 \&\fB\s-1NOW\s0\fR
423 .Sp
424 Pushes the current time on the stack.
425 .Sp
426 \&\fB\s-1TIME\s0\fR
427 .Sp
428 Pushes the time the currently processed value was taken at onto the stack.
429 .Sp
430 \&\fB\s-1LTIME\s0\fR
431 .Sp
432 Takes the time as defined by \fB\s-1TIME\s0\fR, applies the time zone offset
433 valid at that time including daylight saving time if your \s-1OS\s0 supports
434 it, and pushes the result on the stack.  There is an elaborate example
435 in the examples section below on how to use this.
436 .IP "Processing the stack directly" 4
437 .IX Item "Processing the stack directly"
438 \&\fB\s-1DUP\s0, \s-1POP\s0, \s-1EXC\s0\fR
439 .Sp
440 Duplicate the top element, remove the top element, exchange the two
441 top elements.
442 .Sp
444 .SH "VARIABLES"
445 .IX Header "VARIABLES"
446 These operators work only on \fB\s-1VDEF\s0\fR statements. Note that currently \s-1ONLY\s0 these work for \fB\s-1VDEF\s0\fR.
447 .IP "\s-1MAXIMUM\s0, \s-1MINIMUM\s0, \s-1AVERAGE\s0" 4
448 .IX Item "MAXIMUM, MINIMUM, AVERAGE"
449 Return the corresponding value, \s-1MAXIMUM\s0 and \s-1MINIMUM\s0 also return
450 the first occurrence of that value in the time component.
451 .Sp
452 Example: \f(CW\*(C`VDEF:avg=mydata,AVERAGE\*(C'\fR
453 .IP "\s-1STDEV\s0" 4
454 .IX Item "STDEV"
455 Returns the standard deviation of the values.
456 .Sp
457 Example: \f(CW\*(C`VDEF:stdev=mydata,STDEV\*(C'\fR
458 .IP "\s-1LAST\s0, \s-1FIRST\s0" 4
459 .IX Item "LAST, FIRST"
460 Return the last/first value including its time.  The time for
461 \&\s-1FIRST\s0 is actually the start of the corresponding interval, whereas
462 \&\s-1LAST\s0 returns the end of the corresponding interval.
463 .Sp
464 Example: \f(CW\*(C`VDEF:first=mydata,FIRST\*(C'\fR
465 .IP "\s-1TOTAL\s0" 4
466 .IX Item "TOTAL"
467 Returns the rate from each defined time slot multiplied with the
468 step size.  This can, for instance, return total bytes transfered
469 when you have logged bytes per second. The time component returns
470 the number of seconds.
471 .Sp
472 Example: \f(CW\*(C`VDEF:total=mydata,TOTAL\*(C'\fR
473 .IP "\s-1PERCENT\s0, \s-1PERCENTNAN\s0" 4
474 .IX Item "PERCENT, PERCENTNAN"
475 This should follow a \fB\s-1DEF\s0\fR or \fB\s-1CDEF\s0\fR \fIvname\fR. The \fIvname\fR is popped,
476 another number is popped which is a certain percentage (0..100). The
477 data set is then sorted and the value returned is chosen such that
478 \&\fIpercentage\fR percent of the values is lower or equal than the result.
479 For \s-1PERCENTNAN\s0 \fIUnknown\fR values are ignored, but for \s-1PERCENT\s0
480 \&\fIUnknown\fR values are considered lower than any finite number for this
481 purpose so if this operator returns an \fIunknown\fR you have quite a lot
482 of them in your data.  \fBInf\fRinite numbers are lesser, or more, than the
483 finite numbers and are always more than the \fIUnknown\fR numbers.
484 (NaN < \-INF < finite values < \s-1INF\s0)
485 .Sp
486 Example: \f(CW\*(C`VDEF:perc95=mydata,95,PERCENT\*(C'\fR
487          \f(CW\*(C`VDEF:percnan95=mydata,95,PERCENTNAN\*(C'\fR
488 .IP "\s-1LSLSLOPE\s0, \s-1LSLINT\s0, \s-1LSLCORREL\s0" 4
489 .IX Item "LSLSLOPE, LSLINT, LSLCORREL"
490 Return the parameters for a \fBL\fReast \fBS\fRquares \fBL\fRine \fI(y = mx +b)\fR 
491 which approximate the provided dataset.  \s-1LSLSLOPE\s0 is the slope \fI(m)\fR of
492 the line related to the \s-1COUNT\s0 position of the data.  \s-1LSLINT\s0 is the 
493 y\-intercept \fI(b)\fR, which happens also to be the first data point on the 
494 graph. \s-1LSLCORREL\s0 is the Correlation Coefficient (also know as Pearson's 
495 Product Moment Correlation Coefficient).  It will range from 0 to +/\-1 
496 and represents the quality of fit for the approximation.
497 .Sp
498 Example: \f(CW\*(C`VDEF:slope=mydata,LSLSLOPE\*(C'\fR
499 .SH "SEE ALSO"
500 .IX Header "SEE ALSO"
501 rrdgraph gives an overview of how \fBrrdtool graph\fR works.
502 rrdgraph_data describes \fB\s-1DEF\s0\fR,\fB\s-1CDEF\s0\fR and \fB\s-1VDEF\s0\fR in detail.
503 rrdgraph_rpn describes the \fB\s-1RPN\s0\fR language used in the \fB?DEF\fR statements.
504 rrdgraph_graph page describes all of the graph and print functions.
505 .PP
506 Make sure to read rrdgraph_examples for tips&tricks.
507 .SH "AUTHOR"
508 .IX Header "AUTHOR"
509 Program by Tobias Oetiker <tobi@oetiker.ch>
510 .PP
511 This manual page by Alex van den Bogaerdt <alex@vandenbogaerdt.nl>
512 with corrections and/or additions by several people