diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
commit | 47e6e7c84f008a53061e661f31ae96629bc694ef (patch) | |
tree | 648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /qa/common.sh | |
download | pcp-debian.tar.gz |
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'qa/common.sh')
-rw-r--r-- | qa/common.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/qa/common.sh b/qa/common.sh new file mode 100644 index 0000000..45cc8f1 --- /dev/null +++ b/qa/common.sh @@ -0,0 +1,41 @@ +. /etc/pcp.env + +export PCP_STDERR="" +export PATH=.:$PATH + +# get offset into an archive relative to the first pmResult +# past the preamble +# +# Usage: _arch_start archive [offset] +# +_arch_start() +{ + pmdumplog -z $1 \ + | $PCP_AWK_PROG ' +/^[0-9][0-9]:[0-9][0-9]:/ { if ($3 ~ /pmcd.pmlogger.host/) next + split($1, t, ":") + t[3] += '"${2-0}"' + while (t[3] < 0) { + t[3] += 60 + t[2]-- + } + while (t[3] > 60) { + t[3] -= 60 + t[2]++ + } + while (t[2] < 0) { + t[2] += 60 + t[1]-- + } + while (t[2] > 60) { + t[2] -= 60 + t[1]++ + } + while (t[1] < 0) + t[1] += 24 + while (t[1] > 23) + t[1] -= 24 + printf "@%02d:%02d:%06.3f",t[1],t[2],t[3] + exit + }' +} |