Skip to content
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

Remove profiling overhead from profiles #1111

Merged

Conversation

MasterDuke17
Copy link
Contributor

By calculating the average cost of executing the profiling functions and
then subtracting that times the number of entries from the exclusive
cost of an HLL block.

This gist (https://gist.github.com/MasterDuke17/ab7108070054f92e4cab5313033ea3f8) has some data for what the values were when https://github.com/MasterDuke17/MoarVM/blob/remove_profiling_overhead_from_profile/src/profiler/instrument.c#L399 and https://github.com/MasterDuke17/MoarVM/blob/remove_profiling_overhead_from_profile/src/profiler/instrument.c#L418 branches were taken when profiling (^5_000).grep(*.is-prime).tail.say; my $a = (^100).pick(2).join; my $b; for ^100_000 { ++$b if $a ~~ / $_ / }; say $b.

By calculating the average cost of executing the profiling functions and
then subtracting that times the number of entries from the exclusive
cost of an HLL block.
@MasterDuke17 MasterDuke17 force-pushed the remove_profiling_overhead_from_profile branch from 29d5f5e to fbd4801 Compare June 4, 2019 04:07
@MasterDuke17 MasterDuke17 requested a review from timo June 6, 2019 17:03
MVM_profile_log_exit(tc);
}
e = uv_hrtime();
tc->instance->profiling_overhead = (MVMuint64) ((e - s) / 1000) * 0.9;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the * 0.9 here?

@MasterDuke17
Copy link
Contributor Author

MasterDuke17 commented Jun 7, 2019 via email

@jnthn
Copy link
Member

jnthn commented Jun 9, 2019

Just a scaling factor in case the measurement is a little high.

Hm, from the loop overhead, perhaps? It's quite hard to reason about, since the C compiler may also do inlining and cancel the cost of the function call overhead.

I guess let's give this a try, though; I think even slightly off compensation is going to give better numbers than none at all.

@jnthn jnthn merged commit dbbfe3d into MoarVM:master Jun 9, 2019
@MasterDuke17 MasterDuke17 deleted the remove_profiling_overhead_from_profile branch June 9, 2019 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants