Browse code

Enable CSV logging output for DStat.

Future work toward visualization of DevStack and devstack-gate performance
would benefit greatly from the availability of machine-parsable DStat output.
This patch outputs an additional logfile to $LOGDIR, `dstat-csv.log`, using
DStat's built-in CSV logging functionality.

An additional instance of DStat is started during start_dstat that outputs
to CSV-formatted text without `--top-cpu-adv` and `-top-io-adv` enabled, as
these plugins are currently incompatible with CSV output. To facilitate this,
a new `dstat.sh` script is added to $TOP_DIR/tools/ to act as a daemon to
manage the two processes.

Change-Id: I826c94c35b6a109308b4f132c181ff7a1f63bc7b
Depends-On: I534fb1f9356a7948d2fec0aecc7f275e47362a11

Tim Buckley authored on 2015/08/06 01:25:00
Showing 2 changed files
... ...
@@ -19,8 +19,7 @@ set +o xtrace
19 19
 # start_dstat() - Start running processes, including screen
20 20
 function start_dstat {
21 21
     # A better kind of sysstat, with the top process per time slice
22
-    DSTAT_OPTS="-tcmndrylpg --top-cpu-adv --top-io-adv"
23
-    run_process dstat "dstat $DSTAT_OPTS"
22
+    run_process dstat "$TOP_DIR/tools/dstat.sh $LOGDIR"
24 23
 
25 24
     # To enable peakmem_tracker add:
26 25
     #    enable_service peakmem_tracker
27 26
new file mode 100755
... ...
@@ -0,0 +1,32 @@
0
+#!/bin/bash
1
+
2
+# **tools/dstat.sh** - Execute instances of DStat to log system load info
3
+#
4
+# Multiple instances of DStat are executed in order to take advantage of
5
+# incompatible features, particularly CSV output and the "top-cpu-adv" and
6
+# "top-io-adv" flags.
7
+#
8
+# Assumes:
9
+#  - dstat command is installed
10
+
11
+# Retreive log directory as argument from calling script.
12
+LOGDIR=$1
13
+
14
+# Command line arguments for primary DStat process.
15
+DSTAT_OPTS="-tcmndrylpg --top-cpu-adv --top-io-adv"
16
+
17
+# Command-line arguments for secondary background DStat process.
18
+DSTAT_CSV_OPTS="-tcmndrylpg --output $LOGDIR/dstat-csv.log"
19
+
20
+# Execute and background the secondary dstat process and discard its output.
21
+dstat $DSTAT_CSV_OPTS >& /dev/null &
22
+
23
+# Execute and background the primary dstat process, but keep its output in this
24
+# TTY.
25
+dstat $DSTAT_OPTS &
26
+
27
+# Catch any exit signals, making sure to also terminate any child processes.
28
+trap "kill -- -$$" EXIT
29
+
30
+# Keep this script running as long as child dstat processes are alive.
31
+wait