Open KKimj opened 3 years ago
$ sudo apt-get install linux-tools-$(uname -r)
$ sudo apt-get install linux-cloud-tools-$(uname -r)
$ sudo apt install linux-tools-common
usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS]
The most commonly used perf commands are:
annotate Read perf.data (created by perf record) and display annotated code
archive Create archive with object files with build-ids found in perf.data file
bench General framework for benchmark suites
buildid-cache Manage build-id cache.
buildid-list List the buildids in a perf.data file
c2c Shared Data C2C/HITM Analyzer.
config Get and set variables in a configuration file.
data Data file related processing
diff Read perf.data files and display the differential profile
evlist List the event names in a perf.data file
ftrace simple wrapper for kernel's ftrace functionality
inject Filter to augment the events stream with additional information
kallsyms Searches running kernel for symbols
kmem Tool to trace/measure kernel memory properties
kvm Tool to trace/measure kvm guest os
list List all symbolic event types
lock Analyze lock events
mem Profile memory accesses
record Run a command and record its profile into perf.data
report Read perf.data (created by perf record) and display the profile
sched Tool to trace/measure scheduler properties (latencies)
script Read perf.data (created by perf record) and display trace output
stat Run a command and gather performance counter statistics
test Runs sanity tests.
timechart Tool to visualize total system behavior during a workload
top System profiling tool.
version display the version of perf binary
probe Define new dynamic tracepoints
trace strace inspired tool
See 'perf help COMMAND' for more information on a specific command.
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf bench sched all
# Running sched/messaging benchmark...
# 20 sender and receiver processes per group
# 10 groups == 400 processes run
Total time: 0.054 [sec]
# Running sched/pipe benchmark...
# Executed 1000000 pipe operations between two processes
Total time: 3.941 [sec]
3.941642 usecs/op
253701 ops/sec
sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
4,229.60 msec task-clock # 1.000 CPUs utilized
22 context-switches # 0.005 K/sec
17 cpu-migrations # 0.004 K/sec
402 page-faults # 0.095 K/sec
20,906,917,948 cycles # 4.943 GHz
53,508,227,655 instructions # 2.56 insn per cycle
2,978,326,616 branches # 704.163 M/sec
68,132,577 branch-misses # 2.29% of all branches
4.229989920 seconds time elapsed
4.225895000 seconds user
0.004001000 seconds sys
$ sudo apt-get install stress
kkimj@kkimj-hanyang:~$ stress --help
`stress' imposes certain types of compute stress on your system
Usage: stress [OPTION [ARG]] ...
-?, --help show this help statement
--version show version statement
-v, --verbose be verbose
-q, --quiet be quiet
-n, --dry-run show what would have been done
-t, --timeout N timeout after N seconds
--backoff N wait factor of N microseconds before work starts
-c, --cpu N spawn N workers spinning on sqrt()
-i, --io N spawn N workers spinning on sync()
-m, --vm N spawn N workers spinning on malloc()/free()
--vm-bytes B malloc B bytes per vm worker (default is 256MB)
--vm-stride B touch a byte every B bytes (default is 4096)
--vm-hang N sleep N secs before free (default none, 0 is inf)
--vm-keep redirty memory instead of freeing and reallocating
-d, --hdd N spawn N workers spinning on write()/unlink()
--hdd-bytes B write B bytes per hdd worker (default is 1GB)
Example: stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 10s
Note: Numbers may be suffixed with s,m,h,d,y (time) or B,K,M,G (size).
# Stress Basic example
$ stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 10s
# Stress with perf example
$ sudo perf stat stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 10s
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
7,559.86 msec task-clock # 0.994 CPUs utilized
62 context-switches # 0.008 K/sec
44 cpu-migrations # 0.006 K/sec
402 page-faults # 0.053 K/sec
36,764,825,609 cycles # 4.863 GHz
53,512,834,599 instructions # 1.46 insn per cycle
2,979,164,055 branches # 394.077 M/sec
70,092,246 branch-misses # 2.35% of all branches
7.606507085 seconds time elapsed
7.556165000 seconds user
0.003997000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
5,671.61 msec task-clock # 0.994 CPUs utilized
35 context-switches # 0.006 K/sec
26 cpu-migrations # 0.005 K/sec
401 page-faults # 0.071 K/sec
27,756,609,638 cycles # 4.894 GHz
53,510,364,819 instructions # 1.93 insn per cycle
2,978,737,034 branches # 525.201 M/sec
69,612,263 branch-misses # 2.34% of all branches
5.707207196 seconds time elapsed
5.672003000 seconds user
0.000000000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
5,995.71 msec task-clock # 0.994 CPUs utilized
41 context-switches # 0.007 K/sec
27 cpu-migrations # 0.005 K/sec
403 page-faults # 0.067 K/sec
28,812,912,477 cycles # 4.806 GHz
53,507,211,650 instructions # 1.86 insn per cycle
2,977,558,179 branches # 496.615 M/sec
70,172,922 branch-misses # 2.36% of all branches
6.031233639 seconds time elapsed
5.996077000 seconds user
0.000000000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
4,229.43 msec task-clock # 1.000 CPUs utilized
28 context-switches # 0.007 K/sec
16 cpu-migrations # 0.004 K/sec
402 page-faults # 0.095 K/sec
20,907,342,906 cycles # 4.943 GHz
53,508,719,640 instructions # 2.56 insn per cycle
2,978,411,604 branches # 704.212 M/sec
68,230,083 branch-misses # 2.29% of all branches
4.229811922 seconds time elapsed
4.229684000 seconds user
0.000000000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
4,250.67 msec task-clock # 1.000 CPUs utilized
27 context-switches # 0.006 K/sec
16 cpu-migrations # 0.004 K/sec
402 page-faults # 0.095 K/sec
20,929,337,630 cycles # 4.924 GHz
53,509,004,878 instructions # 2.56 insn per cycle
2,978,452,909 branches # 700.702 M/sec
68,201,357 branch-misses # 2.29% of all branches
4.251466372 seconds time elapsed
4.251029000 seconds user
0.000000000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
7,147.65 msec task-clock # 0.994 CPUs utilized
51 context-switches # 0.007 K/sec
40 cpu-migrations # 0.006 K/sec
399 page-faults # 0.056 K/sec
34,563,014,474 cycles # 4.836 GHz
53,508,993,953 instructions # 1.55 insn per cycle
2,977,887,972 branches # 416.625 M/sec
69,664,541 branch-misses # 2.34% of all branches
7.191022020 seconds time elapsed
7.147987000 seconds user
0.000000000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
4,840.52 msec task-clock # 0.998 CPUs utilized
189 context-switches # 0.039 K/sec
20 cpu-migrations # 0.004 K/sec
400 page-faults # 0.083 K/sec
23,406,722,808 cycles # 4.836 GHz
53,506,971,059 instructions # 2.29 insn per cycle
2,977,548,836 branches # 615.130 M/sec
69,435,266 branch-misses # 2.33% of all branches
4.852457993 seconds time elapsed
4.840687000 seconds user
0.000000000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
5,396.75 msec task-clock # 0.998 CPUs utilized
32 context-switches # 0.006 K/sec
25 cpu-migrations # 0.005 K/sec
402 page-faults # 0.074 K/sec
25,882,864,692 cycles # 4.796 GHz
53,506,944,783 instructions # 2.07 insn per cycle
2,977,523,809 branches # 551.726 M/sec
69,424,480 branch-misses # 2.33% of all branches
5.409343038 seconds time elapsed
5.397122000 seconds user
0.000000000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
6,084.26 msec task-clock # 0.992 CPUs utilized
40 context-switches # 0.007 K/sec
30 cpu-migrations # 0.005 K/sec
402 page-faults # 0.066 K/sec
29,077,581,321 cycles # 4.779 GHz
53,507,682,373 instructions # 1.84 insn per cycle
2,977,645,822 branches # 489.402 M/sec
70,098,481 branch-misses # 2.35% of all branches
6.135202397 seconds time elapsed
6.084636000 seconds user
0.000000000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
8,047.77 msec task-clock # 0.996 CPUs utilized
63 context-switches # 0.008 K/sec
47 cpu-migrations # 0.006 K/sec
402 page-faults # 0.050 K/sec
38,269,293,402 cycles # 4.755 GHz
53,515,182,642 instructions # 1.40 insn per cycle
2,979,660,943 branches # 370.247 M/sec
69,768,879 branch-misses # 2.34% of all branches
8.083222210 seconds time elapsed
8.048108000 seconds user
0.000000000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
4,239.04 msec task-clock # 1.000 CPUs utilized
26 context-switches # 0.006 K/sec
17 cpu-migrations # 0.004 K/sec
402 page-faults # 0.095 K/sec
20,903,071,100 cycles # 4.931 GHz
53,508,632,130 instructions # 2.56 insn per cycle
2,978,383,346 branches # 702.609 M/sec
68,235,806 branch-misses # 2.29% of all branches
4.239425574 seconds time elapsed
4.239300000 seconds user
0.000000000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
4,242.45 msec task-clock # 1.000 CPUs utilized
28 context-switches # 0.007 K/sec
16 cpu-migrations # 0.004 K/sec
400 page-faults # 0.094 K/sec
20,923,059,765 cycles # 4.932 GHz
53,504,572,375 instructions # 2.56 insn per cycle
2,977,000,492 branches # 701.717 M/sec
68,200,553 branch-misses # 2.29% of all branches
4.242877918 seconds time elapsed
4.242738000 seconds user
0.000000000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
4,245.32 msec task-clock # 0.998 CPUs utilized
27 context-switches # 0.006 K/sec
16 cpu-migrations # 0.004 K/sec
404 page-faults # 0.095 K/sec
21,028,111,166 cycles # 4.953 GHz
53,508,358,970 instructions # 2.54 insn per cycle
2,978,366,234 branches # 701.564 M/sec
68,564,858 branch-misses # 2.30% of all branches
4.252128683 seconds time elapsed
4.245507000 seconds user
0.000000000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
4,219.80 msec task-clock # 0.998 CPUs utilized
31 context-switches # 0.007 K/sec
16 cpu-migrations # 0.004 K/sec
403 page-faults # 0.096 K/sec
20,974,637,744 cycles # 4.971 GHz
53,504,238,172 instructions # 2.55 insn per cycle
2,976,963,851 branches # 705.476 M/sec
68,364,277 branch-misses # 2.30% of all branches
4.226625334 seconds time elapsed
4.215977000 seconds user
0.003999000 seconds sys
kkimj@kkimj-hanyang:~/PerformanceFuzzer/tests/cpubench$ sudo perf stat ./cpubench 50000 --singlethreaded --printdigits > tmp.tmp
Performance counter stats for './cpubench 50000 --singlethreaded --printdigits':
4,242.36 msec task-clock # 1.000 CPUs utilized
28 context-switches # 0.007 K/sec
16 cpu-migrations # 0.004 K/sec
402 page-faults # 0.095 K/sec
20,957,144,014 cycles # 4.940 GHz
53,504,261,007 instructions # 2.55 insn per cycle
2,976,965,135 branches # 701.724 M/sec
68,041,521 branch-misses # 2.29% of all branches
4.242869062 seconds time elapsed
4.242575000 seconds user
0.000000000 seconds sys
# 2>&1
results = os.popen('sudo perf stat ls 2>&1').readlines()
print(results)