This is an archive of the discontinued LLVM Phabricator instance.

Order File Instrumentation: dump the data in compiler-rt
ClosedPublic

Authored by manmanren on Jan 31 2019, 11:20 AM.

Diff Detail

Event Timeline

manmanren created this revision.Jan 31 2019, 11:20 AM
Herald added subscribers: Restricted Project, dberris. · View Herald TranscriptJan 31 2019, 11:20 AM
manmanren updated this revision to Diff 184632.Jan 31 2019, 3:20 PM

Small Nits

davidxl added inline comments.Feb 1 2019, 9:50 AM
lib/profile/InstrProfilingFile.c
690

I suggest not using the main file for order dumping for a couple of reasons:

  1. To append it into the main file, you will need to update the raw header to set order file size
  2. you will need to add profile merging support for ordering file. It can be tricky as the value profile data length is variable from run to run

To dump into a separate file, you can use the main filename as the base with a differnent suffix:

main file: default_xxx.profraw
order file: default_xxx.order, or simply default_xxx.profraw.order

manmanren updated this revision to Diff 188562.Feb 27 2019, 9:08 AM

Hi David,

Thanks for reviewing the patch! Sorry for the delay! Just came back from a vacation.

The updated diff dumps order file profile data in xxx.order.

Manman

thanks. Can you add a few test cases in the patch?

manmanren updated this revision to Diff 188662.Feb 27 2019, 7:30 PM

Add a testing case to make sure the instrumentation works correctly!

davidxl added inline comments.Feb 28 2019, 10:10 AM
lib/profile/InstrProfilingFile.c
115

As follow up, I think it is better to make buffer size controllable by an internal option, and compiler can pass the size to runtime via a variable. Not needed for this patch.

116

The #if 0 needs to be cleaned up.

test/profile/Inputs/instrprof-order-file.c
11

Perfhaps call 'g' in a loop to show only one entry is recorded?

12

add another call to 'f' after call to 'g' to test it is not double recorded.

manmanren updated this revision to Diff 188802.Feb 28 2019, 3:57 PM
manmanren marked an inline comment as done.

Address review comments!

davidxl added inline comments.Feb 28 2019, 4:12 PM
test/profile/instrprof-order-file.test
5

is this option -forder-file-instrumentation already available in clang?

7

is 'od' portable? maybe exclude it for windows?

manmanren marked 2 inline comments as done.Feb 28 2019, 6:07 PM

Thanks!

Manman

lib/profile/InstrProfilingFile.c
116

Oh that was when I was debugging! Sorry about that.

test/profile/instrprof-order-file.test
5

This is in a separate diff (D58751) :]

7

Good point!

manmanren updated this revision to Diff 188927.Mar 1 2019, 9:18 AM

Mark windows as unsupported in the testing case.

davidxl accepted this revision.Mar 2 2019, 5:24 PM

lgtm

This revision is now accepted and ready to land.Mar 2 2019, 5:24 PM
This revision was automatically updated to reflect the committed changes.
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 4 2019, 2:29 PM