From: Hadaq Hades Date: Sat, 23 Jun 2018 17:42:11 +0000 (+0200) Subject: update hmon scripts X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=e7449beec71046ba218709a350310775d2e86531;p=hadesdaq.git update hmon scripts --- diff --git a/hmon/HPlot.pm b/hmon/HPlot.pm index 0d8124f..394a345 100755 --- a/hmon/HPlot.pm +++ b/hmon/HPlot.pm @@ -193,6 +193,7 @@ sub PlotInit { elsif ($p->{$name}->{type} == TYPE_HEATMAP) { plot_write($fh,"set view map"); plot_write($fh,"set palette rgbformulae 22,13,-31"); + plot_write($fh,$p->{$name}{additional}); if ($p->{$name}->{showvalues} == 0) { #plot_write($fh,"splot '-' matrix with image"); $p->{$name}->{plot_string} .= "plot '-' matrix with image \n" diff --git a/hmon/QA.pm b/hmon/QA.pm index 3302610..82590b6 100644 --- a/hmon/QA.pm +++ b/hmon/QA.pm @@ -76,7 +76,7 @@ our @MdcOepLimits = (372, 372-1, 372-3); our @MdcVoltageLimits = (50, 60, 100); our @MdcLockLimits = (0, 3, 5); our @MdcTempLimits = (75, 80, 85); -our @RichInnerTempLimits = (29,30,31); +our @RichInnerTempLimits = (31,32,33); our @TrgErrLimits = (100, 1000, 10000); our @CPULimits = (95, 100, 100); our @TimeoutLimits = (0, 0, 1); @@ -271,6 +271,7 @@ sub SciNotation { return sprintf("%ik", $v / 1000.) if (abs($v) < 1E6) ; return sprintf("%.1fM", $v / 1000000.) if (abs($v) < 20E6) ; return sprintf("%iM", $v / 1000000.) if (abs($v) < 1E9) ; + return sprintf("%.2fG", $v / 1E9) if (abs($v) < 20E9) ; return sprintf("%i",$v); } else { diff --git a/hmon/hmon_busynew.pl b/hmon/hmon_busynew.pl index f310387..841d387 100755 --- a/hmon/hmon_busynew.pl +++ b/hmon/hmon_busynew.pl @@ -173,7 +173,7 @@ while (1) { } unless($iter % 8) { HPlot::PlotDraw('BusyTimes'); - my $maxpercent = max($diff->{0x8000}->[0],$diff->{0x8000}->[1],$diff->{0x8000}->[2],$diff->{0x8000}->[3],$diff->{0x8000}->[5],$diff->{0x8000}->[6],$diff->{0x8000}->[7],$diff->{0x8000}->[9],); + my $maxpercent = max(@{$diff->{0x8000}}); my $msgstr = sprintf("%3.1f%%",$maxpercent); my $qastate = QA::OK; $qastate = QA::ERROR if ($maxpercent > 99); diff --git a/hmon/hmon_eb_rate.pl b/hmon/hmon_eb_rate.pl index 7c32bbc..c129b41 100755 --- a/hmon/hmon_eb_rate.pl +++ b/hmon/hmon_eb_rate.pl @@ -9,8 +9,8 @@ use QA; use Perl2Epics; use HADES::TrbNet; -my $SLEEP_TIME = 0.5; # in seconds -my $NUM_AVERAGES = 10; +my $SLEEP_TIME = 1; # in seconds +my $NUM_AVERAGES = 5; my $offset = 2; my $last_rate_endp = 0; my $opt_addr = 3; #CTS diff --git a/hmon/hmon_ecalrate.pl b/hmon/hmon_ecalrate.pl new file mode 100755 index 0000000..d292311 --- /dev/null +++ b/hmon/hmon_ecalrate.pl @@ -0,0 +1,140 @@ +#!/usr/bin/perl -w + +use warnings; +use strict; +use Data::Dumper; +use Data::TreeDumper; +use Hmon; +use QA; +use HADES::TrbNet; +use HPlot; +use Time::HiRes qw(usleep time); +use List::Util qw[min max]; + +for my $i (0..5) { + HPlot::PlotInit( { + name => "EcalRateFast$i", + file => "files/EcalRateFast$i", + title => "", + entries => 21, + curves => 8, + type => HPlot::TYPE_HEATMAP, + output => HPlot::OUT_PNG, + zlabel => "Hitrate", + sizex => 400, + sizey => 150, + nokey => 1, + buffer => 1, + xmin => -0.5, + xmax => 20.5, + ymin => 7.5, + ymax => -0.5, + cbmax => "100<*<100000", + cbmin => 0, + noinit => 1, + additional => "set logscale cb;", + showvalues => 0, }); + } +for my $i (0..5) { + HPlot::PlotInit( { + name => "EcalRateSlow$i", + file => "files/EcalRateSlow$i", + title => "", + entries => 21, + curves => 8, + type => HPlot::TYPE_HEATMAP, + output => HPlot::OUT_PNG, + zlabel => "Hitrate", + sizex => 400, + sizey => 150, + nokey => 1, + buffer => 1, + xmin => -0.5, + xmax => 20.5, + ymin => 7.5, + ymax => -0.5, + cbmax => "100<*<100000", + cbmin => 0, + noinit => 1, + additional => "set logscale cb;", + showvalues => 0, }); + } +for my $i (0..5) { + HPlot::PlotInit( { + name => "EcalRateDiff$i", + file => "files/EcalRateDiff$i", + title => "", + entries => 21, + curves => 8, + type => HPlot::TYPE_HEATMAP, + output => HPlot::OUT_PNG, + zlabel => "Hit ratio", + sizex => 400, + sizey => 150, + nokey => 1, + buffer => 1, + xmin => -0.5, + xmax => 20.5, + ymin => 7.5, + ymax => -0.5, + cbmax => "1.1<*<10", + cbmin => "0.1<*<0.9", + noinit => 0, + showvalues => 0, }); + } + +my $str = Hmon::MakeTitle(16, 20, "ECal Hit Rate",0); +for my $i (0..5) { + $str .= qq@\n + \n +
\n@; + }; +$str .="left:fast channel, middle:slow channel. right: ratio fast/slow.
Sectors from top to bottom. x-axis Padiwa 0..21, y-axis channel #"; +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("ECalRate",$str); + + +my $old; +my $oldtime = time(); +my $time = time(); +my $diff; +my $iter = 0; + +trb_init_ports() or die trb_strerror(); + + +while(1) { + my $o = trb_register_read_mem(0xfe71,0xc000,0,49) or die trb_strerror() or sleep 5 and next; + + if (defined $old) { + my $tdiff = time() - $oldtime; + foreach my $b (keys %$o) { + my $sec = ($b>>4) & 0x7; + for my $v (0..23) { + my $xpos = ($b&0xF)*3 + int($v/8); + + my $vdiff = ($o->{$b}->[$v*2+1]&0xffffff) - ($old->{$b}->[$v*2+1]&0xffffff); + if ($vdiff < 0) { $vdiff += 2**24;} + $diff->{$b}->[$v*2+1] = $vdiff/($tdiff|1); + + $vdiff = ($o->{$b}->[$v*2+2]&0xffffff) - ($old->{$b}->[$v*2+2]&0xffffff); + if ($vdiff < 0) { $vdiff += 2**24;} + $diff->{$b}->[$v*2+2] = $vdiff/($tdiff|1); + + my $ratio = ($diff->{$b}->[$v*2+1]||0) / ($diff->{$b}->[$v*2+2]||1); + + HPlot::PlotFill('EcalRateFast'.$sec,$diff->{$b}->[$v*2+1],$xpos,$v % 8); + HPlot::PlotFill('EcalRateSlow'.$sec,$diff->{$b}->[$v*2+2],$xpos,$v % 8); + HPlot::PlotFill('EcalRateDiff'.$sec,$ratio,$xpos,$v % 8); + } + } + for my $i (0..5) { + HPlot::PlotDraw('EcalRateFast'.$i); + HPlot::PlotDraw('EcalRateSlow'.$i); + HPlot::PlotDraw('EcalRateDiff'.$i); + } + } + $old = $o; + $oldtime = time(); + sleep 2; + } diff --git a/hmon/hmon_gberate.pl b/hmon/hmon_gberate.pl index 5128499..0e4300e 100755 --- a/hmon/hmon_gberate.pl +++ b/hmon/hmon_gberate.pl @@ -12,7 +12,7 @@ my $str; Hmon::WriteFile("GbeRate",$str); -system('./hmon_hadplot.sh -yscale 1024 -yoverflow 4096 -ytitle "Data Rate [MiB]" -ymax 52 -output "PNG.files/gberate.460.265" gberate &'); +system('./hmon_hadplot.sh -yscale 1024 -yoverflow 4096 -ytitle "Data Rate [MiB]" -ymax 102 -output "PNG.files/gberate.460.265" gberate &'); # diff --git a/hmon/hmon_readoutstuck.pl b/hmon/hmon_readoutstuck.pl index 3236779..305c1cd 100755 --- a/hmon/hmon_readoutstuck.pl +++ b/hmon/hmon_readoutstuck.pl @@ -33,11 +33,14 @@ sub isFeeHub { return 0; } - +my $oldgberate; while (1) { my $boardlist = ""; my $rh_status = trb_register_read(0x0003, 0xa0f8) or sleep 5 and next; my $rh_evts = trb_register_read(0x0002, 0x0001) or sleep 5 and next; + my $gbe_rate = trb_register_read(0xff7f, 0x83f3) or sleep 5 and next; +# $regoffset = [10]; +# $regwidth = [22]; $rate = (($rh_evts->{2} || 0) & 0xffff) - $evtnum; while ($rate < 0) {$rate += 2**16;} @@ -47,6 +50,17 @@ while (1) { my $status = ""; my $longmsg = "Read-out has no error"; + my $gbesum = 0; + if($oldgberate) { + foreach my $h (keys %{$gbe_rate}) { + my $t = ($gbe_rate->{$h} - $oldgberate->{$h}); + $t += 2**32 if $t < 0; + $gbesum += $t; + } + $status = QA::SciNotation($gbesum)."B/s"; + } + $oldgberate = $gbe_rate; + if($rate == 0 && ($rh_status->{3} & (1 << 31)) && ($rh_status->{3} & 0x3ff00000)) { my $rh_hubs = trb_register_read(0xfffe,0x81) or sleep 5 and next; foreach my $h (sort keys %$rh_hubs) { @@ -70,5 +84,5 @@ while (1) { QA::WriteQALog($fqa, "daq", "readout", 30, $qastate,"Read-out", $status,$longmsg); # print $qastate." ".$status." ".$longmsg."\n"; - sleep(5); + sleep(1); } diff --git a/hmon/hmon_richrate.pl b/hmon/hmon_richrate.pl index 1bd86ca..0b3c046 100755 --- a/hmon/hmon_richrate.pl +++ b/hmon/hmon_richrate.pl @@ -106,7 +106,7 @@ showvalues => 0, }; HPlot::PlotInit($plot0); -my $str = Hmon::MakeTitle(20, 17, "RICH Hit Rate"); +my $str = Hmon::MakeTitle(20, 17, "RICH Hit Rate",0); $str .= qq@
\n@; $str .= qq@
\n@; $str .= qq@
\n@; diff --git a/hmon/index.cgi b/hmon/index.cgi index 3479a25..27df16f 100755 --- a/hmon/index.cgi +++ b/hmon/index.cgi @@ -31,12 +31,13 @@ function openwin(url) {
  • Logfile (most important messages)
  • Chat Log
  • Web Tools
  • +
  • Eventbuilder Monitor