";
$last_tty=$cl->{"tty"};
}
# TIME
if ($Config{"show_time"} =~ /^y/i) {
$Result{"body"} .= "".
$hour. ":". $min. ":". $sec.
" | ";
} else {
$Result{"body"} .= " | "
}
# COMMAND
$Result{"body"} .= "\n";
$Result{"body"} .= "\n";
my $cline = $cl->{"prompt"}.$cl->{"cline"};
$cline =~ s/\n//;
#$cline .= "(".$Sessions{$cl->{local_session_id}}.")";
my $hint = make_comment($cl->{"cline"});
$cline = "$cline " if $hint;
$Result{"body"} .= $cline;
$Result{"body"} .= " \n";
my $last_command = $cl->{"last_command"};
if (!(
$Config{"suppress_editors"} =~ /^y/i && grep ($_ eq $last_command, @{$Config{"editors"}}) ||
$Config{"suppress_pagers"} =~ /^y/i && grep ($_ eq $last_command, @{$Config{"pagers"}}) ||
$Config{"suppress_terminal"}=~ /^y/i && grep ($_ eq $last_command, @{$Config{"terminal"}})
)) {
$Result{"body"} .= "";
$Result{"body"} .= $output;
$Result{"body"} .= " \n";
}
# DIFF
if ( $Config{"show_diffs"} =~ /^y/i && $cl->{"diff"}) {
$Result{"body"} .= " | ";
$Result{"body"} .= $cl->{"diff"};
$Result{"body"} .= " | ";
}
#NOTES
if ( $Config{"show_notes"} =~ /^y/i && $cl->{"note"}) {
my $note=$cl->{"note"};
$note =~ s/\n/ \n/msg;
$note =~ s@(http:[a-zA-Z.0-9/?%-]*)@$1@g;
$note =~ s@(www\.[a-zA-Z.0-9/?%-]*)@$1@g;
# Ширину пока не используем
# $Result{"body"} .= "";
$Result{"body"} .= "";
$Result{"body"} .= "".$cl->{note_title}." | " if $cl->{note_title};
$Result{"body"} .= "".$note." | ";
$Result{"body"} .= " \n";
}
# COMMENT
if ( $Config{"show_comments"} =~ /^y/i) {
my $comment = make_comment($cl->{"cline"});
if ($comment) {
$Result{"body"} .= "".
" | ";
$Result{"body"} .= "";
$Result{"body"} .= $comment;
$Result{"body"} .= " \n";
$Result{"body"} .= " | ";
}
}
# Вывод очередной команды окончен
$Result{"body"} .= "\n";
$Result{"body"} .= "\n";
}
$Result{"body"} .= " \n";
#$Result{"stat"} = " ";
%StatNames = (
FirstCommand => "Время первой команды журнала",
LastCommand => "Время последней команды журнала",
TotalCommands => "Количество командных строк в журнале",
ErrorsPercentage => "Процент команд с ненулевым кодом завершения, %",
TotalTime => "Суммарное время работы с терминалом *, час",
CommandsPerTime => "Количество командных строк в единицу времени, команда/мин",
CommandsFDistribution => "Частота использования команд",
CommandsFDistribution => "Частота использования команд",
RareCommands => "Частота использования этих команд < 0.5%",
);
@StatOrder = (
FirstCommand,
LastCommand,
TotalCommands,
ErrorsPercentage,
TotalTime,
CommandsPerTime,
CommandsFDistribution,
RareCommands,
);
# Подготовка статистики к выводу
# Некоторые значения пересчитываются!
# Дальше их лучше уже не использовать!!!
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($Stat{FirstCommand});
$Stat{FirstCommand} = sprintf "%02i:%02i:%02i %04i-%2i-%2i", $hour, $min, $sec, $year+1900, $mon+1, $mday;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($Stat{LastCommand});
$Stat{LastCommand} = sprintf "%02i:%02i:%02i %04i-%2i-%2i", $hour, $min, $sec, $year+1900, $mon+1, $mday;
$Stat{ErrorsPercentage} = sprintf "%5.2f", $Stat{ErrorCommands}*100/$Stat{TotalCommands}
if $Stat{TotalCommands};
$Stat{CommandsPerTime} = sprintf "%5.2f", $Stat{TotalCommands}*60/$Stat{TotalTime}
if $Stat{TotalTime};
$Stat{TotalTime} = sprintf "%5.2f", $Stat{TotalTime}/60/60;
my $total_commands=0;
for $command (keys %CommandsFDistribution){
$total_commands += $CommandsFDistribution{$command};
}
if ($total_commands) {
for $command (reverse sort {$CommandsFDistribution{$a} <=> $CommandsFDistribution{$b}} keys %CommandsFDistribution){
my $command_html;
my $percentage = sprintf "%5.2f",$CommandsFDistribution{$command}*100/$total_commands;
if ($percentage < 0.5) {
my $hint = make_comment($command);
$command_html = "$command";
$command_html = "$command_html" if $hint;
my $command_html = "$command_html";
$Stat{RareCommands} .= $command_html."".$CommandsFDistribution{$command}." , ";
}
else {
my $hint = make_comment($command);
$command_html = "$command";
$command_html = "$command_html" if $hint;
my $command_html = "$command_html";
$percentage = sprintf "%5.2f",$percentage;
$Stat{CommandsFDistribution} .= " |