3 # Test out wrapping on libpcp/interp
5 # Test the creation and reading of an archive created using pmlogger(1) and
8 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
12 echo "QA output created by $seq"
14 # get standard environment, filters and checks
19 signal
=$PCP_BINADM_DIR/pmsignal
20 status
=1 # failure is the default!
21 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
26 unset PCP_COUNTER_WRAP
27 echo "--- Wrapping OFF ---"
34 export PCP_COUNTER_WRAP
35 echo "--- Wrapping ON ---"
43 # Daylight savings on from Sunday 1st January to
45 TZ
="EST-10EDT-11,1/0,64/3"
47 # Daylight savings on from Sunday 29th October to Wednesday
48 # "32nd" December (including the end of the extra day for
50 TZ
="EST-10EDT-11,302/2,367/0"
53 # This is what the specification should be normally, but
54 # it won't work because the start date of daylight savings
55 # is AFTER the end date. libc.so hates this, so I hate
57 #TZ="EST-10EDT-11,302/2,64/3"
63 # Reset the sample agent so that we start from a known
64 # point for the wrap metrics
68 pmstore sample.control
-1 >/dev
/null
69 $sudo $signal -a -s HUP pmcd
74 # Simulate interpolated fetching with/without wrapping
75 # Assumes doing it for sample.wrap.ulong
79 $PCP_AWK_PROG -v dowrap
=$dowrap -v half_delta
=$half_delta '
87 gsub(/^.*:/, "", curr_time);
89 delta = curr_time - prev_time;
90 if (delta < 0) delta += 60; # delta wrap :-)
92 printf("delta=%s;curr=%s;prev=%s\n", delta, curr_time, prev_time);
94 #x = (prev_value + curr_value) / 2.0
95 x = (curr_value - prev_value) / delta * half_delta;
98 if (curr_value < prev_value && dowrap) { # then wrap
99 new_curr_value = curr_value + maxuint;
101 x = (new_curr_value - prev_value) / delta * half_delta;
104 if (x > maxuint) x -= maxuint; # wrap back if necessary
108 prev_time = curr_time;
109 prev_value = curr_value;
115 # Note the time of the first sample.wrap value
121 printf("starttime=%s\n", $1);
124 ' <$tmp.dump
>$tmp.starttime
125 eval `cat $tmp.starttime`
129 # Get out the interp values using pmval
134 echo "--- pmval ---" >>$seq.full
135 pmval
-w 15 -f 0 -r -a $tmp.archive
-S "@$starttime" -O $half_delta -t $delta \
139 -e '/metric/,/interval/d' \
141 -e 's/^[^ ][^ ]* *//'
145 # Compare values allowing for an error
150 echo "--- paste ---" >>$seq.full
152 paste $tmp.1 $tmp.2 \
154 |
$PCP_AWK_PROG -v error
=$error ' {
156 if (diff < 0) diff *= -1;
158 printf("mismatch: %f, %f (diff=%f)\n", $1, $2, diff);
166 # real QA test starts here
172 cat <<EOF >$tmp.config
173 log advisory on $delta second {
177 pmlogger
-c $tmp.config
-s5 -l$tmp.log
$tmp.archive
180 echo "Archive failed to be created !"
184 pmdumplog
$tmp.archive
>$tmp.dump
186 echo "--- pmdumplog ---" >>$seq.full
187 cat $tmp.dump
>>$seq.full
193 echo "--- process_log wrap_off ---" >>$seq.full
194 cat $tmp.1 >>$seq.full
197 echo "--- process pmval ---" >>$seq.full
198 cat $tmp.2 >>$seq.full
204 echo "--- process_log wrap_on ---" >>$seq.full
205 cat $tmp.1 >>$seq.full
208 echo "--- process pmval ---" >>$seq.full
209 cat $tmp.2 >>$seq.full