| YAMAMOTO Takashi | 42373c7 | 2014-11-18 12:30:16 +0900 | [diff] [blame] | 1 | # lib/dstat | 
| Joe Gordon | e0b08d0 | 2014-08-20 00:34:55 -0700 | [diff] [blame] | 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 | 
 | 14 | XTRACE=$(set +o | grep xtrace) | 
 | 15 | set +o xtrace | 
 | 16 |  | 
 | 17 |  | 
 | 18 | # Defaults | 
 | 19 | # -------- | 
 | 20 | # for DSTAT logging | 
 | 21 | DSTAT_FILE=${DSTAT_FILE:-"dstat.txt"} | 
 | 22 |  | 
 | 23 |  | 
 | 24 | # start_dstat() - Start running processes, including screen | 
 | 25 | function start_dstat { | 
 | 26 |     # A better kind of sysstat, with the top process per time slice | 
| YAMAMOTO Takashi | 44f4e20 | 2014-11-18 13:03:08 +0900 | [diff] [blame] | 27 |     DSTAT_OPTS="-tcmndrylpg --top-cpu-adv" | 
| Joe Gordon | e0b08d0 | 2014-08-20 00:34:55 -0700 | [diff] [blame] | 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 | 
 | 36 | function stop_dstat { | 
 | 37 |     screen_stop dstat | 
 | 38 | } | 
 | 39 |  | 
 | 40 | # Restore xtrace | 
 | 41 | $XTRACE |