File: common.sh

package info (click to toggle)
pcp 3.9.10
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 81,836 kB
  • ctags: 26,423
  • sloc: ansic: 178,791; sh: 79,349; cpp: 61,042; xml: 28,842; perl: 12,963; yacc: 5,351; python: 4,578; lex: 1,894; makefile: 1,665; fortran: 60; java: 22; awk: 20
file content (41 lines) | stat: -rw-r--r-- 776 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
				}'
}