-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake_dhheater_history.csh
executable file
·89 lines (75 loc) · 2.12 KB
/
make_dhheater_history.csh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#! /usr/bin/env tcsh
# get rdb tools
source /proj/axaf/simul/etc/mst_envs.tcsh
cat << HTR >! dhheater_history.hdr
time command
S S
HTR
cat << HTR2 >! dhheater_history2.hdr
command time
S S
HTR2
cat << TZERO >! tzero.rdb
command time
S S
1HHTRBON 1999:001:00:00:00.000
1HHTRBOF 2008:098:21:41:00.000
1HHTRBON 2014:259:02:13:00.000
TZERO
cat << TLAST >! tlast.rdb
command time
S S
RANDOM 2098:001:00:00:00.000
RANDOM 2098:001:00:00:01.000
TLAST
grep 1HHTRBO /data/acis/LoadReviews/20*/*/ofls/ACIS-LoadReview.txt \
| grep -v ERROR \
| grep -v TEST \
| sed 's|^/.*.txt:||' \
| awk '{print $1," ",$4}' \
| sed 's/ //g' \
| cat dhheater_history.hdr - \
| sorttbl -uniq time \
| column command time \
| rdbcat tzero.rdb - \
| sorttbl -uniq time \
>! dhheater_history.rdb
# new for v0.2: make the tlast command match the last observed command
set lastcmd=`tail -1 < dhheater_history.rdb | awk '{print $1}'`
cat tlast.rdb \
| compute command = $lastcmd \
>! tmp1.rdb
mv tmp1.rdb tlast.rdb
cat < dhheater_history.rdb \
| column command time | headchg -del \
| sed 's/[0-8]$/9/' \
| sed 's/799$/800/' \
| cat dhheater_history2.hdr - \
| rdbcat dhheater_history.rdb - | sorttbl time \
| rdbcat tzero.rdb - tlast.rdb \
| sorttbl time \
| tee ht.tmp \
| row time gt 1999:000:00:00:00.000 \
>! ht2.tmp
cat ht.tmp \
| column -v -a rownum N \
| compute rownum = _NR \
| tee tmp_ht1.tmp \
| compute rownum -= 1 \
| row rownum gt 0 \
>! tmp_ht2.tmp
set max=`rdbstats rownum < tmp_ht1.tmp | column rownum_max| headchg -del`
cat tmp_ht1.tmp \
| row rownum lt $max \
| column rownum -c command old_command -c time old_time \
| jointbl rownum tmp_ht2.tmp \
| column -v -a dahtbon N \
| compute dahtbon = 0 if command eq 1HHTRBON and old_command eq 1HHTRBOF \
| compute dahtbon = 1 if command eq 1HHTRBON and old_command eq 1HHTRBON \
| compute dahtbon = 1 if command eq 1HHTRBOF and old_command eq 1HHTRBON \
| compute dahtbon = 0 if command eq 1HHTRBOF and old_command eq 1HHTRBOF \
| tee test.rdb \
| column time dahtbon \
>! dahtbon_history.rdb
rm -f test.rdb tmp_ht[12].tmp ht2.tmp ht.tmp dhheater_history.hdr tlast.rdb
rm -f dhheater_history.rdb dhheater_history2.hdr tzero.rdb