-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting over 100% in total #9
Comments
This is possible when a frame is in the stack more than once, i.e. recursion. |
Thanks for this gem. Seems really useful but I am having trouble understanding the output. If you could explain what the numbers in each column mean I would be really appreciative. For instance, looking at the total column Typhoeus::Multi#perform looks troubling at 84% but from the sample it shows 1.2%. What is the difference between these two columns? Why when added up do both of these columns percentages not add up to 100%? I would assume that each percentage means that that is the percentage of total time spent in each method but again they do not add up to 100% which is confusing. From the output below is URI::Parser#split taking up most of my processing time or is it Typhoeus::Multi#perform? Thanks again. Mode: cpu(1000)
|
It would make sense to deduplicate these entries to avoid inflating stats. |
I'd be very interested in a brief explanation of the results as well (using the text formatter). Thank you for the awesome tool @tmm1 |
First, thanks for the tool @tmm1 , it is great! :) About this issue, I don't think it is only a question of recursion. Maybe I just don't understand it, but with this basic example:
I end up with:
(using Also please note that 7308 = 3654 * 2, not sure why I get that :/ |
@Karlotcha I'm sure you forgot about this, but I'll reply here in case other people google for this (like I did today). This happens because each block call adds a method to stacktrace. For example,
Note that m2 appears 3 times in the stack trace, so if I change your code to def m2
i = 1
(1..100000).each { |n| -> { i *= n }.call }
end
profile = StackProf.run(mode: :cpu, out: 'stackprof-cpu-myapp.dump', raw: true, interval: 1000) do
m2
end I get 3 times the amount (
And if I remove the block call: def m2
i = 1
n = 1
while n < 100000
i *= n
n += 1
end
end
profile = StackProf.run(mode: :cpu, out: 'stackprof-cpu-myapp.dump', raw: true, interval: 1000) do
m2
end I get the correct number of samples.
|
With 0.2.0 on 2.1.0-rc1:
The text was updated successfully, but these errors were encountered: