This is an archive of the discontinued LLVM Phabricator instance.

implement timeout sample support for Linux
ClosedPublic

Authored by tfiala on Sep 23 2016, 5:07 PM.

Details

Summary

This is the Linux counterpart to the recently-added macOS-side support for sampling a test process that times out, prior to killing it.

This implementation is based on the Linux perf tools. Each distribution will have a different way to install it. The hook is skipped if Linux perf is not available.

On Ubuntu 16.04, the requisite support can be retrieved with:

sudo apt-get install perf-tools-unstable

Like the macOS side, the content out the time spent at each call point per backtrace is specified in a file in the session directory of the format:
{TestName.py}-{pid}.sample

Diff Detail

Repository
rL LLVM

Event Timeline

tfiala updated this revision to Diff 72382.Sep 23 2016, 5:07 PM
tfiala retitled this revision from to implement timeout sample support for Linux.
tfiala updated this object.
tfiala added reviewers: labath, tberghammer.
tfiala added a subscriber: lldb-commits.
tfiala added inline comments.Sep 23 2016, 5:09 PM
packages/Python/lldbsuite/pre_kill_hook/linux.py
68 ↗(On Diff #72382)

Haha woops - that should be:

raise Exception("failed to call 'perf record ..., error code: {}".format(returncode))

I'll fix that in the final.

labath accepted this revision.Sep 26 2016, 2:03 AM
labath edited edge metadata.

lgtm

This revision is now accepted and ready to land.Sep 26 2016, 2:03 AM
This revision was automatically updated to reflect the committed changes.

BTW, regarding this part:

On Ubuntu 16.04, the requisite support can be retrieved with:

sudo apt-get install perf-tools-unstable

This was incorrect. The perf tool was actually present even without the perf-tools-unstable on Ubuntu 16.04 x86_64. It is just that there are more tools for processing perf output available with that package, but this change doesn't require any of them. /usr/bin/perf comes from the linux-tools-common package on Ubuntu. I tried testing with and without that package installed.