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
#!/usr/bin/env bash
i=0
while ((i<20)); do
nohup ./summon-kswapd &
let ++i
echo $i
sleep 1
done
#!/usr/bin/env bash
cat iplist.txt | while read ip
do
ssh -n -l root $ip umount /tidb
ssh -n -l root $ip mkdir -p /root/zwb
scp ./InjuredFS $ip:/root/zwb/
ssh -n -l root $ip mkdir -p /tidb-original
ssh -n -l root $ip mount /dev/sdb /tidb-original
ssh -n -l root $ip cd /root/zwb && nohup ./InjuredFS --original="/tidb-original" --mountpoint="/tidb" &
cat iplist.txt | while read ip
do
ssh -n -l root $ip pkill InjuredFS
ssh -n -l root $ip rm /root/zwb/InjuredFS
ssh -n -l root $ip rm /root/zwb/nohup.out
scp ./InjuredFS $ip:/root/zwb/
sleep 120
ssh -n -l root $ip cd /root/zwb && nohup ./InjuredFS --original="/tidb-original" --mountpoint="/tidb" &
echo $ip
done
#!/usr/bin/env bash
#
# drsnoop - trace direct reclaim latency.
# Written using Linux ftrace.
#
# This traces direct reclaim at the vmscan interface, using the vmscan:
# tracepoints. This can help characterize the direct reclaim requested
# and their resulting performance.
#
# USAGE: ./drsnoop [-hst] [-p pid] [-n name] [duration]
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
pthread_mutex_t lock;
pthread_cond_t cond;
static unsigned counter;
static void dec_counter(void) {
modprobe ifb numifbs=1
ip link set dev ifb0 up
tc qdisc add dev em1 handle ffff: ingress
tc filter add dev em1 parent ffff: protocol ip u32 match u32 0 0 \
action mirred egress redirect dev ifb0
tc qdisc add dev ifb0 root handle 1: prio
tc filter add dev ifb0 parent 1:0 protocol ip prio 1 u32 match ip src 172.16.21.3 flowid 2:1
tc filter add dev ifb0 parent 1:0 protocol ip prio 1 u32 match ip src 172.16.21.4 flowid 2:1
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <dlfcn.h>
ssize_t read(int fd, void *buf, size_t count) {
ssize_t (*origin_read)(int, void*, size_t) = dlsym(RTLD_NEXT, "read");
sleep(5);
printf("read sleep 5s\n");
return origin_read(fd, buf, count);
@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:
#!/usr/bin/env bash
source /opt/intel/vtune_amplifier_2018.3.0.558279/amplxe-vars.sh
amplxe-cl -c memory-access -knob analyze-mem-objects=true -knob mem-object-size-min-thres=1024 -run-pass-thru=--no-altstack -target-pid $1
/*
* debugfs.h - a tiny little debug file system
*
* Copyright (C) 2004 Greg Kroah-Hartman <[email protected]>
* Copyright (C) 2004 IBM Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*