dump-restore \
create-with-source-1 create-with-source-2 create-with-source-3 \
create-with-source-4 create-with-source-and-mapping-1 \
- create-from-template-1 dcounter1 vformatter1 xport1 list1
+ create-from-template-1 dcounter1 vformatter1 xport1 list1 \
+ pdp-calc1
EXTRA_DIST = Makefile.am \
functions $(TESTS) \
tune1-testa-mod1.dump tune1-testa-mod2.dump tune1-testorg.dump \
tune2-testa-mod1.dump tune2-testorg.dump \
valgrind-supressions dcounter1 dcounter1.output graph1.output vformatter1 rpn1.output rpn2.output \
- xport1.json.output xport1.xml.output
+ xport1.json.output xport1.xml.output \
+ pdp-calc1 pdp-calc1-1-avg-60.output pdp-calc1-1-avg-300.output pdp-calc1-1-max-300.output
# NB: AM_TESTS_ENVIRONMENT not available until automake 1.12
AM_TESTS_ENVIRONMENT = \
dump-restore \
create-with-source-1 create-with-source-2 create-with-source-3 \
create-with-source-4 create-with-source-and-mapping-1 \
- create-from-template-1 dcounter1 vformatter1 xport1 list1
+ create-from-template-1 dcounter1 vformatter1 xport1 list1 \
+ pdp-calc1
EXTRA_DIST = Makefile.am \
functions $(TESTS) \
tune1-testa-mod1.dump tune1-testa-mod2.dump tune1-testorg.dump \
tune2-testa-mod1.dump tune2-testorg.dump \
valgrind-supressions dcounter1 dcounter1.output graph1.output vformatter1 rpn1.output rpn2.output \
- xport1.json.output xport1.xml.output
+ xport1.json.output xport1.xml.output \
+ pdp-calc1 pdp-calc1-1-avg-60.output pdp-calc1-1-avg-300.output pdp-calc1-1-max-300.output
# NB: AM_TESTS_ENVIRONMENT not available until automake 1.12
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+pdp-calc1.log: pdp-calc1
+ @p='pdp-calc1'; \
+ b='pdp-calc1'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
vformatter1.log: vformatter1
@p='vformatter1'; \
b='vformatter1'; \
--- /dev/null
+#!/bin/bash
+. $(dirname $0)/functions
+
+BASE=$BASEDIR/pdp_calc1
+BUILD=$BUILDDIR/pdp_calc1
+
+function do_update {
+ UPDATE_LIST=$1 ## List of update value items
+ MAX_ITEMS=${2:-1} ## Max items per update call
+
+ UPDATE_STRING=""
+ TOTAL_COUNT=0
+ ITEM_COUNT=0
+
+ for ITEM in ${UPDATE_LIST[@]}; do
+ if [ $ITEM_COUNT -lt $MAX_ITEMS ]; then
+ UPDATE_STRING="$UPDATE_STRING $ITEM";
+ ((ITEM_COUNT++))
+ else
+ ((TOTAL_COUNT+=$ITEM_COUNT))
+ $RRDTOOL update ${BUILD}.rrd $UPDATE_STRING || return 1
+ ok "update $TOTAL_COUNT"
+ ITEM_COUNT=1
+ UPDATE_STRING="$ITEM"
+ fi
+ done
+
+ ## Last update with remaining items:
+ if [ ! -z "$UPDATE_STRING" ]; then
+ ((TOTAL_COUNT+=$ITEM_COUNT))
+ $RRDTOOL update ${BUILD}.rrd $UPDATE_STRING || return 1
+ ok "update $TOTAL_COUNT"
+ fi
+
+ return 0
+}
+
+$RRDTOOL create ${BUILD}.rrd --start 1548500640 --step 60 \
+ DS:Gauge:GAUGE:3600:0:10 DS:Counter:COUNTER:3600:0:U DS:Absolute:ABSOLUTE:3600:0:U \
+ RRA:AVERAGE:0.5:1:30 RRA:AVERAGE:0.5:5:6 RRA:MAX:0.5:5:6
+
+report "create"
+
+declare -a UPDATE_LIST=("1548500700:0:0:0" # Initalize PDP with 0
+ "1548500760:1:60:60" # 1.0 steps value 1
+ "1548500790:0:60:0" # 0.5 steps value 0
+ "1548501000:1:270:210" # 3.5 steps value 1
+ "1548501070:2:390:120" # 70 sec value 2
+ "1548501101:U:U:U" # 31 sec undefined (xff > 0.5)
+ "1548501300:1:1000:199" # 199 sec value 1 but counter will be re-initialized with 1000
+ "1548501800:1:1500:500" # 500 sec value 1
+ "1548501839:10:1890:390" # 39 sec value 10
+ "1548502200:0:1890:0" # Fill up with 0
+ "1548502210:2:1910:20" # 10 sec value 2
+ "1548502410:4:2710:800" # 200 sec value 4
+ "1548502510:5:3210:500" # 100 sec value 5
+ )
+
+do_update "$UPDATE_LIST" 3
+report "update all"
+
+is_cached && exit 0
+
+$RRDTOOL fetch ${BUILD}.rrd AVERAGE -r 60 -s 1548500640 -e 1548502500 | $DIFF --ignore-space-change - $BASEDIR/pdp-calc1-1-avg-60.output
+report "fetch avg 60"
+$RRDTOOL fetch ${BUILD}.rrd AVERAGE -r 300 -s 1548500640 -e 1548502500 | $DIFF --ignore-space-change - $BASEDIR/pdp-calc1-1-avg-300.output
+report "fetch avg 300"
+$RRDTOOL fetch ${BUILD}.rrd MAX -r 300 -s 1548500640 -e 1548502500 | $DIFF --ignore-space-change - $BASEDIR/pdp-calc1-1-max-300.output
+report "fetch max 300"
--- /dev/null
+ Gauge Counter Absolute
+
+1548500700: -nan -nan -nan
+1548501000: 9.0000000000e-01 9.0000000000e-01 9.0000000000e-01
+1548501300: 1.2500000000e+00 -nan 1.1785714286e+00
+1548501600: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548501900: 1.9666666667e+00 1.9666666667e+00 1.9666666667e+00
+1548502200: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
+1548502500: 4.2333333333e+00 4.2333333333e+00 4.2333333333e+00
+1548502800: -nan -nan -nan
--- /dev/null
+ Gauge Counter Absolute
+
+1548500700: -nan -nan -nan
+1548500760: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548500820: 5.0000000000e-01 5.0000000000e-01 5.0000000000e-01
+1548500880: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548500940: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548501000: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548501060: 2.0000000000e+00 1.7142857143e+00 1.7142857143e+00
+1548501120: -nan -nan -nan
+1548501180: 1.0000000000e+00 -nan 1.0000000000e+00
+1548501240: 1.0000000000e+00 -nan 1.0000000000e+00
+1548501300: 1.0000000000e+00 -nan 1.0000000000e+00
+1548501360: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548501420: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548501480: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548501540: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548501600: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548501660: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548501720: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548501780: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548501840: 6.8333333333e+00 6.8333333333e+00 6.8333333333e+00
+1548501900: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
+1548501960: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
+1548502020: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
+1548502080: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
+1548502140: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
+1548502200: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
+1548502260: 3.6666666667e+00 3.6666666667e+00 3.6666666667e+00
+1548502320: 4.0000000000e+00 4.0000000000e+00 4.0000000000e+00
+1548502380: 4.0000000000e+00 4.0000000000e+00 4.0000000000e+00
+1548502440: 4.5000000000e+00 4.5000000000e+00 4.5000000000e+00
+1548502500: 5.0000000000e+00 5.0000000000e+00 5.0000000000e+00
+1548502560: -nan -nan -nan
--- /dev/null
+ Gauge Counter Absolute
+
+1548500700: -nan -nan -nan
+1548501000: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548501300: 2.0000000000e+00 -nan 1.7142857143e+00
+1548501600: 1.0000000000e+00 1.0000000000e+00 1.0000000000e+00
+1548501900: 6.8333333333e+00 6.8333333333e+00 6.8333333333e+00
+1548502200: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
+1548502500: 5.0000000000e+00 5.0000000000e+00 5.0000000000e+00
+1548502800: -nan -nan -nan