summaryrefslogtreecommitdiff
path: root/evergreen/functions/run_diskstats.sh
blob: d118f3ae0eb8491af08aac2fe118a998a5a1c319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
set -o errexit
set -o verbose

# On Windows we can use typeperf.exe to dump performance counters.
if [ "Windows_NT" = "$OS" ]; then
  typeperf -qx PhysicalDisk | grep Disk | grep -v _Total > disk_counters.txt
  typeperf -cf disk_counters.txt -si 5 -o mongo-diskstats
# Linux: iostat -t option for timestamp.
elif iostat -tdmx > /dev/null 2>&1; then
  iostat -tdmx 5 > mongo-diskstats
# OSX: Simulate the iostat timestamp.
elif iostat -d > /dev/null 2>&1; then
  iostat -d -w 5 | while IFS= read -r line; do printf '%s %s\n' "$(date +'%m/%d/%Y %H:%M:%S')" "$line" >> mongo-diskstats; done
# Check if vmstat -t is available.
elif vmstat -td > /dev/null 2>&1; then
  vmstat -td 5 > mongo-diskstats
# Check if vmstat -T d is available.
elif vmstat -T d > /dev/null 2>&1; then
  vmstat -T d 5 > mongo-diskstats
else
  printf "Cannot collect mongo-diskstats on this platform\n"
fi