📄 poller_bench.sh
字号:
#!/bin/sh# Example of how to run Poller_bench and get kernel profiling results, tooset -e set -x# On my system, at least, readprofile is in /usr/sbinPATH=$PATH:/usr/sbin./configure --enable-ndebugmake cleanmake Poller_bench profilerm -f *.dat# If we're root, allow ourselves enough fd's to run testulimit -n 21000# On Linux, following magic incantations raise a systemwide limitif [ -f /proc/sys/fs/file-max ]; then echo 42000 > /proc/sys/fs/file-maxfiif [ -f /proc/sys/fs/inode-max ]; then echo 42000 > /proc/sys/fs/inode-maxfi# Run for 5 seconds at each combination of {select,poll,/dev/poll} x {100,1000,10000 pipes}./Poller_bench 5 1 spd 100 1000 10000 > logecho Results:cat log# If you want kernel profiling results on Linux,# make sure /usr/src/linux/System.map is up to date,# boot with "profile=2", and run Poller_bench as root. # It will then output kernel profile files# for each test condition named 'bench%d%c.dat', # where %d is the number of pipes,# and %c is the polling method (s = select, p = poll, d = /dev/poll)# Example of how to interpret those files:if [ -f bench100p.dat ]; then for a in *.dat ; do readprofile -p $a | sort -rn | head > $a.top done echo Gross kernel profile results are in '*.top'fi# Another way to interpret these is a fine-grained profile; for# this, you need to specify a function to show details for.if [ -f bench100d.dat ]; then for a in bench*d.dat ; do ./profile dp_poll $a > $a.dp_poll done echo "Fine kernel profile results for dp_poll() are in '*.dp_poll'" # You can then do 'objdump -d /usr/src/linux/vmlinux > foo' and # look at foo for the disassembly of dp_poll to get some idea # what the hotspots mean. Or so I've been told.fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -