-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathdstat
58 lines (48 loc) · 1.46 KB
/
dstat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
#
# lib/dstat
# Functions to start and stop dstat
# Dependencies:
#
# - ``functions`` file
# ``stack.sh`` calls the entry points in this order:
#
# - install_dstat
# - start_dstat
# - stop_dstat
# Save trace setting
_XTRACE_DSTAT=$(set +o | grep xtrace)
set +o xtrace
# install_dstat() - Install prerequisites for dstat services
function install_dstat {
if is_service_enabled memory_tracker; then
# Install python libraries required by tools/mlock_report.py
pip_install_gr psutil
fi
}
# start_dstat() - Start running processes
function start_dstat {
# A better kind of sysstat, with the top process per time slice
run_process dstat "$TOP_DIR/tools/dstat.sh $LOGDIR"
# To enable memory_tracker add:
# enable_service memory_tracker
# to your localrc
run_process memory_tracker "$TOP_DIR/tools/memory_tracker.sh" "" "root"
# TODO(jh): Fail when using the old service name otherwise consumers might
# never notice that is has been removed.
if is_service_enabled peakmem_tracker; then
die $LINENO "The peakmem_tracker service has been removed, use memory_tracker instead"
fi
# To enable file_tracker add:
# enable_service file_tracker
# to your localrc
run_process file_tracker "$TOP_DIR/tools/file_tracker.sh"
}
# stop_dstat() stop dstat process
function stop_dstat {
stop_process dstat
stop_process memory_tracker
stop_process file_tracker
}
# Restore xtrace
$_XTRACE_DSTAT