Add pidstat support
pidstat is a script that comes from sysstat, but will give us
per-process information. Allow enabling "pidstat" that will run pidstat
to give info every 5 seconds by default.
Change-Id: I5ec7d5abce81125b55985bba3ccaf8073ccdfa2a
diff --git a/stack.sh b/stack.sh
index efdee64..1d02c16 100755
--- a/stack.sh
+++ b/stack.sh
@@ -291,6 +291,9 @@
SYSSTAT_FILE=${SYSSTAT_FILE:-"sysstat.dat"}
SYSSTAT_INTERVAL=${SYSSTAT_INTERVAL:-"1"}
+PIDSTAT_FILE=${PIDSTAT_FILE:-"pidstat.txt"}
+PIDSTAT_INTERVAL=${PIDSTAT_INTERVAL:-"5"}
+
# Use color for logging output (only available if syslog is not used)
LOG_COLOR=`trueorfalse True $LOG_COLOR`
@@ -874,6 +877,16 @@
fi
fi
+if is_service_enabled pidstat; then
+ # Per-process stats
+ PIDSTAT_OPTS="-l -p ALL -T ALL"
+ if [[ -n ${SCREEN_LOGDIR} ]]; then
+ screen_it pidstat "cd $TOP_DIR; pidstat $PIDSTAT_OPTS $PIDSTAT_INTERVAL > $SCREEN_LOGDIR/$PIDSTAT_FILE"
+ else
+ screen_it pidstat "pidstat $PIDSTAT_OPTS $PIDSTAT_INTERVAL"
+ fi
+fi
+
# Start Services
# ==============