class Chunk

Defined at line 363 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

Public Members

static const size_t kMaxSize

Public Methods

void Chunk ()
void Chunk (const Chunk & )

Chunk is move-only, to document the scope of the Acquire/Release

TryLock operations below.

Defined at line 369 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

void Chunk (Chunk && )
Chunk operator= (const Chunk & )

Defined at line 370 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

uint8_t * begin ()

Defined at line 374 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

uint8_t * end ()

Defined at line 375 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

Chunk & operator= (Chunk && )
size_t size ()

Size, including Chunk header.

Defined at line 378 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

uint8_t * payload_begin ()

Begin of the first packet (or packet fragment).

Defined at line 381 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

size_t payload_size ()

Defined at line 382 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

bool is_valid ()

Defined at line 387 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

uint8_t chunk_idx ()

Index of the chunk within the page [0..13] (13 comes from kPageDiv14).

Defined at line 390 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

ChunkHeader * header ()

Defined at line 392 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

uint16_t writer_id ()

Defined at line 394 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

std::pair<uint16_t, uint8_t> GetPacketCountAndFlags ()

Returns the count of packets and the flags with acquire-load semantics.

Defined at line 399 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

uint16_t IncrementPacketCount ()

Increases |packets.count| with release semantics (note, however, that the

packet count is incremented *before* starting writing a packet). Returns

the new packet count. The increment is atomic but NOT race-free (i.e. no

CAS). Only the Producer is supposed to perform this increment, and it's

supposed to do that in a thread-safe way (holding a lock). A Chunk cannot

be shared by multiple Producer threads without locking. The packet count

is cleared by TryAcquireChunk(), when passing the new header for the

chunk.

Defined at line 414 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

void SetFlag (ChunkHeader::Flags flag)

Flags are cleared by TryAcquireChunk(), by passing the new header for

the chunk, or through ClearNeedsPatchingFlag.

Defined at line 424 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

void ClearNeedsPatchingFlag ()

This flag can only be cleared by the producer while it is still holding

on to the chunk - i.e. while the chunk is still in state

ChunkState::kChunkBeingWritten and hasn't been transitioned to

ChunkState::kChunkComplete. This is ok, because the service is oblivious

to the needs patching flag before the chunk is released as complete.

Defined at line 436 of file ../../third_party/perfetto/include/perfetto/ext/tracing/core/shared_memory_abi.h

Friends

class SharedMemoryABI