You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/tests/bench/linux_record_cpu_net.sh

25 lines
468 B
Bash

#!/bin/bash
#
# Wrap a run of Ansible playbook so that CPU usage counters and network
# activity are logged to files.
#
[ ! "$1" ] && exit 1
name="$1"; shift
sudo tcpdump -i any -w $name-net.pcap -s 66 port 22 or port 9122 &
sleep 0.5
perf stat -x, -I 100 \
-e branches \
-e instructions \
-e task-clock \
-e context-switches \
-e page-faults \
-e cpu-migrations \
-o $name-perf.csv "$@"
pkill -f ssh:; sleep 0.1
sudo pkill -f tcpdump