mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 07:56:03 +00:00
98_apptime:introduce timestamp
git-svn-id: https://svn.fhem.de/fhem/trunk@14087 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
60730c8535
commit
2492d61fea
@ -88,9 +88,9 @@ sub apptime_getTiming($$$@) {
|
|||||||
!$defs{$e}{helper}{bm} ||
|
!$defs{$e}{helper}{bm} ||
|
||||||
!$defs{$e}{helper}{bm}{$fnName} ){
|
!$defs{$e}{helper}{bm}{$fnName} ){
|
||||||
|
|
||||||
%{$defs{$e}{helper}{bm}{$fnName}} =(max =>0, mAr =>"",
|
%{$defs{$e}{helper}{bm}{$fnName}} =(max => 0, mAr => "",
|
||||||
cnt =>1, tot =>0,
|
cnt => 1, tot => 0,
|
||||||
dmx =>0);
|
dmx => 0, mTS => "");
|
||||||
|
|
||||||
$h = $defs{$e}{helper}{bm}{$fnName};
|
$h = $defs{$e}{helper}{bm}{$fnName};
|
||||||
}
|
}
|
||||||
@ -114,6 +114,7 @@ sub apptime_getTiming($$$@) {
|
|||||||
if ($ts1 && $h->{max} < $ts1){
|
if ($ts1 && $h->{max} < $ts1){
|
||||||
$h->{max} = $ts1;
|
$h->{max} = $ts1;
|
||||||
$h->{mAr} = \@arg;
|
$h->{mAr} = \@arg;
|
||||||
|
$h->{mTS}= strftime("%d.%m. %H:%M:%S", localtime());
|
||||||
}
|
}
|
||||||
|
|
||||||
$h->{tot} += $ts1;
|
$h->{tot} += $ts1;
|
||||||
@ -164,7 +165,7 @@ sub apptime_CommandDispTiming($$@) {
|
|||||||
${$h->{mAr}}[$i] = "HASH(".${$h->{mAr}}[$i]->{NAME}.")";
|
${$h->{mAr}}[$i] = "HASH(".${$h->{mAr}}[$i]->{NAME}.")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$arg = join ("; ",@{$h->{mAr}});
|
$arg = join ("; ", map { $_ // "(undef)" } @{$h->{mAr}});
|
||||||
}
|
}
|
||||||
|
|
||||||
push @bmArr,[($n,$t
|
push @bmArr,[($n,$t
|
||||||
@ -173,6 +174,7 @@ sub apptime_CommandDispTiming($$@) {
|
|||||||
,$h->{tot}
|
,$h->{tot}
|
||||||
,$h->{tot} /$h->{cnt}
|
,$h->{tot} /$h->{cnt}
|
||||||
,$h->{dmx}
|
,$h->{dmx}
|
||||||
|
,$h->{mTS}
|
||||||
,$arg
|
,$arg
|
||||||
)];
|
)];
|
||||||
}
|
}
|
||||||
@ -182,12 +184,12 @@ sub apptime_CommandDispTiming($$@) {
|
|||||||
if ($field>1){@bmArr = sort { $b->[$field] <=> $a->[$field] } @bmArr;}
|
if ($field>1){@bmArr = sort { $b->[$field] <=> $a->[$field] } @bmArr;}
|
||||||
else {@bmArr = sort { $b->[$field] cmp $a->[$field] } @bmArr;}
|
else {@bmArr = sort { $b->[$field] cmp $a->[$field] } @bmArr;}
|
||||||
my $ret = ($apptimeStatus ? "" : "------ apptime PAUSED data collection ----------\n")
|
my $ret = ($apptimeStatus ? "" : "------ apptime PAUSED data collection ----------\n")
|
||||||
.sprintf("\n %35s %20s %6s %6s %8s %8s %s",
|
.sprintf("\n %-40s %-35s %6s %6s %8s %8s %6s %-15s %s",
|
||||||
"name","function","max","count","total","average","maxDly","param Max call");
|
"name","function","max","count","total","average","maxDly","TS Max call","param Max call");
|
||||||
my $end = ($top && $top eq "top")?20:@bmArr-1;
|
my $end = ($top && $top eq "top")?20:@bmArr-1;
|
||||||
$end = @bmArr-1 if ($end>@bmArr-1);
|
$end = @bmArr-1 if ($end>@bmArr-1);
|
||||||
|
|
||||||
$ret .= sprintf("\n %35s %20s %6d %6d %8d %8.2f %6d %s",@{$bmArr[$_]})for (0..$end);
|
$ret .= sprintf("\n %-40s %-35s %6d %6d %8d %8.2f %6d %-15s %s",@{$bmArr[$_]})for (0..$end);
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user