File: linux_record_cpu_net.sh

package info (click to toggle)
python-mitogen 0.3.26-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,456 kB
  • sloc: python: 22,134; sh: 183; makefile: 74; perl: 19; ansic: 18
file content (24 lines) | stat: -rwxr-xr-x 468 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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