This is occasionally useful for debugging.

Signed-off-by: Ben Pfaff <b...@nicira.com>
---
Not yet tested, but I'll be sure to test this before committing it.

 utilities/ovs-ctl.8  |   15 +++++++++++++++
 utilities/ovs-lib.in |   14 +++++++++++++-
 2 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/utilities/ovs-ctl.8 b/utilities/ovs-ctl.8
index 988b500..591ff2f 100644
--- a/utilities/ovs-ctl.8
+++ b/utilities/ovs-ctl.8
@@ -182,6 +182,21 @@ suppresses that behavior.
 Sets the \fBnice\fR(1) level used for \fBovsdb\-server\fR and
 \fBovs\-vswitchd\fR, respectively.  Both default to \fB\-10\fR.
 .
+\fIniceness\fR may also take one of the following special values.
+These special values great slow daemon operations so they should not
+be used in production.  They also produce voluminous logs that can
+quickly fill small disk partitions.
+.
+.RS
+.IP "\fBvalgrind\fR"
+Run the daemon under \fBvalgrind\fR(1), if it is installed, logging to
+\fIdaemon\fB.valgrind.log.\fIpid\fR in the log directory.
+.
+.IP "\fBstrace\fR"
+Run the daemon under \fBstrace\fR(1), if it is installed, logging to
+\fIdaemon\fB.strace.log.\fIpid\fR in the log directory.
+.RE
+.
 .PP
 The following options control file locations.  They should only be
 used if the default locations cannot be used.  See \fBFILES\fR, below,
diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
index 7a15aae..16f2b39 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -106,7 +106,19 @@ start_daemon () {
     set "$@" --detach --monitor
 
     # priority
-    if test X"$priority" != X; then
+    if test X"$priority" = Xvalgrind; then
+        if (valgrind --version) > /dev/null 2>&1; then
+            set valgrind -q --leak-check=full 
--log-file="$logdir/$daemon.valgrind.log.%p" "$@"
+        else
+            log_failure_msg "valgrind not installed, running $daemon without 
it"
+        fi
+    elif test X"$priority" = Xstrace; then
+        if (strace -V) > /dev/null 2>&1; then
+            set strace -ff -o "$logdir/$daemon.strace.log" "$@"
+        else
+            log_failure_msg "strace not installed, running $daemon without it"
+        fi
+    elif test X"$priority" != X; then
         set nice -n "$priority" "$@"
     fi
 
-- 
1.7.2.5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to