#!/bin/sh -- # A comment mentioning perl, to prevent perl from looping. Indented to work with bash. eval 'exec perl -S $0 ${1+"$@"}' if 0; #----------------------------------------------------------------------------- # latency version 0.1 # Copyright (c) 1997-2001 by Karl J. Runge #----------------------------------------------------------------------------- # Defaults: # (these variables may be overridden in ~/.latentcyrc or ./.latencyrc) $Bins = 78; $Histo = 'ascii'; # or 'plot' or '' $ConnectMode = 'echo'; # or 'rlogin' or ... $GetTimeMode = 'syscall'; # or 'external' for external C program $Prompt = ''; $Counts = 1000; $Refresh = 0; $LoopForever = 0; $Sleep = '0.0'; $Quiet = ''; $Timer = 'CPIPE'; # or C (For GetTimeMode = 'external') $Width = 10; $Decimals = 5; $ScrollMode = ''; $ExtendedScrolling = ''; $TimeRange = ''; $HeightRange = 1.0; $Timer_Prog_Bin = '/tmp/timeprog'; $Keep_Timer_Prog = 0; $Service_Match = 'echo|rlogin|smtp|ftp|nntp|annex|\d+'; $Freq = ''; $Initial_Skip = 1; $Echo_Size = 1; $Send_Char = "X"; #----------------------------------------------------------------------------- $DoRC = 1; foreach $arg (@ARGV) { $DoRC = 0 if $arg eq '-nc'; } $home = $ENV{'HOME'}; foreach $file ("$home/.latencyrc", "./.latencyrc") { next unless $DoRC; require $file if -f $file; } chop($Program = `basename $0`); $CaughtSignal = 0; $StartTime = time; $Usage = <<"END"; $Program: make a TCP connection to a remote host and measure "keystroke" latency. Print out statistics and a histogram of data. Usage: $Program [] Options: -r Use "rlogin" instead of "echo" service. matches the remote host cmd line prompt. Note: set to "." to match trimmed hostname. (e.g. "foo.bar.com" gets trimmed to "foo") -s Use for a dialog with remote host. Currently supported: $Service_Match (Hack: annex only works for vanilla Xylogics. \\d+ means a port number redirected to the echo (7) port on some machine.) -b For echo(7) service send text of bytes. and a newline (default: $Echo_Size). Note that -l flag will send an extra 5 bytes indicating the packet number. -C Use as the character to send instead of "$Send_Char" -c Measure keystrokes. (default: $Counts) -f Print out info every keystrokes (otherwise the printing frequency is determined dynamically). -k Skip the first packets in the averages. -l Loop forever. -R Refresh running min/max/ave stats every seconds. -S Scroll lines each refresh interval. -X Extended scrolling. When yields true, print a newline + timestamp. You can learn the available variable names, etc, from reading this script. Look for "ExtendedScrolling". IF ... THEN ... END ... are described there as well with examples. Also, -X is shorthand for times times greater than the running average of times. -i