Created
March 5, 2015 19:50
-
-
Save chrisseaton/67eb3e24f6b02a0cc45c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Typical mode, runs the block as many times as it can | |
x.report("addition") { 1 + 2 } | |
# To reduce overhead, the number of iterations is passed in | |
# and the block must run the code the specific number of times. | |
# Used for when the workload is very small and any overhead | |
# introduces incorrectable errors. | |
x.report("addition2") do |times| | |
i = 0 | |
while i < times | |
1 + 2 | |
i += 1 | |
end | |
end | |
# To reduce overhead even more, grafts the code given into | |
# the loop that performs the iterations internally to reduce | |
# overhead. Typically not needed, use the |times| form instead. | |
x.report("addition3", "1 + 2") | |
# Really long labels should be formatted correctly | |
x.report("addition-test-long-label") { 1 + 2 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment