You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ perf stat ./hello
Hello world
Performance counter stats for './hello':
0.56 msec task-clock # 0.632 CPUs utilized
0 context-switches # 0.000 K/sec
0 cpu-migrations # 0.000 K/sec
55 page-faults # 0.099 M/sec
1,081,405 cycles # 1.948 GHz
727,622 stalled-cycles-frontend # 67.28% frontend cycles idle
716,960 instructions # 0.66 insn per cycle
# 1.01 stalled cycles per insn
148,252 branches # 267.062 M/sec
7,975 branch-misses # 5.38% of all branches
0.000878743 seconds time elapsed
0.000930000 seconds user
0.000000000 seconds sys
Measuring performance with time is complicated, using instructions is a more stable measure. perf stat has some useful options like -x SEP to generate CSV output and -o <file> to write the output to a file. Note that you might have to tweak some kernel options or run as root to make perf work, but it's pretty good about telling you what you need to do.
If you use the time command (not the shell builtin) you can get peak RSS (which is probably the thing you care about measuring for memory usage) in kilobytes:
$ /usr/bin/time -f '%M' ./hello
Hello world
1340
You can pass -o <file> to ask time to write its output to a file instead.
No description provided.
The text was updated successfully, but these errors were encountered: