Files
archie/scripts/eval-perf.pl
Mario Fetka 1e4baef047 Port Archie 3.5 to Linux/CMake, add Debian packaging and CI
- Replace autoconf/make build system with CMake (installs to /opt/archie)
- Add CPack DEB packaging for Debian Trixie (non-free/net, postinst creates
  archie user, extracts DB skeleton, sets setuid bits, enables systemd units)
- Add Gitea Actions workflow building .deb + binary/source tarballs on tag push
- Add portable archie_init.py for non-Debian post-install setup
- Port all scripts to Linux: getent passwd, systemctl, tail -n +N, gzip
- Add SFTP (libssh2) and FTPS (OpenSSL) scrapers alongside anonftp
- Add Flask web frontend (archie-web.service)
- Fix filter scripts (exec cat replaces broken sed s///g)
- Update all manpages: paths, contacts, add SFTP/FTPS section
- Update etc/: enable gzip, add webindex catalog, fix localhost refs
- Remove: AIX-2/SunOS-4.1.4/SunOS-5.4 dirs, tcl7.6/, tcl-dp/, tk4.2/,
  berkdb/, old Makefile.in/pre/post fragments, build.sh, unwrap scripts
- Add .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 23:05:12 +02:00

75 lines
2.3 KiB
Perl
Executable File

#!/usr/bin/env perl
#
# evaluate the ~archie/pfs/pfs.log file (from standard input).
#
# written by Thomas Lenggenhager, SWICH <lenggenhager@switch.ch>
# 940731
#
open(OUT, ">performance");
while (<>) {
if (/^(..-...-..) (..):(..):(..) .* - L ARCHIE\/MATCH\((\d*).*(.)\)(.*)/) {
$date = $1; $hour = $2; $min = $3; $sec = $4;
$max = $5; $type = $6; $string = $7;
$search = 1;
} elsif (/^(..-...-..) (..):(..):(..) .* - matches: (\d*)/) {
next unless $search;
$search = 0;
$match = $5;
if ($hour > $2) {
$secs = 60 - $sec;
$secs += (60 - $min - 1) * 60;
$secs += (($2 * 60) + $3) * 60 + $4;
} elsif ($min > $3) {
$secs = 60 - $sec;
$secs += (60 - $min -1) * 60;
$secs += (((($2 - $hour - 1) * 60) + $3) * 60) + $4;
} elsif ($sec > $4) {
$secs = 60 - $sec;
$secs += ($3 - $min - 1) * 60 + $4;
} else {
$secs = $4 - $sec;
}
print OUT "$hour:$min:$sec - $2:$3:$4\t$secs\t$type $max\t$match\t$string\n";
$count++;
$sum += $secs;
$sqsum += $secs * $secs;
$count{$type}++;
$sum{$type} += $secs;
$sqsum{$type} += $secs * $secs;
if ($secs > $maxsecs) {
$maxsecs = $secs;
}
if ($secs > $maxsecs{$type}) {
$maxsecs{$type} = $secs;
}
if ($secs > 120) {
print OUT "$hour:$min:$sec - $2:$3:$4\t$secs\t$type $max\t$match\t$string\n";
}
# last if $count == 500;
}
}
print OUT "\nResults for all Queries:\n";
if ($count < 2) {
print OUT "No data in log file\n";
exit
}
$medium = $sum/$count;
$variance = ($sqsum - $medium)/($count - 1);
printf OUT "Samples:\t%d\n", $count;
printf OUT "Mean:\t\t%f\n", $medium;
printf OUT "Std.-deviation:\t%f\n", sqrt($variance);
printf OUT "Maximum:\t%d\n", $maxsecs;
print OUT "\n";
foreach $type (sort keys %count) {
next if ($count{$type} < 2);
print OUT "Results for <$type> Queries:\n";
$medium = $sum{$type}/$count{$type};
$variance = ($sqsum{$type} - $medium)/($count{$type} - 1);
printf OUT "Samples:\t%d\n", $count{$type};
printf OUT "Mean:\t\t%f\n", $medium;
printf OUT "Std.-deviation:\t%f\n", sqrt($variance);
printf OUT "Maximum:\t%d\n", $maxsecs{$type};
print OUT "\n";
}