[Git][NTPsec/ntpsec][master] ntpviz: add option -N to low at lowest priority.
Gary E. Miller
gitlab at mg.gitlab.com
Thu Jan 12 01:44:32 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
3ab9b37c by Gary E. Miller at 2017-01-11T17:43:42-08:00
ntpviz: add option -N to low at lowest priority.
- - - - -
2 changed files:
- docs/includes/ntpviz-body.txt
- ntpclients/ntpviz
Changes:
=====================================
docs/includes/ntpviz-body.txt
=====================================
--- a/docs/includes/ntpviz-body.txt
+++ b/docs/includes/ntpviz-body.txt
@@ -24,6 +24,7 @@ ntpviz [-d LOGDIR] [-g] [-n name] [-p DAYS]
--peer-jitters=hosts |
--peer-offsets=hosts]
[-D DLVL | --debug DLVL]
+ [-N | --nice]
[-V | --version]
[@OPTIONFILE]
@@ -90,6 +91,9 @@ subset of comparative plots for multiple directories.
2 leaves the plot file in the system temp directory. +
9 is painfully verbose. 9 also includes profile data.
+-N or --nice::
+ Run at the lowest possible priority. Only available on UNIX.
+
-V or --version:
Print program version and exit.
=====================================
ntpclients/ntpviz
=====================================
--- a/ntpclients/ntpviz
+++ b/ntpclients/ntpviz
@@ -23,6 +23,7 @@ ntpviz [-d LOGDIR] [-g] [-n name] [-p DAYS]
--peer-offsets=hosts |
]
[-D DLVL | --debug DLVL]
+ [-N | --nice]
[-V | --version]
[@OPTIONFILE]
@@ -1342,12 +1343,28 @@ Python by ESR, concept and gnuplot code by Dan Drown.
dest='debug_level',
help="debug level, 0 (none) to 9 (most)",
type=int)
+ # some OS do not support os.nice()
+ try:
+ os.nice(0)
+ parser.add_argument('-N','--nice',
+ action="store_true",
+ dest='nice',
+ help="Run as lowest priority")
+ except:
+ pass
+
parser.add_argument('-V', '--version',
action="version",
version="ntpviz %s" % ntp.util.stdversion())
args = parser.parse_args()
+ if args.nice:
+ # run at lowest possible priority
+ nice = os.nice(19)
+ if args.debug_level:
+ sys.stderr.write("ntpviz: INFO: Now running at nice %s\n" % nice)
+
if 's' == args.width:
# fit in 1024x768 browser
# in 2016 this is 22% of all browsers
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/3ab9b37c532548d96ad8838a4dbb18f0da242d94
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170112/bf64ae8c/attachment.html>
More information about the vc
mailing list