X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=doc%2Frrdgraph_rpn.txt;h=3c55e87a2a6e3228f7daa885a1964b8dd0d3d708;hb=7f93207aa16479d6d1d426276d5670b5f970327e;hp=5f022a444a91bd80ecd83d1e478471a3a1fa6625;hpb=c71f2c2b6501de70743bd70d7db51327e7f138a8;p=pkg-rrdtool.git diff --git a/doc/rrdgraph_rpn.txt b/doc/rrdgraph_rpn.txt index 5f022a4..3c55e87 100644 --- a/doc/rrdgraph_rpn.txt +++ b/doc/rrdgraph_rpn.txt @@ -9,19 +9,19 @@ SSYYNNOOPPSSIISS _R_P_N _e_x_p_r_e_s_s_i_o_n:=_v_n_a_m_e|_o_p_e_r_a_t_o_r|_v_a_l_u_e[,_R_P_N _e_x_p_r_e_s_s_i_o_n] DDEESSCCRRIIPPTTIIOONN - If you have ever used a traditional HP calculator you already know RRPPNN. - The idea behind RRPPNN is that you have a stack and push your data onto - this stack. Whenever you execute an operation, it takes as many ele- - ments from the stack as needed. Pushing is done implicitly, so whenever - you specify a number or a variable, it gets pushed onto the stack auto- - matically. + If you have ever used a traditional HP calculator you already know RRPPNN + (Reverse Polish Notation). The idea behind RRPPNN is that you have a + stack and push your data onto this stack. Whenever you execute an + operation, it takes as many elements from the stack as needed. Pushing + is done implicitly, so whenever you specify a number or a variable, it + gets pushed onto the stack automatically. At the end of the calculation there should be one and only one value left on the stack. This is the outcome of the function and this is - what is put into the _v_n_a_m_e. For CCDDEEFF instructions, the stack is pro- - cessed for each data point on the graph. VVDDEEFF instructions work on an - entire data set in one run. Note, that currently VVDDEEFF instructions only - support a limited list of functions. + what is put into the _v_n_a_m_e. For CCDDEEFF instructions, the stack is + processed for each data point on the graph. VVDDEEFF instructions work on + an entire data set in one run. Note, that currently VVDDEEFF instructions + only support a limited list of functions. Example: "VDEF:maximum=mydata,MAXIMUM" @@ -30,9 +30,9 @@ DDEESSCCRRIIPPTTIIOONN Example: "CDEF:mydatabits=mydata,8,*" - This means: push variable _m_y_d_a_t_a, push the number 8, execute the oper- - ator _*. The operator needs two elements and uses those to return one - value. This value is then stored in _m_y_d_a_t_a_b_i_t_s. As you may have + This means: push variable _m_y_d_a_t_a, push the number 8, execute the + operator _*. The operator needs two elements and uses those to return + one value. This value is then stored in _m_y_d_a_t_a_b_i_t_s. As you may have guessed, this instruction means nothing more than _m_y_d_a_t_a_b_i_t_s _= _m_y_d_a_t_a _* _8. The real power of RRPPNN lies in the fact that it is always clear in which order to process the input. For expressions like "a = b + 3 * 5" @@ -44,15 +44,15 @@ OOPPEERRAATTOORRSS Boolean operators LLTT,, LLEE,, GGTT,, GGEE,, EEQQ,, NNEE - Pop two elements from the stack, compare them for the selected con- - dition and return 1 for true or 0 for false. Comparing an _u_n_k_n_o_w_n - or an _i_n_f_i_n_i_t_e value will always result in 0 (false). + Pop two elements from the stack, compare them for the selected + condition and return 1 for true or 0 for false. Comparing an + _u_n_k_n_o_w_n or an _i_n_f_i_n_i_t_e value will always result in 0 (false). UUNN,, IISSIINNFF - Pop one element from the stack, compare this to _u_n_k_n_o_w_n respec- - tively to _p_o_s_i_t_i_v_e _o_r _n_e_g_a_t_i_v_e _i_n_f_i_n_i_t_y. Returns 1 for true or 0 - for false. + Pop one element from the stack, compare this to _u_n_k_n_o_w_n + respectively to _p_o_s_i_t_i_v_e _o_r _n_e_g_a_t_i_v_e _i_n_f_i_n_i_t_y. Returns 1 for true + or 0 for false. IIFF @@ -63,13 +63,15 @@ OOPPEERRAATTOORRSS Example: "A,B,C,IF" should be read as "if (A) then (B) else (C)" + + Comparing values MMIINN,, MMAAXX Pops two elements from the stack and returns the smaller or larger, respectively. Note that _i_n_f_i_n_i_t_e is larger than anything else. If - one of the input numbers is _u_n_k_n_o_w_n then the result of the opera- - tion will be _u_n_k_n_o_w_n too. + one of the input numbers is _u_n_k_n_o_w_n then the result of the + operation will be _u_n_k_n_o_w_n too. LLIIMMIITT @@ -85,15 +87,23 @@ OOPPEERRAATTOORRSS Example: "CDEF:a=alpha,0,100,LIMIT" will return _u_n_k_n_o_w_n if alpha is lower than 0 or if it is higher than 100. + + Arithmetics ++,, --,, **,, //,, %% Add, subtract, multiply, divide, modulo + AADDDDNNAANN + + NAN-safe addition. If one parameter is NAN/UNKNOWN it'll be treated + as zero. If both parameters are NAN/UNKNOWN, NAN/UNKNOWN will be + returned. + SSIINN,, CCOOSS,, LLOOGG,, EEXXPP,, SSQQRRTT - Sine and cosine (input in radians), log and exp (natural loga- - rithm), square root. + Sine and cosine (input in radians), log and exp (natural + logarithm), square root. AATTAANN @@ -102,12 +112,13 @@ OOPPEERRAATTOORRSS AATTAANN22 Arctangent of y,x components (output in radians). This pops one - element from the stack, the x (cosine) component, and then a sec- - ond, which is the y (sine) component. It then pushes the arctan- - gent of their ratio, resolving the ambiguity between quadrants. + element from the stack, the x (cosine) component, and then a + second, which is the y (sine) component. It then pushes the + arctangent of their ratio, resolving the ambiguity between + quadrants. - Example: "CDEF:angle=Y,X,ATAN2,RAD2DEG" will convert "X,Y" compo- - nents into an angle in degrees. + Example: "CDEF:angle=Y,X,ATAN2,RAD2DEG" will convert "X,Y" + components into an angle in degrees. FFLLOOOORR,, CCEEIILL @@ -139,7 +150,7 @@ OOPPEERRAATTOORRSS Example: "CDEF:x=a,b,c,d,4,AVG" - TTRREENNDD + TTRREENNDD,, TTRREENNDDNNAANN Create a "sliding window" average of another data series. @@ -157,10 +168,16 @@ OOPPEERRAATTOORRSS delay t2 <---------------> + Value at sample (t0) will be the average between (t0-delay) and (t0) Value at sample (t1) will be the average between (t1-delay) and (t1) Value at sample (t2) will be the average between (t2-delay) and (t2) + TRENDNAN is - in contrast to TREND - NAN-safe. If you use TREND and + one source value is NAN the complete sliding window is affected. + The TRENDNAN operation ignores all NAN-values in a sliding window + and computes the average of the remaining values. + Special values UUNNKKNN @@ -176,8 +193,8 @@ OOPPEERRAATTOORRSS Pushes an _u_n_k_n_o_w_n value if this is the first value of a data set or otherwise the result of this CCDDEEFF at the previous time step. This - allows you to do calculations across the data. This function can- - not be used in VVDDEEFF instructions. + allows you to do calculations across the data. This function + cannot be used in VVDDEEFF instructions. PPRREEVV((vvnnaammee)) @@ -195,7 +212,7 @@ OOPPEERRAATTOORRSS Time Time inside RRDtool is measured in seconds since the epoch. The - epoch is defined to be "Thu Jan 1 00:00:00 UTC 1970". + epoch is defined to be "Thu Jan 1 00:00:00 UTC 1970". NNOOWW @@ -209,9 +226,9 @@ OOPPEERRAATTOORRSS LLTTIIMMEE Takes the time as defined by TTIIMMEE, applies the time zone offset - valid at that time including daylight saving time if your OS sup- - ports it, and pushes the result on the stack. There is an elabo- - rate example in the examples section below on how to use this. + valid at that time including daylight saving time if your OS + supports it, and pushes the result on the stack. There is an + elaborate example in the examples section below on how to use this. Processing the stack directly DDUUPP,, PPOOPP,, EEXXCC @@ -219,6 +236,8 @@ OOPPEERRAATTOORRSS Duplicate the top element, remove the top element, exchange the two top elements. + + VVAARRIIAABBLLEESS These operators work only on VVDDEEFF statements. Note that currently ONLY these work for VVDDEEFF. @@ -229,6 +248,11 @@ VVAARRIIAABBLLEESS Example: "VDEF:avg=mydata,AVERAGE" + STDEV + Returns the standard deviation of the values. + + Example: "VDEF:stdev=mydata,STDEV" + LAST, FIRST Return the last/first value including its time. The time for FIRST is actually the start of the corresponding interval, whereas LAST @@ -264,8 +288,8 @@ VVAARRIIAABBLLEESS y-intercept _(_b_), which happens also to be the first data point on the graph. LSLCORREL is the Correlation Coefficient (also know as Pearson's Product Moment Correlation Coefficient). It will range - from 0 to +/-1 and represents the quality of fit for the approxima- - tion. + from 0 to +/-1 and represents the quality of fit for the + approximation. Example: "VDEF:slope=mydata,LSLSLOPE" @@ -280,8 +304,9 @@ SSEEEE AALLSSOO AAUUTTHHOORR Program by Tobias Oetiker - This manual page by Alex van den Bogaerdt + This manual page by Alex van den Bogaerdt with + corrections and/or additions by several people -1.2.27 2008-02-17 RRDGRAPH_RPN(1) +1.3.8 2009-02-21 RRDGRAPH_RPN(1)