2016-07-21 15:39:55 +08:00
|
|
|
//===-- xray_flags.inc ------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2016-07-21 15:39:55 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// XRay runtime flags.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef XRAY_FLAG
|
|
|
|
#error "Define XRAY_FLAG prior to including this file!"
|
|
|
|
#endif
|
|
|
|
|
2017-02-28 16:10:01 +08:00
|
|
|
XRAY_FLAG(bool, patch_premain, false,
|
2016-07-21 15:39:55 +08:00
|
|
|
"Whether to patch instrumentation points before main.")
|
[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 14:39:33 +08:00
|
|
|
XRAY_FLAG(const char *, xray_logfile_base, "xray-log.",
|
|
|
|
"Filename base for the xray logfile.")
|
2017-12-05 20:08:56 +08:00
|
|
|
XRAY_FLAG(const char *, xray_mode, "", "Mode to install by default.")
|
2017-12-14 10:51:20 +08:00
|
|
|
XRAY_FLAG(uptr, xray_page_size_override, 0,
|
|
|
|
"Override the default page size for the system, in bytes. The size "
|
|
|
|
"should be a power-of-two.")
|
2017-11-21 15:29:21 +08:00
|
|
|
|
|
|
|
// Basic (Naive) Mode logging options.
|
|
|
|
XRAY_FLAG(bool, xray_naive_log, false,
|
2017-12-05 20:08:56 +08:00
|
|
|
"DEPRECATED: Use xray_mode=xray-basic instead.")
|
2017-11-21 15:29:21 +08:00
|
|
|
XRAY_FLAG(int, xray_naive_log_func_duration_threshold_us, 5,
|
2018-05-04 14:27:53 +08:00
|
|
|
"DEPRECATED: use the environment variable XRAY_BASIC_OPTIONS and set "
|
|
|
|
"func_duration_threshold_us instead.")
|
2017-11-21 15:29:21 +08:00
|
|
|
XRAY_FLAG(int, xray_naive_log_max_stack_depth, 64,
|
2018-05-04 14:27:53 +08:00
|
|
|
"DEPRECATED: use the environment variable XRAY_BASIC_OPTIONS and set "
|
|
|
|
"max_stack_depth instead.")
|
2017-11-21 15:29:21 +08:00
|
|
|
XRAY_FLAG(int, xray_naive_log_thread_buffer_size, 1024,
|
2018-05-04 14:27:53 +08:00
|
|
|
"DEPRECATED: use the environment variable XRAY_BASIC_OPTIONS and set "
|
|
|
|
"thread_buffer_size instead.")
|
2017-11-21 15:29:21 +08:00
|
|
|
|
|
|
|
// FDR (Flight Data Recorder) Mode logging options.
|
[XRay][compiler-rt] XRay Flight Data Recorder Mode
Summary:
In this change we introduce the notion of a "flight data recorder" mode
for XRay logging, where XRay logs in-memory first, and write out data
on-demand as required (as opposed to the naive implementation that keeps
logging while tracing is "on"). This depends on D26232 where we
implement the core data structure for holding the buffers that threads
will be using to write out records of operation.
This implementation only currently works on x86_64 and depends heavily
on the TSC math to write out smaller records to the inmemory buffers.
Also, this implementation defines two different kinds of records with
different sizes (compared to the current naive implementation): a
MetadataRecord (16 bytes) and a FunctionRecord (8 bytes). MetadataRecord
entries are meant to write out information like the thread ID for which
the metadata record is defined for, whether the execution of a thread
moved to a different CPU, etc. while a FunctionRecord represents the
different kinds of function call entry/exit records we might encounter
in the course of a thread's execution along with a delta from the last
time the logging handler was called.
While this implementation is not exactly what is described in the
original XRay whitepaper, this one gives us an initial implementation
that we can iterate and build upon.
Reviewers: echristo, rSerge, majnemer
Subscribers: mehdi_amini, llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D27038
llvm-svn: 293015
2017-01-25 11:50:46 +08:00
|
|
|
XRAY_FLAG(bool, xray_fdr_log, false,
|
2017-12-05 20:08:56 +08:00
|
|
|
"DEPRECATED: Use xray_mode=xray-fdr instead.")
|
2017-04-06 15:14:43 +08:00
|
|
|
XRAY_FLAG(int, xray_fdr_log_func_duration_threshold_us, 5,
|
2018-05-04 14:13:35 +08:00
|
|
|
"DEPRECATED: use the environment variable XRAY_FDR_OPTIONS and set "
|
|
|
|
"func_duration_threshold_us instead.")
|
2017-11-28 19:49:22 +08:00
|
|
|
XRAY_FLAG(int, xray_fdr_log_grace_period_us, 0,
|
2018-05-04 14:13:35 +08:00
|
|
|
"DEPRECATED: use the environment variable XRAY_FDR_OPTIONS and set "
|
|
|
|
"grace_period_ms instead.")
|
2017-11-28 19:49:22 +08:00
|
|
|
XRAY_FLAG(int, xray_fdr_log_grace_period_ms, 100,
|
2018-05-04 14:13:35 +08:00
|
|
|
"DEPRECATED: use the environment variable XRAY_FDR_OPTIONS and set "
|
|
|
|
"grace_period_ms instead.")
|