This is an archive of the discontinued LLVM Phabricator instance.

[LNT] Updated cPerf to read the section Attributes (support Simpleperf)
ClosedPublic

Authored by kpdev42 on Oct 25 2021, 12:17 AM.

Details

Summary

The current cPerf implementation requires the feature EVENT_DESC in the profile file.
The feature EVENT_DESC is optional and is missing in profile files generated by many tools including Simpleperf.
The same data is stored in the base section Attributes. But it is necessary some heuristic around event names.

OS Laboratory, Huawei Russian Research Institute (Saint-Petersburg)

Diff Detail

Repository
rLNT LNT

Event Timeline

kpdev42 created this revision.Oct 25 2021, 12:17 AM
kpdev42 requested review of this revision.Oct 25 2021, 12:17 AM
kpdev42 edited the summary of this revision. (Show Details)Oct 25 2021, 12:22 AM
thopre added inline comments.Oct 25 2021, 1:34 AM
lnt/testing/profile/cPerf.cpp
372

Are we sure this is safe for all architectures? Is there no architecture where functions can be unaligned?

419

Why is that needed? Is it just to fix a warning?

slydiman added inline comments.Oct 25 2021, 2:26 AM
lnt/testing/profile/cPerf.cpp
419

Right. size() returns size_t.

kpdev42 updated this revision to Diff 381946.Oct 25 2021, 5:18 AM

Remove address mask

kpdev42 marked an inline comment as done.Oct 25 2021, 5:18 AM
kpdev42 added inline comments.
lnt/testing/profile/cPerf.cpp
372

Remove this for now (maybe will add this functionality later)

kpdev42 updated this revision to Diff 384435.Nov 3 2021, 7:49 AM
kpdev42 marked an inline comment as done.

Rebase

thopre added inline comments.Nov 3 2021, 8:29 AM
lnt/testing/profile/cPerf.cpp
255–315

Is there no perf header that we could add to the tree?

721–722

Why is this no longer needed? You should adapt/remove the comment accordingly.

kpdev42 added inline comments.Nov 8 2021, 1:25 AM
lnt/testing/profile/cPerf.cpp
255–315

Do you mean system headers for perf support? Unfortunately, it is not a simple task. Such headers has a lot of dependencies and cannot be easily unified to use them on all supported platforms. That is the reason why all perf-specific structures are defined in this particular file.

thopre added inline comments.Nov 8 2021, 1:53 AM
lnt/testing/profile/cPerf.cpp
255–315

Ah ok, fine to copy the data structures here then.

kpdev42 added inline comments.Nov 10 2021, 10:56 PM
lnt/testing/profile/cPerf.cpp
721–722

I've added a patch for it: https://reviews.llvm.org/D113648
Please review

kpdev42 updated this revision to Diff 387234.Nov 15 2021, 6:12 AM
thopre accepted this revision.Nov 15 2021, 7:28 AM

LGTM

This revision is now accepted and ready to land.Nov 15 2021, 7:28 AM

This is broken on some of our bots e.g.

lnt/testing/profile/cPerf.cpp: In member function ‘unsigned char* PerfReader::readEvent(unsigned char*)’:
lnt/testing/profile/cPerf.cpp:682:14: error: expected primary-expression before ‘break’
  682 |       return break;
      |              ^~~~~

https://lab.llvm.org/buildbot/#/builders/179/builds/1765

thopre added inline comments.Nov 16 2021, 8:01 AM
lnt/testing/profile/cPerf.cpp
682
slydiman added inline comments.Nov 17 2021, 2:28 AM
lnt/testing/profile/cPerf.cpp
682

BTW, why the test build is disabled? How to enable it again?