llvm-project/compiler-rt/test/xray/TestCases/Linux/optional-inmemory-log.cc
Dean Michael Berris f50eb93da7 [compiler-rt][XRay] Initial per-thread inmemory logging implementation
Depends on D21612 which implements the building blocks for the compiler-rt
implementation of the XRay runtime. We use a naive in-memory log of fixed-size
entries that get written out to a log file when the buffers are full, and when
the thread exits.

This implementation lays some foundations on to allowing for more complex XRay
records to be written to the log in subsequent changes. It also defines the format
that the function call accounting tool in D21987 will start building upon.

Once D21987 lands, we should be able to start defining more tests using that tool
once the function call accounting tool becomes part of the llvm distribution.

Reviewers: echristo, kcc, rnk, eugenis, majnemer, rSerge

Subscribers: sdardis, rSerge, dberris, tberghammer, danalbert, srhines, majnemer, llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D21982

llvm-svn: 279805
2016-08-26 06:39:33 +00:00

22 lines
642 B
C++

// Make sure that we don't get the inmemory logging implementation enabled when
// we turn it off via options.
// RUN: %clangxx_xray -std=c++11 %s -o %t
// RUN: XRAY_OPTIONS="verbosity=1 xray_naive_log=false xray_logfile_base=optional-inmemory-log.xray-" %run %t 2>&1 | FileCheck %s
//
// Make sure we clean out the logs in case there was a bug.
//
// RUN: rm -f optional-inmemory-log.xray-*
#include <cstdio>
[[clang::xray_always_instrument]] void foo() {
printf("foo() is always instrumented!");
}
int main() {
// CHECK-NOT: XRay: Log file in 'optional-inmemory-log.xray-{{.*}}'
foo();
// CHECK: foo() is always instrumented!
}