19e4d97288
'tools/mlock_report.py' script requires 'psutil' package to be installed. This ensures it is done before memory_peak service is started. Partial-Bug: #1860753 Change-Id: I7b2b6eaf9856c6057e1a4a0054d15074150a6cb6
53 lines
1.3 KiB
Bash
53 lines
1.3 KiB
Bash
#!/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"
|
|
|
|
# remove support for the old name when it's no longer used (sometime in Queens)
|
|
if is_service_enabled peakmem_tracker; then
|
|
deprecated "Use of peakmem_tracker in devstack is deprecated, use memory_tracker instead"
|
|
run_process peakmem_tracker "$TOP_DIR/tools/memory_tracker.sh" "" "root"
|
|
fi
|
|
}
|
|
|
|
# stop_dstat() stop dstat process
|
|
function stop_dstat {
|
|
stop_process dstat
|
|
stop_process memory_tracker
|
|
}
|
|
|
|
# Restore xtrace
|
|
$_XTRACE_DSTAT
|