Sean Dague | e263c82 | 2014-12-05 14:25:28 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
YAMAMOTO Takashi | 42373c7 | 2014-11-18 12:30:16 +0900 | [diff] [blame] | 3 | # lib/dstat |
Joe Gordon | e0b08d0 | 2014-08-20 00:34:55 -0700 | [diff] [blame] | 4 | # Functions to start and stop dstat |
| 5 | |
| 6 | # Dependencies: |
| 7 | # |
| 8 | # - ``functions`` file |
| 9 | |
| 10 | # ``stack.sh`` calls the entry points in this order: |
| 11 | # |
| 12 | # - start_dstat |
| 13 | # - stop_dstat |
| 14 | |
| 15 | # Save trace setting |
Ian Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 16 | _XTRACE_DSTAT=$(set +o | grep xtrace) |
Joe Gordon | e0b08d0 | 2014-08-20 00:34:55 -0700 | [diff] [blame] | 17 | set +o xtrace |
| 18 | |
Joe Gordon | e0b08d0 | 2014-08-20 00:34:55 -0700 | [diff] [blame] | 19 | # start_dstat() - Start running processes, including screen |
| 20 | function start_dstat { |
| 21 | # A better kind of sysstat, with the top process per time slice |
Tim Buckley | a83e90b | 2015-08-05 10:25:00 -0600 | [diff] [blame] | 22 | run_process dstat "$TOP_DIR/tools/dstat.sh $LOGDIR" |
Ian Wienand | 72a8be6 | 2015-04-09 13:51:23 +1000 | [diff] [blame] | 23 | |
| 24 | # To enable peakmem_tracker add: |
| 25 | # enable_service peakmem_tracker |
| 26 | # to your localrc |
| 27 | run_process peakmem_tracker "$TOP_DIR/tools/peakmem_tracker.sh" |
Joe Gordon | e0b08d0 | 2014-08-20 00:34:55 -0700 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | # stop_dstat() stop dstat process |
| 31 | function stop_dstat { |
Ian Wienand | c00d2a5 | 2015-04-09 19:57:13 +1000 | [diff] [blame] | 32 | stop_process dstat |
Ian Wienand | 72a8be6 | 2015-04-09 13:51:23 +1000 | [diff] [blame] | 33 | stop_process peakmem_tracker |
Joe Gordon | e0b08d0 | 2014-08-20 00:34:55 -0700 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | # Restore xtrace |
Ian Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 37 | $_XTRACE_DSTAT |