From 28b64e4df7670b6c047b0445d0de40709d2d9215 Mon Sep 17 00:00:00 2001 From: Hades DAQ Date: Sat, 12 Apr 2014 14:36:38 +0200 Subject: [PATCH] fixed event rate up to 2**17 Hz, added uptime --- hmon/QA.pm | 11 +++++++---- hmon/hmon_spill.pl | 13 +++++++++++-- hmon/hmon_uptime.pl | 27 +++++++++++++++++++++++++++ hmon/permanent/hmon_qa.pl | 2 +- hmon/permanent/hmon_spill.pl | 0 5 files changed, 46 insertions(+), 7 deletions(-) create mode 100755 hmon/hmon_uptime.pl mode change 100755 => 100644 hmon/permanent/hmon_spill.pl diff --git a/hmon/QA.pm b/hmon/QA.pm index 3978841..011d566 100644 --- a/hmon/QA.pm +++ b/hmon/QA.pm @@ -13,7 +13,8 @@ our $cats = {'main'=>"Main", 'mdc'=>"MDC", 'endp'=>"Endp", 'feeerr'=>"Fee", - 'other'=>"Other"}; + 'other'=>"Other", + 'pion'=>"Pion"}; # Order of categories our $entries->{'cats'} = ["main", @@ -24,10 +25,11 @@ our $entries->{'cats'} = ["main", "mdc", "endp", "feeerr", - "other"]; + "other", + "pion"]; # Order of entries in each cat -$entries->{'main'} = ['time', 'rate','onlineqa']; +$entries->{'main'} = ['time', 'rate','onlineqa','up']; $entries->{'daq'} = ['trbnet', 'timeouts', 'busy','readout']; $entries->{'trg'} = ['spill', 'source', 'accepted', 'ptrate', 'start']; $entries->{'server'} = ['fill', 'cpu', 'icinga', 'etrax', 'pwrsup']; @@ -36,6 +38,7 @@ $entries->{'mdc'} = ['token', 'blocked', 'temp', 'linkqual', 'voltage']; $entries->{'endp'} = ['mdc', 'rich', 'tof', 'rpc', 'other']; $entries->{'feeerr'} = ['rich', 'trb', 'feeerr','trginp','trgqual']; $entries->{'other'} = ['magnet','speech','shower','rich','mdcinvalid']; +$entries->{'pion'} = ['nxstatus', 'LV', 'HV', 'cooling', 'rate']; our $QAServer = "hades33"; @@ -85,7 +88,7 @@ use constant {CTSAddress => 0x0003}; # Missing Boards ############################################################################### -our @mdc_boards_removed =(0x2233); +our @mdc_boards_removed =(); our @mdc_chambers_removed =(); our @rich_boards_removed =(); our @tof_boards_removed =(); diff --git a/hmon/hmon_spill.pl b/hmon/hmon_spill.pl index 1e4823f..720e95f 100755 --- a/hmon/hmon_spill.pl +++ b/hmon/hmon_spill.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl -w use warnings; +use Time::HiRes qw(usleep); use strict; use Data::Dumper; use Hmon; @@ -13,6 +14,7 @@ my $evtrate = 0; my $events = 0; my $spilllength = 0; my $lastres = 0; +my $midlastres = 0; my $outofspill = 0; my @spills; my $spillavgshort = 0; @@ -58,7 +60,14 @@ while (1) { my $res = $rh_result->{0x3000} & 0xffff; $evtrate = $res >= $lastres ? $res - $lastres : ($res + 2**16) - $lastres; $events += $evtrate; + $midlastres = $res; + usleep(500000); + $rh_result = trb_register_read(0x3000, 0x01) or $trbneterr = 1; #sleep 5 and next; + $res = $rh_result->{0x3000} & 0xffff; + my $evtrate2 = $res >= $midlastres ? $res - $midlastres : ($res + 2**16) - $midlastres; + $events += $evtrate2; + $evtrate += $evtrate2; # When end of spill is detected... my $qastate; my $qashort; @@ -102,7 +111,7 @@ while (1) { $qastate = QA::OK; ################Remove after comics or adjust! - if (($evtrate <= 200 || $evtrate >= 50000) && $errtime<20){ + if (($evtrate <= 200 || $evtrate >= 80000) && $errtime<20){ $errtime++; } elsif ($errtime > 1) { @@ -119,7 +128,7 @@ while (1) { $qashort, $qalong); $lastres = $res; - sleep(1); + usleep(500000); } else { QA::WriteQALog($fqa, "main", "rate", 30, QA::ERROR, "Current Rate", "N/A", "N/A"); QA::WriteQALog($fqa,"trg", "spill", 30, QA::ERROR, "Spill Sum","N/A", "N/A"); diff --git a/hmon/hmon_uptime.pl b/hmon/hmon_uptime.pl new file mode 100755 index 0000000..650f0dc --- /dev/null +++ b/hmon/hmon_uptime.pl @@ -0,0 +1,27 @@ +#!/usr/bin/perl -w + +use warnings; +use Time::HiRes qw( gettimeofday usleep time ); +use Time::Duration; +use FileHandle; +use POSIX qw/strftime/; +use QA; +use Hmon; +my $fqa = QA::OpenQAFile(); + +my @start = localtime(); +my $st = time(); + + +while (1) { + + + + my $qastate = QA::OK; + my $s = concise(ago(time() - $st,2)); + my $str = strftime("%H:%M:%S",@start); + QA::WriteQALog($fqa,"main","up", 10, $qastate, "Last Restart", $s, + "Last restart of Hmon: " . $str . " - ". $s); + + sleep(5); +} diff --git a/hmon/permanent/hmon_qa.pl b/hmon/permanent/hmon_qa.pl index abff219..f85cf4e 100755 --- a/hmon/permanent/hmon_qa.pl +++ b/hmon/permanent/hmon_qa.pl @@ -43,7 +43,7 @@ while($a = ) { #Generate output file at most once per second if($oldtime < time) { $oldtime = scalar time(); - $str = Hmon::MakeTitle(7,10,"Tactical Overview",1); + $str = Hmon::MakeTitle(7,11,"Tactical Overview",1); $str .= "
"; foreach my $c (@{$entries->{'cats'}}) { $str .= "
$cats->{$c}
\n"; diff --git a/hmon/permanent/hmon_spill.pl b/hmon/permanent/hmon_spill.pl old mode 100755 new mode 100644 -- 2.43.0