blob: a2c522c02a46af255e924678033ef6fefa94a7d3 [file] [log] [blame]
Joe Gordone0b08d02014-08-20 00:34:55 -07001# lib/apache
2# Functions to start and stop dstat
3
4# Dependencies:
5#
6# - ``functions`` file
7
8# ``stack.sh`` calls the entry points in this order:
9#
10# - start_dstat
11# - stop_dstat
12
13# Save trace setting
14XTRACE=$(set +o | grep xtrace)
15set +o xtrace
16
17
18# Defaults
19# --------
20# for DSTAT logging
21DSTAT_FILE=${DSTAT_FILE:-"dstat.txt"}
22
23
24# start_dstat() - Start running processes, including screen
25function start_dstat {
26 # A better kind of sysstat, with the top process per time slice
27 DSTAT_OPTS="-tcmndrylp --top-cpu-adv"
28 if [[ -n ${SCREEN_LOGDIR} ]]; then
29 screen_it dstat "cd $TOP_DIR; dstat $DSTAT_OPTS | tee $SCREEN_LOGDIR/$DSTAT_FILE"
30 else
31 screen_it dstat "dstat $DSTAT_OPTS"
32 fi
33}
34
35# stop_dstat() stop dstat process
36function stop_dstat {
37 screen_stop dstat
38}
39
40# Restore xtrace
41$XTRACE