Page MenuHomePhabricator

[XRay][compiler-rt] Migrate basic mode logging to the XRay framework

Authored by dberris on Nov 16 2017, 9:43 PM.



Before this patch, XRay's basic (naive mode) logging would be
initialised and installed in an adhoc manner. This patch ports the
implementation of the basic (naive mode) logging implementation to use
the common XRay framework.

We also make the following changes to reduce the variance between the
usage model of basic mode from FDR (flight data recorder) mode:

  • Allow programmatic control of the size of the buffers dedicated to per-thread records. This removes some hard-coded constants and turns them into runtime-controllable flags and through an Options structure.
  • Default the xray_naive_log option to false. For now, the only way to start basic mode is to set the environment variable, or set the default at build-time compiler options. Because of this change we've had to update a couple of tests relying on basic mode being always on.
  • Removed the reliance on a non-trivially destructible per-thread resource manager. We use a similar trick done in D39526 to use pthread_key_create() and pthread_setspecific() to ensure that the per-thread cleanup handling is performed at thread-exit time.

We also radically simplify the code structure for basic mode, to move
most of the implementation in the __xray namespace.

Diff Detail


Event Timeline

dberris created this revision.Nov 16 2017, 9:43 PM
pelikan accepted this revision.Nov 20 2017, 11:25 PM

Although it looks better than the original, there's a lot going on and I can't guarantee I haven't missed some stupid typo. Basically, LGTM.

This revision is now accepted and ready to land.Nov 20 2017, 11:25 PM
This revision was automatically updated to reflect the committed changes.