mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-29 03:04:39 +00:00
364f11cdd3
Summary: Before this patch, XRay's basic (naive mode) logging would be initialised and installed in an adhoc manner. This patch ports the implementation of the basic (naive mode) logging implementation to use the common XRay framework. We also make the following changes to reduce the variance between the usage model of basic mode from FDR (flight data recorder) mode: - Allow programmatic control of the size of the buffers dedicated to per-thread records. This removes some hard-coded constants and turns them into runtime-controllable flags and through an Options structure. - Default the `xray_naive_log` option to false. For now, the only way to start basic mode is to set the environment variable, or set the default at build-time compiler options. Because of this change we've had to update a couple of tests relying on basic mode being always on. - Removed the reliance on a non-trivially destructible per-thread resource manager. We use a similar trick done in D39526 to use pthread_key_create() and pthread_setspecific() to ensure that the per-thread cleanup handling is performed at thread-exit time. We also radically simplify the code structure for basic mode, to move most of the implementation in the `__xray` namespace. Reviewers: pelikan, eizan, kpw Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40164 llvm-svn: 318734
45 lines
1.7 KiB
C++
45 lines
1.7 KiB
C++
//===-- xray_inmemory_log.h
|
|
//------------------------------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file is a part of XRay, a function call tracing system.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
#ifndef XRAY_XRAY_INMEMORY_LOG_H
|
|
#define XRAY_XRAY_INMEMORY_LOG_H
|
|
|
|
#include "xray/xray_log_interface.h"
|
|
|
|
/// Basic (Naive) Mode
|
|
/// ==================
|
|
///
|
|
/// This implementation hooks in through the XRay logging implementation
|
|
/// framework. The Basic Mode implementation will keep appending to a file as
|
|
/// soon as the thread-local buffers are full. It keeps minimal in-memory state
|
|
/// and does the minimum filtering required to keep log files smaller.
|
|
|
|
namespace __xray {
|
|
|
|
XRayLogInitStatus basicLoggingInit(size_t BufferSize, size_t BufferMax,
|
|
void *Options, size_t OptionsSize);
|
|
XRayLogInitStatus basicLoggingFinalize();
|
|
|
|
void basicLoggingHandleArg0RealTSC(int32_t FuncId, XRayEntryType Entry);
|
|
void basicLoggingHandleArg0EmulateTSC(int32_t FuncId, XRayEntryType Entry);
|
|
void basicLoggingHandleArg1RealTSC(int32_t FuncId, XRayEntryType Entry,
|
|
uint64_t Arg1);
|
|
void basicLoggingHandleArg1EmulateTSC(int32_t FuncId, XRayEntryType Entry,
|
|
uint64_t Arg1);
|
|
XRayLogFlushStatus basicLoggingFlush();
|
|
XRayLogInitStatus basicLoggingReset();
|
|
|
|
} // namespace __xray
|
|
|
|
#endif // XRAY_XRAY_INMEMORY_LOG_H
|