This is an archive of the discontinued LLVM Phabricator instance.

[lit] Add --time-trace-output to lit
ClosedPublic

Authored by russell.gallop on Jul 30 2020, 4:00 AM.

Details

Summary

This produces a chrome://tracing compatible trace file in the same way as -ftime-trace.

This can be useful in optimising test time where one long test is causing long overall test time on a wide machine.
This also helped in finding tests which have side effects on others (e.g. https://reviews.llvm.org/D84885).

Example:


Diff Detail

Event Timeline

russell.gallop created this revision.Jul 30 2020, 4:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2020, 4:00 AM
Herald added a subscriber: delcypher. · View Herald Transcript
russell.gallop requested review of this revision.Jul 30 2020, 4:00 AM
russell.gallop edited the summary of this revision. (Show Details)Jul 30 2020, 4:06 AM
yln added a reviewer: jdenny.Jul 30 2020, 9:41 PM

That's really cool, thanks!

I am happy with this apart from some smaller nits.

llvm/utils/lit/lit/reports.py
139

2 blank lines

143

Unused

146

Please remove comment

148

Please format the new code/use linter.
Extra space after events =, missing space in #Rebase, etc.

152

Probably better to get the first timestamp in the beginning and compute the desired ts from the start rather than rebasing everything.

161

elapsed_time = test.result.elapsed or 0.0

yln added inline comments.Jul 30 2020, 9:43 PM
llvm/utils/lit/lit/reports.py
168

One quick additional question: I am assuming this is here because we want whole numbers? I am not sure about Python numerics; there is no risk of overflowing here, right?

Fixed comments and added test.

russell.gallop marked 7 inline comments as done.Jul 31 2020, 4:31 AM
russell.gallop added inline comments.
llvm/utils/lit/lit/reports.py
143

Now used.

148

Not sure what formatter is normally used for python in LLVM, applied autopep8 and fixed these.

152

Done (if I have understood correctly).

168

Good question. I had a look at this.

  • On python3 integers are of unlimited size so this is not a problem.
  • On python2 64bit an int is 64bit so this is not likely to be a problem
  • On python2 32bit an int is 32bit, which would be limit this to around 36 minutes. Python2 will promote this to a long if it goes over sys.maxint (even when creating an int with int()).

    Tested with the following on 32bit python2.7.15. i = int(2147483649.) # 2 more than sys.maxint as a float, like we are doing here. assert isinstance(i, long)

So it should be fine. Thanks for raising it.

russell.gallop marked 4 inline comments as done.Jul 31 2020, 6:31 AM
russell.gallop added inline comments.
llvm/utils/lit/lit/reports.py
168

I am assuming this is here because we want whole numbers?

That's correct.

yln accepted this revision.Jul 31 2020, 11:26 AM

LGTM, thanks! Please wait a few days before landing to give others a chance to comment.

This revision is now accepted and ready to land.Jul 31 2020, 11:26 AM
This revision was automatically updated to reflect the committed changes.