";
+ $last_tty=$cl->{"tty"};
+ }
- # TIME
- if ($Config{"show_time"} =~ /^y/i) {
- $Result{"body"} .= "".
- $hour. ":". $min. ":". $sec.
- " | ";
- } else {
- $Result{"body"} .= " | "
- }
+ # 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//;
+ # 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";
+ #$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"}})
- )) {
+ 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";
- }
+ $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";
- }
+ # 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"} .= " | ";
- }
- }
+ # 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{"body"} .= "\n";
+ }
- $Result{"body"} .= " \n";
+ $Result{"body"} .= " \n";
- #$Result{"stat"} = " ";
+ #$Result{"stat"} = " ";
- %StatNames = (
- FirstCommand => "Время первой команды журнала",
- LastCommand => "Время последней команды журнала",
- TotalCommands => "Количество командных строк в журнале",
- ErrorsPercentage => "Процент команд с ненулевым кодом завершения, %",
- TotalTime => "Суммарное время работы с терминалом *, час",
- CommandsPerTime => "Количество командных строк в единицу времени, команда/мин",
- CommandsFrequency => "Частота использования команд",
- RareCommands => "Частота использования этих команд < 0.5%",
- );
- @StatOrder = (
- FirstCommand,
- LastCommand,
- TotalCommands,
- ErrorsPercentage,
- TotalTime,
- CommandsPerTime,
- CommandsFrequency,
- RareCommands,
- );
+ %StatNames = (
+ FirstCommand => "Время первой команды журнала",
+ LastCommand => "Время последней команды журнала",
+ TotalCommands => "Количество командных строк в журнале",
+ ErrorsPercentage => "Процент команд с ненулевым кодом завершения, %",
+ TotalTime => "Суммарное время работы с терминалом *, час",
+ CommandsPerTime => "Количество командных строк в единицу времени, команда/мин",
+ CommandsFrequency => "Частота использования команд",
+ RareCommands => "Частота использования этих команд < 0.5%",
+ );
+ @StatOrder = (
+ FirstCommand,
+ LastCommand,
+ TotalCommands,
+ ErrorsPercentage,
+ TotalTime,
+ CommandsPerTime,
+ CommandsFrequency,
+ RareCommands,
+ );
- # Подготовка статистики к выводу
- # Некоторые значения пересчитываются!
- # Дальше их лучше уже не использовать!!!
+ # Подготовка статистики к выводу
+ # Некоторые значения пересчитываются!
+ # Дальше их лучше уже не использовать!!!
- my %CommandsFrequency = %CommandsFDistribution;
+ my %CommandsFrequency = %CommandsFDistribution;
- $Stat{TotalTime} ||= 0;
- my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($Stat{FirstCommand} || 0);
- $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} || 0);
- $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;
+ $Stat{TotalTime} ||= 0;
+ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($Stat{FirstCommand} || 0);
+ $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} || 0);
+ $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 %CommandsFrequency){
- $total_commands += $CommandsFrequency{$command};
- }
- if ($total_commands) {
- for $command (reverse sort {$CommandsFrequency{$a} <=> $CommandsFrequency{$b}} keys %CommandsFrequency){
- my $command_html;
- my $percentage = sprintf "%5.2f",$CommandsFrequency{$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."".$CommandsFrequency{$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{CommandsFrequency} .= " | ".$command_html." | ".$CommandsFrequency{$command}." | ".
- "|".("="x int($CommandsFrequency{$command}*100/$total_commands))."| $percentage% | ";
- }
- }
- $Stat{CommandsFrequency} = " ".$Stat{CommandsFrequency}." ";
- $Stat{RareCommands} =~ s/, $// if $Stat{RareCommands};
- }
+ my $total_commands=0;
+ for $command (keys %CommandsFrequency){
+ $total_commands += $CommandsFrequency{$command};
+ }
+ if ($total_commands) {
+ for $command (reverse sort {$CommandsFrequency{$a} <=> $CommandsFrequency{$b}} keys %CommandsFrequency){
+ my $command_html;
+ my $percentage = sprintf "%5.2f",$CommandsFrequency{$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."".$CommandsFrequency{$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{CommandsFrequency} .= " |