This is an archive of the discontinued LLVM Phabricator instance.

[XRay] [compiler-rt] make sure single threaded programs get traced too
ClosedPublic

Authored by pelikan on Oct 3 2017, 12:02 AM.

Details

Summary

When the XRay user calls the API to finish writing the log, the thread
which is calling the API still hasn't finished and therefore won't get
its trace written. Add a test for only the main thread to check this.

Event Timeline

pelikan created this revision.Oct 3 2017, 12:02 AM
dberris added inline comments.Oct 3 2017, 4:52 AM
lib/xray/xray_fdr_logging.cc
119–127

Shouldn't this happen before we write out the data instead, so we don't need to do a special write here?

test/xray/TestCases/Linux/fdr-single-thread.cc
3

Consider breaking these up with slashes:

// RUN: ... \
// RUN:     ... \
// RUN:     ...
pelikan updated this revision to Diff 117608.Oct 3 2017, 5:28 PM
pelikan marked 2 inline comments as done.

break up RUN: lines in the test

lib/xray/xray_fdr_logging.cc
119–127

That write will only be triggered if the second member of the tuple is true, which may or may not be the case. Hence the explicit write in an "if this thread needs it".

(Your question makes sense and I had it like that at first. It didn't work, though.)

test/xray/TestCases/Linux/fdr-single-thread.cc
3

I've also removed the "TRACE" thing when there's a perfectly sensible default.

dberris accepted this revision.Oct 3 2017, 8:14 PM

LGTM

This revision is now accepted and ready to land.Oct 3 2017, 8:14 PM
This revision was automatically updated to reflect the committed changes.