This is an archive of the discontinued LLVM Phabricator instance.

[XRay] Define the library for XRay trace logs

Authored by dberris on Jan 4 2017, 10:37 PM.



In this change we move the definition of the log reading routines from
the tools directory in LLVM to {include/llvm,lib}/XRay. We improve the
documentation a little bit for the publicly accessible headers, and
adjust the top-matter. This also leads to some refactoring and cleanup
in the tooling code.

In particular, we do the following:

  • Rename the class from LogReader to Trace, as it better represents
		the logical set of records as opposed to a log.
  • Use file type detection instead of asking the user to say what
		format the input file is. This allows us to keep the interface
		simple and encapsulate the logic of loading the data appropriately.

In future changes we increase the API surface and write dedicated unit
tests for the XRay library.

Depends on D24376.

Event Timeline

dberris updated this revision to Diff 83195.Jan 4 2017, 10:37 PM
dberris retitled this revision from to [XRay] Define the library for XRay trace logs.
dberris updated this object.
dberris added reviewers: dblaikie, echristo.
dberris added subscribers: varno, llvm-commits.
dblaikie accepted this revision.Jan 9 2017, 11:29 AM
dblaikie edited edge metadata.
dblaikie added inline comments.

Can the LogLoader use file magic to detect how to parse the file rather than having the user specify a LoaderFunction?


Name seems slightly erroneous - rather than loading the log, this class seems to represent the log itself (you iterate over it as in the example, etc). Perhaps it should be called 'Log' instead? (or maybe there's a less ambiguous/likely colliding name) maybe with a named ctor (static function) called 'parse' instead of a ctor, for documentation?

This revision is now accepted and ready to land.Jan 9 2017, 11:29 AM
dberris updated this revision to Diff 83916.Jan 10 2017, 10:46 PM
dberris marked 2 inline comments as done.
dberris edited edge metadata.

Use file type detection and rename LogReader to Trace.

dberris updated this revision to Diff 83917.Jan 10 2017, 10:48 PM
dberris updated this object.

Retitle the patch.

This revision was automatically updated to reflect the committed changes.