summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2002-07-17 18:53:15 +0000
committerPeter Palfrader <peter@palfrader.org>2002-07-17 18:53:15 +0000
commitd43f43f5c9453ebeaaab8704e5b1b8a1f1b67114 (patch)
tree5a1a71e06c816589b94fa85c3d3789742525bfde
parent4556e8641919997ee102d066dd173a15da3bdff5 (diff)
Stats can be sorted by latency rather than nick
-rw-r--r--Echolot/Config.pm3
-rw-r--r--Echolot/Stats.pm6
-rw-r--r--NEWS2
-rw-r--r--doc/pingd.conf.pod10
4 files changed, 19 insertions, 2 deletions
diff --git a/Echolot/Config.pm b/Echolot/Config.pm
index e01461e..98474a3 100644
--- a/Echolot/Config.pm
+++ b/Echolot/Config.pm
@@ -1,7 +1,7 @@
package Echolot::Config;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Config.pm,v 1.29 2002/07/17 17:53:44 weasel Exp $
+# $Id: Config.pm,v 1.30 2002/07/17 18:53:15 weasel Exp $
#
=pod
@@ -73,6 +73,7 @@ sub init($) {
seperate_rlists => 0,
combined_list => 0,
thesaurus => 1,
+ stats_sort_by_latency => 0,
# Timers and Counters
processmail => 60, # process incomng mail every minute
diff --git a/Echolot/Stats.pm b/Echolot/Stats.pm
index 3efc5e5..402cbd9 100644
--- a/Echolot/Stats.pm
+++ b/Echolot/Stats.pm
@@ -1,7 +1,7 @@
package Echolot::Stats;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Stats.pm,v 1.21 2002/07/16 02:48:57 weasel Exp $
+# $Id: Stats.pm,v 1.22 2002/07/17 18:53:15 weasel Exp $
#
=pod
@@ -451,13 +451,17 @@ sub build_rems($) {
'address' => $addr,
'showit' => $remailer->{'showit'}
};
+ $rem->{'latency'} = $rem->{'stats'}->{'avr_latency'}; # for sorting purposes only
+ $rem->{'latency'} = 9999 unless defined $rem->{'latency'};
$rems{$addr} = $rem if (defined $rem->{'stats'} && defined $rem->{'nick'} && defined $rem->{'address'} && defined $rem->{'caps'} );
};
+ my $sort_by_latency = Echolot::Config::get()->{'stats_sort_by_latency'};
my @rems =
sort {
- ($a->{'stats'}->{'avr_reliability'} <=> $b->{'stats'}->{'avr_reliability'}) ||
+ (($a->{'latency'} <=> $b->{'latency'}) * $sort_by_latency) ||
($a->{'nick'} cmp $b->{'nick'})
} map { $rems{$_} } keys %rems;
diff --git a/NEWS b/NEWS
index 7071c95..91dab54 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ Changes in version
* The getkeyconf config option was replaced by getkeyconf_interval and
getkeyconf_every_nth_time. Not all requests are sent at the same time
any more.
+ * Stats can be sorted by latency rather than nick. Set
+ stats_sort_by_latency if you want that.
Changes in version 2.0beta15 - 2002-07-16
* Have echolot version in stats HTML pages
diff --git a/doc/pingd.conf.pod b/doc/pingd.conf.pod
index 6e12158..4af2575 100644
--- a/doc/pingd.conf.pod
+++ b/doc/pingd.conf.pod
@@ -200,6 +200,16 @@ Collect Thesaurus data and build Thesaurus' Index.
Default: 'thesaurus' => 1,
Example: 'thesaurus' => 0,
+=item B<stats_sort_by_latency>
+
+In statistics output remailers are sorted by reliability as the primary key.
+The secondary key usually is nickname. If you prefer to sort by latency rather
+than nick set this to 1 (-1 if you want to reverse the order).
+
+ Default: 'stats_sort_by_latency' => 0,
+ Example: 'stats_sort_by_latency' => 1,
+
+
=back