#include "xray_profile_collector.h"
#include "sanitizer_common/sanitizer_common.h"
#include "xray_allocator.h"
#include "xray_defs.h"
#include "xray_profiling_flags.h"
#include "xray_segmented_array.h"
#include <memory>
#include <pthread.h>
#include <utility>
namespace __xray {
namespace profileCollectorService {
namespace {
SpinMutex GlobalMutex;
struct ThreadTrie { … };
struct ProfileBuffer { … };
constexpr u64 XRayProfilingVersion = …;
constexpr u64 XRayMagicBytes = …;
struct XRayProfilingFileHeader { … };
struct BlockHeader { … };
struct ThreadData { … };
ThreadDataArray;
ThreadDataAllocator;
alignas(BufferQueue) static std::byte BufferQueueStorage[sizeof(BufferQueue)];
static BufferQueue *BQ = …;
static BufferQueue::Buffer Buffer;
alignas(ThreadDataAllocator) static std::byte
ThreadDataAllocatorStorage[sizeof(ThreadDataAllocator)];
alignas(ThreadDataArray) static std::byte
ThreadDataArrayStorage[sizeof(ThreadDataArray)];
static ThreadDataAllocator *TDAllocator = …;
static ThreadDataArray *TDArray = …;
ProfileBufferArray;
ProfileBufferArrayAllocator;
alignas(ProfileBufferArray) static std::byte
ProfileBuffersStorage[sizeof(ProfileBufferArray)];
alignas(ProfileBufferArrayAllocator) static std::byte
ProfileBufferArrayAllocatorStorage[sizeof(ProfileBufferArrayAllocator)];
static ProfileBufferArrayAllocator *ProfileBuffersAllocator = …;
static ProfileBufferArray *ProfileBuffers = …;
static atomic_uint8_t CollectorInitialized{ … };
}
void post(BufferQueue *Q, FunctionCallTrie &&T,
FunctionCallTrie::Allocators &&A,
FunctionCallTrie::Allocators::Buffers &&B,
tid_t TId) XRAY_NEVER_INSTRUMENT { … }
PathArray;
struct ProfileRecord { … };
namespace {
ProfileRecordArray;
static void
populateRecords(ProfileRecordArray &PRs, ProfileRecord::PathAllocator &PA,
const FunctionCallTrie &Trie) XRAY_NEVER_INSTRUMENT { … }
static void serializeRecords(ProfileBuffer *Buffer, const BlockHeader &Header,
const ProfileRecordArray &ProfileRecords)
XRAY_NEVER_INSTRUMENT { … }
}
void serialize() XRAY_NEVER_INSTRUMENT { … }
void reset() XRAY_NEVER_INSTRUMENT { … }
XRayBuffer nextBuffer(XRayBuffer B) XRAY_NEVER_INSTRUMENT { … }
}
}