[Git][NTPsec/ntpsec][master] 2 commits: Debug level 9 now runs the profiler.
Gary E. Miller
gitlab at mg.gitlab.com
Mon Aug 22 23:02:03 UTC 2016
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
2de1f2f2 by Gary E. Miller at 2016-08-22T15:41:57-07:00
Debug level 9 now runs the profiler.
- - - - -
d97958a9 by Gary E. Miller at 2016-08-22T16:01:05-07:00
Add optional psutils. This will ionice() with -N
Given the slow SD cards on Raspberry Pi a nice option to have.
- - - - -
3 changed files:
- INSTALL
- docs/includes/ntpviz-body.txt
- ntpstats/ntpviz
Changes:
=====================================
INSTALL
=====================================
--- a/INSTALL
+++ b/INSTALL
@@ -20,6 +20,20 @@ bison::
Fedora: bison
Debian: bison
+libcap::
+ Required on Linux, to support dropping root.
+ Fedora: libcap and libcap-devel
+ Debian: libcap2 and libcap-dev
+
+gnuplot::
+ Required for ntpviz.
+ Fedora: gnuplot
+ Debian: gnuplot
+
+psutils::
+ Optional for ntpviz. Allows running with ionice()
+ Gentoo: dev-python/psutil
+
libevent 2.x::
Optional. Without it, ntpdig won't build.
Fedora: libevent and libevent-devel
@@ -30,11 +44,6 @@ libevent 2.x::
# cd /usr/lib
# ln -s /usr/pkg/lib/libevent_core-2.0.so.5
-libcap::
- Required on Linux, to support dropping root.
- Fedora: libcap and libcap-devel
- Debian: libcap2 and libcap-dev
-
seccomp::
Optional on Linux to support restricting syscalls
Fedora: libseccomp-devel
@@ -73,11 +82,6 @@ asciidoc, a2x::
Fedora: asciidoc (Stock CentOS/RHEL has only 8.4.5, you must upgrade)
Debian: asciidoc
-gnuplot::
- Required for ntpviz.
- Fedora: gnuplot
- Debian: gnuplot
-
liberation::
Optional, improves font quality in ntpviz renderings.
Fedora: liberation
=====================================
docs/includes/ntpviz-body.txt
=====================================
--- a/docs/includes/ntpviz-body.txt
+++ b/docs/includes/ntpviz-body.txt
@@ -42,7 +42,8 @@ is the default, quiet except for all ERRORs and some WARNINGs. 9 is
painfully verbose.
The -N option will force ntpviz to run "nice"ly. This is appropriate
-when you run ntpvizz as a cron job.
+when you run ntpviz as a cron job. If the Python library psutils is
+installed then ntpviz will also be run at ionice(IDLE).
The plot options choose what graph is generated; invoke only one. By
default, the GNUPLOT for the graph is reported; with -g you get the
=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -23,10 +23,6 @@ from __future__ import print_function, division
import os, sys, getopt, socket, binascii, datetime, collections, time
from ntp.statfiles import *
-#import cProfile, pstats
-#pr = cProfile.Profile()
-#pr.enable()
-
# RMS frequency jitter - Deviation from a root-mean-square linear approximation?
# Investigate.
#
@@ -362,8 +358,25 @@ if __name__ == '__main__':
if 0 < debug:
sys.stderr.write("ntpviz: INFO: now running at debug: %s\n" % \
debug)
+ if 9 == debug:
+ # crazy debug, also profile
+ import cProfile, pstats
+ pr = cProfile.Profile()
+ pr.enable()
if 0 != nice:
+ try:
+ import psutil
+ # set ionice() to idle
+ p = psutil.Process(os.getpid())
+ p.ionice(psutil.IOPRIO_CLASS_IDLE)
+
+ except ImportError:
+ if 0 < debug:
+ sys.stderr.write("ntpviz: INFO: psutils not found\n")
+ pass
+
+ # set nice()
nice = os.nice( nice )
if 2 < debug:
sys.stderr.write("ntpviz: INFO: now running at nice: %s\n" % \
@@ -545,7 +558,9 @@ ntpviz</a>, part of the <a href="https://www.ntpsec.org/">NTPsec project</a>
ifile.close()
-#pr.disable()
-#pr.print_stats('tottime')
+if 9 == debug:
+ # finish the profile
+ pr.disable()
+ pr.print_stats('tottime')
# end
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/8ca84ac3516c67466f7ca6f9a192fcafb3bd9417...d97958a92c65202b573c178e079235e574d44da7
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160822/3b0a888a/attachment.html>
More information about the vc
mailing list