Code

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