bin/phytronFilterIpPortLog.pl

changeset 2437
edf7037215c1
parent 2436
714726513a7d
child 2438
2a8fd0711e15
equal deleted inserted replaced
2436:714726513a7d 2437:edf7037215c1
10 # -50188:25 10 # -50188:25
11 # 2022/02/22 16:05:47.966 mou1s05l.blc05.bessy.de:22222 write 14 11 # 2022/02/22 16:05:47.966 mou1s05l.blc05.bessy.de:22222 write 14
12 # 0M1.1P22R:XX 12 # 0M1.1P22R:XX
13 # 2022/02/22 16:05:47.975 mou1s05l.blc05.bessy.de:22222 read 7 13 # 2022/02/22 16:05:47.975 mou1s05l.blc05.bessy.de:22222 read 7
14 # 0:0C 14 # 0:0C
15
16 use strict; 15 use strict;
17 use Getopt::Long; 16 use Getopt::Long;
18 17
19 my $usage = "phytronFilterLog.pl [OPTIONS] phytronIpPortLogFile\n\t-h: help\n\t-f: filter e.g. M1.1 for motor 1\n"; 18 my $usage = "phytronFilterLog.pl [OPTIONS] phytronIpPortLogFile\n\t-h: help\n\t-f: filter e.g. M1.1 for motor 1\n";
20 my $filter = ".*"; #default: get all 19 my $filter = ".*"; #default: get all
76 if($line =~ /^.*?\s(.*?)\s.*?\s(\w+)/ && $2 eq 'read') { 75 if($line =~ /^.*?\s(.*?)\s.*?\s(\w+)/ && $2 eq 'read') {
77 $line = <IN_FILE>; 76 $line = <IN_FILE>;
78 $lineNr++; 77 $lineNr++;
79 if($line=~/(.*):../) { 78 if($line=~/(.*):../) {
80 $reply = $1; 79 $reply = $1;
80 $reply = getStatus($reply) if($command=~/M\d+\.\dSE/)
81 } 81 }
82 else { 82 else {
83 chomp($line); 83 chomp($line);
84 $reply = "ILLEGAL REPLY: '$line'"; 84 $reply = "ILLEGAL REPLY: '$line'";
85 } 85 }
89 chomp($line); 89 chomp($line);
90 print "$lineNr\t$timeRead\terr\tMISS READ\t'$line'\n"; 90 print "$lineNr\t$timeRead\terr\tMISS READ\t'$line'\n";
91 } 91 }
92 } 92 }
93 close IN_FILE; 93 close IN_FILE;
94
95 sub getStatus
96 { my ($reply) = @_;
97 my $hex = sprintf("%X",$reply);
98 my $msg;
99
100 $msg .= " busy" if(($hex & 1));
101 $msg .= " Illegal" if(($hex & 2));
102 $msg .= " WaitSync" if(($hex & 4));
103 $msg .= " isInit" if(($hex & 0x8));
104 $msg .= " LS+" if(($hex & 0x10));
105 $msg .= " LS-" if(($hex & 0x20));
106 $msg .= " LSM" if(($hex & 0x40));
107 $msg .= " SwLS+" if(($hex & 80));
108 $msg .= " SwLS-" if(($hex & 100));
109 $msg .= " SwLS-" if(($hex & 100));
110 $msg .= " ready" if(($hex & 0x200));
111
112 $msg .= " LS_Err" if(($hex & 0x1000));
113 $msg .= " PwrStg_Err" if(($hex & 0x20000));
114
115 $msg .= " RUN" if(($hex & 0x10000));
116 $msg .= " DONE" if(($hex & 0x80000));
117 return "$reply, 0x$hex STAT:$msg";
118 }

mercurial