Skip to content

Instantly share code, notes, and snippets.

View ethercflow's full-sized avatar
🎯
Focusing

Wenbo Zhang ethercflow

🎯
Focusing
  • SmartX
  • China
View GitHub Profile
@ethercflow
ethercflow / cpu_tenancy.py
Created July 24, 2018 06:32 — forked from siddontang/cpu_tenancy.py
A tool to show how the thread runs on different CPUs
#!/usr/bin/python
import sys
import re
# perf record -F 99 -p $1 -e "sched:sched_stat_runtime" -a -- sleep 20
# perf script -F comm,pid,tid,cpu,time | python cpu_tenancy.py
#
# time-monitor-wo 79618/79634 [007] 11994704.695317:
# grpc-server-1 79618/79954 [006] 11994704.717969:
@ethercflow
ethercflow / delay.sh
Created May 23, 2018 08:37 — forked from digilist/delay.sh
Delaying network traffic to a specific IP
#!/bin/bash
interface=lo
ip=10.0.0.1
delay=100ms
tc qdisc add dev $interface root handle 1: prio
tc filter add dev $interface parent 1:0 protocol ip prio 1 u32 match ip dst $ip flowid 2:1
tc qdisc add dev $interface parent 1:1 handle 2: netem delay $delay