diff options
author | roberto <roberto@FreeBSD.org> | 2008-08-22 15:58:00 +0000 |
---|---|---|
committer | roberto <roberto@FreeBSD.org> | 2008-08-22 15:58:00 +0000 |
commit | b85c7169a740b2edf0106ad59fdaa1b0160f823c (patch) | |
tree | 2b9fb7f64eacb322e95695e412c923e97ba33e88 /contrib/ntp/scripts/monitoring | |
parent | 1d197cfe9feac6bc29537d8e53c30b6435937b95 (diff) | |
parent | 7a6072eb585696f8856cd498c3fd194cf49f14c6 (diff) | |
download | FreeBSD-src-b85c7169a740b2edf0106ad59fdaa1b0160f823c.zip FreeBSD-src-b85c7169a740b2edf0106ad59fdaa1b0160f823c.tar.gz |
Merge ntpd & friends 4.2.4p5 from vendor/ntp/dist into head. Next commit
will update usr.sbin/ntp to match this.
MFC after: 2 weeks
Diffstat (limited to 'contrib/ntp/scripts/monitoring')
-rw-r--r-- | contrib/ntp/scripts/monitoring/lr.pl | 24 | ||||
-rw-r--r-- | contrib/ntp/scripts/monitoring/ntploopwatch | 62 |
2 files changed, 43 insertions, 43 deletions
diff --git a/contrib/ntp/scripts/monitoring/lr.pl b/contrib/ntp/scripts/monitoring/lr.pl index 7980d22..1ab3e3f 100644 --- a/contrib/ntp/scripts/monitoring/lr.pl +++ b/contrib/ntp/scripts/monitoring/lr.pl @@ -52,7 +52,7 @@ sub init $self->{sy2} = 0.0; } -sub sample($$$) +sub sample($$) { my $self = shift; my($_x, $_y) = @_; @@ -65,7 +65,7 @@ sub sample($$$) $self->{sy2} += $_y**2; } -sub B($) +sub B() { my $self = shift; @@ -74,28 +74,28 @@ sub B($) / ($self->{n} * $self->{sx2} - $self->{sx}**2); } -sub A($) +sub A() { my $self = shift; - return ($self->{sy} - B($self) * $self->{sx}) / $self->{n}; + return ($self->{sy} - B() * $self->{sx}) / $self->{n}; } -sub Y($$) +sub Y() { my $self = shift; - return A($self) + B($self) * $_[$[]; + return A() + B() * $_[$[]; } -sub X($$) +sub X() { my $self = shift; - return ($_[$[] - A($self)) / B($self); + return ($_[$[] - A()) / B(); } -sub r($) +sub r() { my $self = shift; @@ -107,7 +107,7 @@ sub r($) return ($self->{n} * $self->{sxy} - $self->{sx} * $self->{sy}) / sqrt($s); } -sub cov($) +sub cov() { my $self = shift; @@ -115,7 +115,7 @@ sub cov($) / ($self->{n} - 1); } -sub sigma($) +sub sigma() { my $self = shift; @@ -124,7 +124,7 @@ sub sigma($) / ($self->{n})); } -sub mean($) +sub mean() { my $self = shift; diff --git a/contrib/ntp/scripts/monitoring/ntploopwatch b/contrib/ntp/scripts/monitoring/ntploopwatch index db661d3..a94695c 100644 --- a/contrib/ntp/scripts/monitoring/ntploopwatch +++ b/contrib/ntp/scripts/monitoring/ntploopwatch @@ -1,8 +1,7 @@ #!/usr/bin/perl -w ;# --*-perl-*-- ;# -;# /src/NTP/ntp-4/scripts/monitoring/ntploopwatch,v 4.3 1999/02/21 12:18:38 kardel RELEASE_19990228_A -;# RELEASE_19990228_A +;# /src/NTP/ntp4-dev/scripts/monitoring/ntploopwatch,v 4.7 2004/11/14 16:11:05 kardel RELEASE_20050508_A ;# ;# process loop filter statistics file and either ;# - show statistics periodically using gnuplot @@ -55,7 +54,7 @@ a file of this name instead of delivered to a printer. E-O-P ;# add directory to look for lr.pl and timelocal.pl (in front of current list) -unshift(@INC,"/usr/local/xntp/monitoring"); +unshift(@INC,"."); require "lr.pl"; # linear regresion routines @@ -438,8 +437,9 @@ sub read_config print "configuration file read\n" if $verbose > 2; } -sub make_doplot +sub make_doplot($$) { + my($lo, $lf) = @_; local($c) = (""); local($fmt) = ("%s \"%s\" using 1:%d title '%s <%lf %lf> %6s' with lines"); @@ -536,22 +536,22 @@ sub make_doplot $c = ","); $showoreg && $showoffs && ($doplot .= sprintf($regfmt, $c, - &lr_B('offs'),&lr_A('offs'), + $lo->B(),$lo->A(), "offset ", - &lr_B('offs'), - ((&lr_A('offs')) < 0 ? '-' : '+'), - &abs(&lr_A('offs')), &lr_r('offs'), + $lo->B(), + (($lo->A()) < 0 ? '-' : '+'), + &abs($lo->A()), $lo->r(), "[ms]"), $c = ","); $showfreg && $showfreq && ($doplot .= sprintf($regfmt, $c, - &lr_B('freq') * $FreqScale, - (&lr_A('freq') + $minfreq) * $FreqScale - $LastFreqBase, + $lf->B() * $FreqScale, + ($lf->A() + $minfreq) * $FreqScale - $LastFreqBase, "frequency", - &lr_B('freq') * $FreqScale, - ((&lr_A('freq') + $minfreq) * $FreqScale - $LastFreqBase) < 0 ? '-' : '+', - &abs((&lr_A('freq') + $minfreq) * $FreqScale - $LastFreqBase), - &lr_r('freq'), + $lf->B() * $FreqScale, + (($lf->A() + $minfreq) * $FreqScale - $LastFreqBase) < 0 ? '-' : '+', + &abs(($lf->A() + $minfreq) * $FreqScale - $LastFreqBase), + $lf->r(), "[${FreqScaleInv}ppm]"), $c = ","); $doplot .= "\n"; @@ -566,7 +566,7 @@ sub make_doplot sub genfile { - local($cnt,$in,$out,@fpos) = @_; + local($cnt,$in,$out,$lo,$lf,@fpos) = @_; local(@F,@t,$t,$lastT) = (); local(@break,@time,@offs,@freq,@cmpl,@loffset,@filekey) = (); @@ -1058,9 +1058,6 @@ sub genfile print "input scanned ($l lines/",scalar(@time)," samples)\n" if $verbose > 1; - &lr_init('offs'); - &lr_init('freq'); - if (@time) { local($_,@F); @@ -1110,13 +1107,13 @@ sub genfile ;# (otherwise a (shift(@a1),shift(a2)) would do), ;# I dont like to make copies of these arrays as they may be huge $i = $[; - &lr_sample(($time[$i]-$timebase)/3600,$offs[$i],'offs'),$i++ + $lo->sample(($time[$i]-$timebase)/3600,$offs[$i]),$i++ while $i <= $#time; ($minoffs == $maxoffs) && ($minoffs -= 0.1,$maxoffs += 0.1); - $i = &lr_sigma('offs'); - $m = &lr_mean('offs'); + $i = $lo->sigma(); + $m = $lo->mean(); print "mean offset: $m sigma: $i\n" if $verbose > 2; @@ -1156,12 +1153,12 @@ sub genfile $maxfreq = &max(@freq); $i = $[; - &lr_sample(($time[$i]-$timebase)/3600,$freq[$i]-$minfreq,'freq'), + $lf->sample(($time[$i]-$timebase)/3600,$freq[$i]-$minfreq), $i++ while $i <= $#time; - $i = &lr_sigma('freq'); - $m = &lr_mean('freq') + $minfreq; + $i = $lf->sigma(); + $m = $lf->mean() + $minfreq; print "mean frequency: $m sigma: $i\n" if $verbose > 2; @@ -1185,7 +1182,7 @@ sub genfile ($FreqScale == 1 ? "" : (1/$FreqScale)); $freqbase = ($maxfreq + $minfreq)/ 2 * $FreqScale; #$m * $FreqScale; - $freqbase -= ($maxy + $miny) / 2; #&lr_mean('offs'); + $freqbase -= ($maxy + $miny) / 2; #$lf->mean(); ;# round resulting freqbase ;# to precision of min max difference @@ -1306,10 +1303,10 @@ sub genfile ;# prevent plotcmd from processing empty file print "Creating plot command dummy...\n" if $verbose > 2; print OUT "# dummy samples\n0 1 2 3\n1 1 2 3\n"; - &lr_sample(0,1,'offs'); - &lr_sample(1,1,'offs'); - &lr_sample(0,2,'freq'); - &lr_sample(1,2,'freq'); + $lo->sample(0,1); + $lo->sample(1,1); + $lf->sample(0,2); + $lf->sample(1,2); @time = (0, 1); $maxtime = 1; $mintime = 0; @offs = (1, 1); $maxoffs = 1; $minoffs = 1; @freq = (2, 2); $maxfreq = 2; $minfreq = 2; @@ -1453,10 +1450,13 @@ while(1) &read_config;# unless defined($PrintIt); unlink($tmpfile); - @filepos = &genfile($samples,$srcprefix,$tmpfile,@filepos); + my $lo = lr->new(); + my $lf = lr->new(); + + @filepos = &genfile($samples,$srcprefix,$tmpfile,$lo,$lf,@filepos); ;# make plotcmd display samples - &make_doplot; + make_doplot($lo, $lf); print "Displaying plot...\n" if $verbose > 1; print "command for plot sub process:\n$doplot----\n" if $verbose > 3; print PLOT $doplot; |