summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bb4498d)
raw | patch | inline | side by side (parent: bb4498d)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 8 Sep 2007 05:23:23 +0000 (05:23 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 8 Sep 2007 05:23:23 +0000 (05:23 +0000) |
program/CONTRIBUTORS | patch | blob | history | |
program/doc/rrdgraph_rpn.pod | patch | blob | history | |
program/src/rrd_graph.c | patch | blob | history | |
program/src/rrd_graph.h | patch | blob | history |
diff --git a/program/CONTRIBUTORS b/program/CONTRIBUTORS
index 54a6a6ce3f909817b814e358263ded7a8c95f1a1..a44edcb5a8acfadde135d8508b42ef0acc2b760a 100644 (file)
--- a/program/CONTRIBUTORS
+++ b/program/CONTRIBUTORS
Mike Slifcak <slif with bellsouth.net> many rrdtool-1.1.x fixes
Oleg Cherevko <olwi with icyb.kiev.ua>
Otmar Lendl <O.Lendl with Austria.EU.net> (lots of bugfixes)
+Patrick Cherry <patrick with bytemark.co.uk>
Paul Joslin <Paul.Joslin with sdrc.com>
Peter Speck <speck with vitality.dk> eps/svg/pdf file format code in rrdtool-1.x
Peter Stamfest <peter with stamfest.at> initial multi-thread support
index cf62c0800b918466f7e802dd4f8b0fd00184974a..3718349cdbba42e80e991fb461511675cf18b48c 100644 (file)
Example: C<VDEF:avg=mydata,AVERAGE>
+=item STDEV
+
+Returns the standard deviation of the values.
+
+Example: C<VDEF:stdev=mydata,STDEV>
+
=item LAST, FIRST
Return the last/first value including its time. The time for
index 348a5a5e9784c48df91959cd39e78b3b07b1bdd3..b624171c6860c0d309c59e265e92a634846b14e8 100644 (file)
--- a/program/src/rrd_graph.c
+++ b/program/src/rrd_graph.c
gdes->vf.op = VDEF_MAXIMUM;
else if (!strcmp("AVERAGE", func))
gdes->vf.op = VDEF_AVERAGE;
+ else if (!strcmp("STDEV", func))
+ gdes->vf.op = VDEF_STDEV;
else if (!strcmp("MINIMUM", func))
gdes->vf.op = VDEF_MINIMUM;
else if (!strcmp("TOTAL", func))
break;
case VDEF_MAXIMUM:
case VDEF_AVERAGE:
+ case VDEF_STDEV:
case VDEF_MINIMUM:
case VDEF_TOTAL:
case VDEF_FIRST:
}
break;
case VDEF_TOTAL:
+ case VDEF_STDEV:
case VDEF_AVERAGE:{
int cnt = 0;
double sum = 0.0;
+ double average = 0.0;
for (step = 0; step < steps; step++) {
if (finite(data[step * src->ds_cnt])) {
if (dst->vf.op == VDEF_TOTAL) {
dst->vf.val = sum * src->step;
dst->vf.when = 0; /* no time component */
- } else {
+ } else if (dst->vf.op == VDEF_AVERAGE){
dst->vf.val = sum / cnt;
dst->vf.when = 0; /* no time component */
+ } else {
+ average = sum / cnt;
+ sum = 0.0;
+ for (step=0;step<steps;step++) {
+ if (finite(data[step*src->ds_cnt])) {
+ sum += pow((data[step*src->ds_cnt] - average),2.0);
+ };
+ }
+ dst->vf.val = pow(sum / cnt,0.5);
+ dst->vf.when = 0; /* no time component */
};
} else {
dst->vf.val = DNAN;
index 00ab15ba1f1c90fe91958f9add1382c3c35826e7..dd132378ec1f3d59806198f8955ec008683c2266 100644 (file)
--- a/program/src/rrd_graph.h
+++ b/program/src/rrd_graph.h
VDEF_MAXIMUM = 0 /* like the MAX in (G)PRINT */
, VDEF_MINIMUM /* like the MIN in (G)PRINT */
, VDEF_AVERAGE /* like the AVERAGE in (G)PRINT */
+ , VDEF_STDEV /* the standard deviation */
, VDEF_PERCENT /* Nth percentile */
, VDEF_TOTAL /* average multiplied by time */
, VDEF_FIRST /* first non-unknown value and time */