Last active
May 3, 2016 04:48
-
-
Save davepacheco/a12a0d45d55f0d7a28c312c2cd3cf234 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I've got a shell for testing: | |
testshell $ echo $$ | |
2133 | |
# From a second shell, I'll instrument every instruction, function entry, | |
# and function return in the first shell, which is about 142,000 probes: | |
tracer $ dtrace -ln 'pid2133:a.out::' | wc -l | |
142008 | |
tracer $ dtrace -n 'pid2133:a.out::{ @ = count(); }' | |
dtrace: description 'pid2133:a.out::' matched 142007 probes | |
# Now I'll run this loop in the first shell: | |
testshell $ time for ((i = 0; i < 10000; i++)) { :; } | |
real 3m38.393s | |
user 3m28.516s | |
sys 0m0.300s | |
# Here's the full output from the second shell: | |
tracer $ dtrace -n 'pid2133:a.out::{ @ = count(); }' | |
dtrace: description 'pid2133:a.out::' matched 142007 probes | |
^C | |
161566411 | |
# That's 161566411 probes executed in 218.393s, for about | |
# 1352 nanoseconds per probe. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment