-
Notifications
You must be signed in to change notification settings - Fork 120
[RFC] Add profile summary information to GCOV #251
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
base: master
Are you sure you want to change the base?
Conversation
gcov.cc
Outdated
| if (absl::GetFlag(FLAGS_gcov_version) == 2 || | ||
| absl::GetFlag(FLAGS_gcov_version) == 3) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (absl::GetFlag(FLAGS_gcov_version) == 2 || | |
| absl::GetFlag(FLAGS_gcov_version) == 3) { | |
| if (absl::GetFlag(FLAGS_gcov_version) >= 2) { |
gcov.cc
Outdated
| if (absl::GetFlag(FLAGS_gcov_version) == 2 || | ||
| absl::GetFlag(FLAGS_gcov_version) == 3) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (absl::GetFlag(FLAGS_gcov_version) == 2 || | |
| absl::GetFlag(FLAGS_gcov_version) == 3) { | |
| if (absl::GetFlag(FLAGS_gcov_version) >= 2) { |
| #include "llvm/ProfileData/SampleProf.h" | ||
| #include "llvm/ProfileData/ProfileCommon.h" | ||
|
|
||
| // sizeof(gcov_unsigned_t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid dragging any llvm files into create_gcov build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using the LLVM files to calculate the histogram information in the same manner as create_llvm_prof - removing them would require duplicating a fair bit of logic from the LLVM side.
|
@dc03-work I saw that you made some changes to your GCC patch. Does that require corresponding changes in this PR? |
No, but I will be rewriting the histogram calculation as a set of standalone routines. |
This patch adds supports for writing out profile summaries and histogram-based percentile information for samples to the GCOV profile, in a similar manner to how this information is written out for LLVM profiles. It also bumps the GCOV version to 3.
72fa47a to
9627fd2
Compare
|
@erozenfeld Hi, I have implemented the calculation as a standalone visitor and verified that it produces the same values as LLVM's implementation. Does this look OK now? |
|
@erozenfeld Similar to #244, the GCC patch corresponding to this has landed as r16-6349-gdbe8e0efb7b029. Can we please land this if there are no immediate issues as well? This is also required for the AutoFDO flow to work. |
This patch aims to implement summary support in auto-profile, similar to LLVM. The summary information stores various information about the profile being read such as the number of functions, the maximum sample count, the total number of samples and so on. It also adds a section called the "detailed summary" which contains a histogram-based calculation of the minimum execution count for a sample needed to belong to a specific percentile of samples. This is used to decide the hot count threshold (which can be controlled with a command line parameter). The default is any sample belonging to the 99th percentile being marked as hot. This patch requires the changes from google/autofdo#251 to work correctly. Signed-off-by: Dhruv Chawla <[email protected]> gcc/ChangeLog: * auto-profile.cc (struct summary_info): New struct. (summary_info::read): New function. (summary_info::get_threshold_count): Likewise. (function_instance::read_function_instance): Read afdo_profile_info->sum_max directly from summary info. (autofdo_source_profile::read): Set afdo_hot_bb_threshold from param_hot_bb_count_ws_permille. (read_profile): Call summary_info->read. (end_auto_profile): Free afdo_summary_info. * gcov-io.h (GCOV_TAG_AFDO_SUMMARY): New define.
This patch adds supports for writing out profile summaries and histogram-based percentile information for samples to the GCOV profile, in a similar manner to how this information is written out for LLVM profiles. It also bumps the GCOV version to 3. This is part of the work to add support for the same to GCC.