#include "src/tracing/service/trace_buffer.h"
#include <limits>
#include "perfetto/base/logging.h"
#include "perfetto/ext/base/utils.h"
#include "perfetto/ext/tracing/core/client_identity.h"
#include "perfetto/ext/tracing/core/shared_memory_abi.h"
#include "perfetto/ext/tracing/core/trace_packet.h"
#include "perfetto/protozero/proto_utils.h"
#define TRACE_BUFFER_VERBOSE_LOGGING() …
#if TRACE_BUFFER_VERBOSE_LOGGING()
#define TRACE_BUFFER_DLOG …
#else
#define TRACE_BUFFER_DLOG(...) …
#endif
namespace perfetto {
namespace {
constexpr uint8_t kFirstPacketContinuesFromPrevChunk = …;
constexpr uint8_t kLastPacketContinuesOnNextChunk = …;
constexpr uint8_t kChunkNeedsPatching = …;
}
const size_t TraceBuffer::InlineChunkHeaderSize = …;
std::unique_ptr<TraceBuffer> TraceBuffer::Create(size_t size_in_bytes,
OverwritePolicy pol) { … }
TraceBuffer::TraceBuffer(OverwritePolicy pol) : … { … }
TraceBuffer::~TraceBuffer() = default;
bool TraceBuffer::Initialize(size_t size) { … }
void TraceBuffer::CopyChunkUntrusted(
ProducerID producer_id_trusted,
const ClientIdentity& client_identity_trusted,
WriterID writer_id,
ChunkID chunk_id,
uint16_t num_fragments,
uint8_t chunk_flags,
bool chunk_complete,
const uint8_t* src,
size_t size) { … }
ssize_t TraceBuffer::DeleteNextChunksFor(size_t bytes_to_clear) { … }
void TraceBuffer::AddPaddingRecord(size_t size) { … }
bool TraceBuffer::TryPatchChunkContents(ProducerID producer_id,
WriterID writer_id,
ChunkID chunk_id,
const Patch* patches,
size_t patches_size,
bool other_patches_pending) { … }
void TraceBuffer::BeginRead() { … }
TraceBuffer::SequenceIterator TraceBuffer::GetReadIterForSequence(
ChunkMap::iterator seq_begin) { … }
void TraceBuffer::SequenceIterator::MoveNext() { … }
bool TraceBuffer::ReadNextTracePacket(
TracePacket* packet,
PacketSequenceProperties* sequence_properties,
bool* previous_packet_on_sequence_dropped) { … }
TraceBuffer::ReadAheadResult TraceBuffer::ReadAhead(TracePacket* packet) { … }
TraceBuffer::ReadPacketResult TraceBuffer::ReadNextPacketInChunk(
ProducerAndWriterID producer_and_writer_id,
ChunkMeta* const chunk_meta,
TracePacket* packet) { … }
void TraceBuffer::DiscardWrite() { … }
std::unique_ptr<TraceBuffer> TraceBuffer::CloneReadOnly() const { … }
TraceBuffer::TraceBuffer(CloneCtor, const TraceBuffer& src)
: … { … }
}