lilalo

diff l3-frontend @ 37:219389279acb

Множество изменений, которые были сделаны в ходе
первой обкатки LiLaLo в реальных условиях.

Добавлена фильтрация и возможность просмотра
смешанного журнала с хоста, без разделения по пользователям
author devi
date Fri Nov 18 17:46:09 2005 +0200 (2005-11-18)
parents cb822611b240
children 466bea239d25
line diff
     1.1 --- a/l3-frontend	Mon Nov 14 21:24:14 2005 +0200
     1.2 +++ b/l3-frontend	Fri Nov 18 17:46:09 2005 +0200
     1.3 @@ -355,7 +355,7 @@
     1.4  					$j++;
     1.5  					$j++ while ($j <= @Command_Lines  && $Command_Lines[$j]->{tty} ne $$cl->{tty} || !$Command_Lines[$j]);
     1.6  				}
     1.7 -				$Command_Lines[$j]->{note}="$2";
     1.8 +				$Command_Lines[$j]->{note}.="$2\n";
     1.9  				$$cl=0;
    1.10  			}
    1.11  		}
    1.12 @@ -414,13 +414,13 @@
    1.13  				$filter{$var} = $val;
    1.14  			}
    1.15  
    1.16 -			if ($filter{hostname}) {
    1.17 -				next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{hostname} eq $filter{hostname};
    1.18 +			for my $filter_key (keys %filter) {
    1.19 +				next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{$filter_key} eq $filter{$filter_key};
    1.20  			}
    1.21  
    1.22 -			if ($filter{user}) {
    1.23 -				next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{user} eq $filter{user};
    1.24 -			}
    1.25 +			#if ($filter{user}) {
    1.26 +			#	next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{user} eq $filter{user};
    1.27 +			#}
    1.28  
    1.29  			#for my $filter_field (keys %filter) {
    1.30  			#	next COMMAND_LINE unless $Sessions{$cl->{local_session_id}}->{$filter_field} eq $filter{$filter_field};
    1.31 @@ -635,8 +635,7 @@
    1.32  		ErrorsPercentage => "Процент команд с ненулевым кодом завершения, %",
    1.33  		TotalTime => "Суммарное время работы с терминалом <sup><font size='-2'>*</font></sup>, час",
    1.34  		CommandsPerTime => "Количество командных строк в единицу времени, команда/мин",
    1.35 -		CommandsFDistribution => "Частота использования команд",
    1.36 -		CommandsFDistribution => "Частота использования команд",
    1.37 +		CommandsFrequency => "Частота использования команд",
    1.38  		RareCommands	=> "Частота использования этих команд < 0.5%",
    1.39  	);
    1.40  	@StatOrder = (
    1.41 @@ -646,7 +645,7 @@
    1.42  		ErrorsPercentage,
    1.43  		TotalTime,
    1.44  		CommandsPerTime,
    1.45 -		CommandsFDistribution,
    1.46 +		CommandsFrequency,
    1.47  		RareCommands,
    1.48  	);
    1.49  
    1.50 @@ -654,6 +653,8 @@
    1.51  	# Некоторые значения пересчитываются!
    1.52  	# Дальше их лучше уже не использовать!!!
    1.53  
    1.54 +	my %CommandsFrequency = %CommandsFDistribution;
    1.55 +
    1.56  	my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($Stat{FirstCommand});
    1.57  	$Stat{FirstCommand} = sprintf "%02i:%02i:%02i %04i-%2i-%2i", $hour, $min, $sec,  $year+1900, $mon+1, $mday;
    1.58  	($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($Stat{LastCommand});
    1.59 @@ -665,19 +666,19 @@
    1.60  	$Stat{TotalTime} = sprintf "%5.2f", $Stat{TotalTime}/60/60;
    1.61  
    1.62  	my $total_commands=0;
    1.63 -	for $command (keys %CommandsFDistribution){
    1.64 -		$total_commands += $CommandsFDistribution{$command};
    1.65 +	for $command (keys %CommandsFrequency){
    1.66 +		$total_commands += $CommandsFrequency{$command};
    1.67  	}
    1.68  	if ($total_commands) {
    1.69 -		for $command (reverse sort {$CommandsFDistribution{$a} <=> $CommandsFDistribution{$b}} keys %CommandsFDistribution){
    1.70 +		for $command (reverse sort {$CommandsFrequency{$a} <=> $CommandsFrequency{$b}} keys %CommandsFrequency){
    1.71  			my $command_html;
    1.72 -			my $percentage = sprintf "%5.2f",$CommandsFDistribution{$command}*100/$total_commands;
    1.73 +			my $percentage = sprintf "%5.2f",$CommandsFrequency{$command}*100/$total_commands;
    1.74  			if ($percentage < 0.5) {
    1.75  				my $hint = make_comment($command);
    1.76  				$command_html = "$command";
    1.77  				$command_html = "<span title='$hint' class='hint'>$command_html</span>" if $hint;
    1.78  				my $command_html = "<tt>$command_html</tt>";
    1.79 -				$Stat{RareCommands} .= $command_html."<sub><font size='-2'>".$CommandsFDistribution{$command}."</font></sub> , ";
    1.80 +				$Stat{RareCommands} .= $command_html."<sub><font size='-2'>".$CommandsFrequency{$command}."</font></sub> , ";
    1.81  			}
    1.82  			else {
    1.83  				my $hint = make_comment($command);
    1.84 @@ -685,11 +686,11 @@
    1.85  				$command_html = "<span title='$hint' class='hint'>$command_html</span>" if $hint;
    1.86  				my $command_html = "<tt>$command_html</tt>";
    1.87  				$percentage = sprintf "%5.2f",$percentage;
    1.88 -				$Stat{CommandsFDistribution} .= "<tr><td>".$command_html."</td><td>".$CommandsFDistribution{$command}."</td>".
    1.89 -					"<td>|".("="x int($CommandsFDistribution{$command}*100/$total_commands))."| $percentage%</td></tr>";
    1.90 +				$Stat{CommandsFrequency} .= "<tr><td>".$command_html."</td><td>".$CommandsFrequency{$command}."</td>".
    1.91 +					"<td>|".("="x int($CommandsFrequency{$command}*100/$total_commands))."| $percentage%</td></tr>";
    1.92  			}
    1.93  		}
    1.94 -		$Stat{CommandsFDistribution} = "<table>".$Stat{CommandsFDistribution}."</table>";
    1.95 +		$Stat{CommandsFrequency} = "<table>".$Stat{CommandsFrequency}."</table>";
    1.96  		$Stat{RareCommands} =~ s/, $// if $Stat{RareCommands};
    1.97  	}
    1.98