This is an archive of the discontinued LLVM Phabricator instance.

[XRay] Update TSC math to handle wraparound
ClosedPublic

Authored by dberris on Nov 4 2018, 9:16 PM.

Details

Summary

Prior to this change, we can run into situations where the TSC we're
getting when exiting a function is less than the TSC we got when
entering it. This would sometimes cause the counter for cumulative call
times overflow, which was erroneously also being stored as a signed
64-bit integer.

This change addresses both these issues while adding provisions for
tracking CPU migrations. We do this because moving from one CPU to
another doesn't guarantee that the timestamp counter for some
architectures aren't guaranteed to be synchronised. For the moment, we
leave the provisions there until we can update the data format to
include the counting of CPU migrations we can catch.

We update the necessary tests as well, ensuring that our expectations
for the cycle accounting to be met in case of counter wraparound.

Diff Detail

Repository
rL LLVM

Event Timeline

dberris created this revision.Nov 4 2018, 9:16 PM
dberris updated this revision to Diff 172543.Nov 4 2018, 9:29 PM
dberris retitled this revision from [XRay] Update TSC match to handle wraparound to [XRay] Update TSC math to handle wraparound.

FIx typo in title.

mboerger accepted this revision.Nov 4 2018, 9:37 PM

LGTM

This revision is now accepted and ready to land.Nov 4 2018, 9:37 PM
This revision was automatically updated to reflect the committed changes.