2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-07 16:59:18 +00:00

HMInfo:burst count statistics

git-svn-id: https://svn.fhem.de/fhem/trunk@16928 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2018-07-01 12:39:50 +00:00
parent c5bf904c10
commit 332012e1da

View File

@ -1087,41 +1087,60 @@ sub HMinfo_getEntities(@) { ###################################################
return sort(@names); return sort(@names);
} }
sub HMinfo_getMsgStat() { ##################################################### sub HMinfo_getMsgStat() { #####################################################
my ($hr,$dr,$hs,$ds); my ($hr,$dr,$hs,$ds,$hrb,$drb,$hsb,$dsb);
$hr = sprintf("\n %-14s:","receive hour"); my ($hstr,$dstr) = (" "," ");
$hs = sprintf("\n %-14s:","send hour"); $hstr .= sprintf("| %02d",$_) foreach (0..23);
$dr = sprintf("\n %-14s:","receive day"); $dstr .= sprintf("|%4s",$_) foreach ("Mon","Tue","Wed","Thu","Fri","Sat","Sun","# 24h");
$ds = sprintf("\n %-14s:","send day");
$hr .= sprintf("| %02d",$_) foreach (0..23); $hr = "\nreceive " .$hstr;
$hs .= sprintf("| %02d",$_) foreach (0..23); $hs = "\nsend ";
$dr .= sprintf("|%4s",$_) foreach ("Mon","Tue","Wed","Thu","Fri","Sat","Sun","# 24h"); $hrb = "\nreceive burst ";
$ds .= sprintf("|%4s",$_) foreach ("Mon","Tue","Wed","Thu","Fri","Sat","Sun","# 24h"); $hsb = "\nsend burst ";
$dr = "\nreceive " .$dstr;
$ds = "\nsend ";
$drb = "\nreceive burst ";
$dsb = "\nsend burst ";
my $tsts = "\n |";
foreach my $ioD(keys %{$modules{CUL_HM}{stat}{r}}){ foreach my $ioD(keys %{$modules{CUL_HM}{stat}{r}}){
next if ($ioD eq "dummy"); next if ($ioD eq "dummy");
$hr .= sprintf("\n %-10s:",$ioD); my $ioDs = sprintf("\n %-10s:",$ioD);
$hs .= sprintf("\n %-10s:",$ioD); $hr .= $ioDs;
$dr .= sprintf("\n %-10s:",$ioD); $hs .= $ioDs;
$ds .= sprintf("\n %-10s:",$ioD); $hrb.= $ioDs;
$hr .= sprintf("|%3d",$modules{CUL_HM}{stat}{r}{$ioD}{h}{$_}) foreach (0..23); $hsb.= $ioDs;
$hs .= sprintf("|%3d",$modules{CUL_HM}{stat}{s}{$ioD}{h}{$_}) foreach (0..23); $dr .= $ioDs;
$dr .= sprintf("|%4d",$modules{CUL_HM}{stat}{r}{$ioD}{d}{$_}) foreach (0..6); $ds .= $ioDs;
$ds .= sprintf("|%4d",$modules{CUL_HM}{stat}{s}{$ioD}{d}{$_}) foreach (0..6); $drb.= $ioDs;
$dsb.= $ioDs;
$hr .= sprintf("|%3d",$modules{CUL_HM}{stat}{r}{$ioD}{h}{$_}) foreach (0..23);
$hs .= sprintf("|%3d",$modules{CUL_HM}{stat}{s}{$ioD}{h}{$_}) foreach (0..23);
$hrb.= sprintf("|%3d",$modules{CUL_HM}{stat}{rb}{$ioD}{h}{$_}) foreach (0..23);
$hsb.= sprintf("|%3d",$modules{CUL_HM}{stat}{sb}{$ioD}{h}{$_}) foreach (0..23);
$dr .= sprintf("|%4d",$modules{CUL_HM}{stat}{r}{$ioD}{d}{$_}) foreach (0..6);
$ds .= sprintf("|%4d",$modules{CUL_HM}{stat}{s}{$ioD}{d}{$_}) foreach (0..6);
$drb.= sprintf("|%4d",$modules{CUL_HM}{stat}{rb}{$ioD}{d}{$_}) foreach (0..6);
$dsb.= sprintf("|%4d",$modules{CUL_HM}{stat}{sb}{$ioD}{d}{$_}) foreach (0..6);
my ($tdr,$tds); my ($tdr,$tds,$tdrb,$tdsb);
$tdr += $modules{CUL_HM}{stat}{r}{$ioD}{h}{$_} foreach (0..23); $tdr += $modules{CUL_HM}{stat}{r}{$ioD}{h}{$_} foreach (0..23);
$tds += $modules{CUL_HM}{stat}{s}{$ioD}{h}{$_} foreach (0..23); $tds += $modules{CUL_HM}{stat}{s}{$ioD}{h}{$_} foreach (0..23);
$tdrb += $modules{CUL_HM}{stat}{rb}{$ioD}{h}{$_} foreach (0..23);
$tdsb += $modules{CUL_HM}{stat}{sb}{$ioD}{h}{$_} foreach (0..23);
$dr .= sprintf("|#%4d",$tdr); $dr .= sprintf("|#%4d",$tdr);
$ds .= sprintf("|#%4d",$tds); $ds .= sprintf("|#%4d",$tds);
$drb.= sprintf("|#%4d",$tdrb);
$dsb.= sprintf("|#%4d",$tdsb);
} }
my @l = localtime(gettimeofday()); my @l = localtime(gettimeofday());
my $tsts = "\n |";
$tsts .= "----" foreach (1..$l[2]); $tsts .= "----" foreach (1..$l[2]);
$tsts .= ">*" ; $tsts .= ">*" ;
return "msg statistics\n" return "msg statistics\n"
.$tsts .$tsts
.$hr.$hs .$hr.$hs.$hrb.$hsb
."\n ".$hstr
.$tsts .$tsts
.$dr.$ds .$dr.$ds.$drb.$dsb
."\n ".$dstr
; ;
} }
@ -1155,15 +1174,15 @@ sub HMinfo_GetFn($@) {#########################################################
my $nl = length($dName); my $nl = length($dName);
$maxNlen = $nl if($nl > $maxNlen); $maxNlen = $nl if($nl > $maxNlen);
my ($found,$para) = HMinfo_getParam($id, my ($found,$para) = HMinfo_getParam($id,
,"protState","protCmdPend" ,"protState","protCmdPend","protSnd"
,"protSnd","protLastRcv","protResnd" ,"protSndB","protLastRcv"
,"protCmdDel","protResndFail","protNack","protIOerr"); ,"protResnd","protCmdDel","protResndFail","protNack","protIOerr");
$para =~ s/( last_at|20..-|\|)//g; $para =~ s/( last_at|20..-|\|)//g;
my @pl = split "\t",$para; my @pl = split "\t",$para;
foreach (@pl){ foreach (@pl){
$_ =~ s/\s+$|//g ; $_ =~ s/\s+$|//g ;
$_ =~ s/CMDs_//; $_ =~ s/CMDs_//;
$_ =~ s/..-.. ..:..:..//g if ($type eq "short"); $_ =~ s/:*..-.. ..:..:..//g if ($type eq "short");
$_ =~ s/CMDs // if ($type eq "short"); $_ =~ s/CMDs // if ($type eq "short");
} }
@ -1179,26 +1198,27 @@ sub HMinfo_GetFn($@) {#########################################################
my @paramList; my @paramList;
if ($type eq "short"){ if ($type eq "short"){
push @paramList, sprintf("%-${maxNlen}s%-17s|%-10s|%-10s|%-10s#%-10s|%-10s|%-10s|%-10s", push @paramList, sprintf("%-${maxNlen}s%-17s|%-10s|%-10s|%-10s#%-10s|%-10s|%-10s|%-10s",
@{$_}[0..3],@{$_}[5..9]) foreach(@paramList2); @{$_}[0..3],@{$_}[6..10]) foreach(@paramList2);
$hdr = sprintf("%-${maxNlen}s:%-16s|%-10s|%-10s|%-10s#%-10s|%-10s|%-10s|%-10s", $hdr = sprintf("%-${maxNlen}s:%-16s|%-10s|%-10s|%-10s#%-10s|%-10s|%-10s|%-10s",
,"name" ,"name","State","CmdPend"
,"State","CmdPend" ,"Snd"
,"Snd","Resnd" ,"Resnd"
,"CmdDel","ResndFail","Nack","IOerr"); ,"CmdDel","ResndFail","Nack","IOerr");
$ftr = sprintf("%-${maxNlen}s%-17s|%-10s|%-10s|%-10s#%-10s|%-10s|%-10s|%-10s","sum",@plSum[1..3],@plSum[5..9]); $ftr = sprintf("%-${maxNlen}s%-17s|%-10s|%-10s|%-10s#%-10s|%-10s|%-10s|%-10s","sum",@plSum[1..3],@plSum[5..9]);
} }
else{ else{
push @paramList, sprintf("%-${maxNlen}s%-17s|%-18s|%-18s|%-14s|%-18s#%-18s|%-18s|%-18s|%-18s", push @paramList, sprintf("%-${maxNlen}s%-17s|%-18s|%-19s|%-18s|%-15s|%-18s#%-18s|%-18s|%-18s|%-18s",
@{$_}[0..9]) foreach(@paramList2); @{$_}[0..10]) foreach(@paramList2);
$hdr = sprintf("%-${maxNlen}s:%-16s|%-18s|%-18s|%-14s|%-18s#%-18s|%-18s|%-18s|%-18s", $hdr = sprintf("%-${maxNlen}s:%-16s|%-18s|%-19s|%-18s|%-15s|%-18s#%-18s|%-18s|%-18s|%-18s",
,"name" ,"name","State","CmdPend"
,"State","CmdPend" ,"Snd"
,"Snd","LastRcv","Resnd" ,"SndB","LastRcv"
,"Resnd"
,"CmdDel","ResndFail","Nack","IOerr"); ,"CmdDel","ResndFail","Nack","IOerr");
$ftr = sprintf("%-${maxNlen}20s%-17s|%-18s|%-18s|%-14s|%-18s#%-18s|%-18s|%-18s|%-18s","sum",@plSum[1..9]); $ftr = sprintf("%-${maxNlen}s%-17s|%-18s|%-19s|%-18s|%-15s|%-18s#%-18s|%-18s|%-18s|%-18s","sum",@plSum[1..9]);
} }
$ret = $cmd." done:" $ret = $cmd." send to devices done:"
."\n ".$hdr ."\n ".$hdr
."\n ".(join "\n ",sort @paramList) ."\n ".(join "\n ",sort @paramList)
."\n================================================================================================================" ."\n================================================================================================================"