class SampleProfileReaderExtBinaryBase

Declaration

class SampleProfileReaderExtBinaryBase
    : public SampleProfileReaderBinary { /* full declaration omitted */ };

Description

SampleProfileReaderExtBinaryBase/SampleProfileWriterExtBinaryBase defines the basic structure of the extensible binary format. The format is organized in sections except the magic and version number at the beginning. There is a section table before all the sections, and each entry in the table describes the entry type, start, size and attributes. The format in each section is defined by the section itself. It is easy to add a new section while maintaining the backward compatibility of the profile. Nothing extra needs to be done. If we want to extend an existing section, like add cache misses information in addition to the sample count in the profile body, we can add a new section with the extension and retire the existing section, and we could choose to keep the parser of the old section if we want the reader to be able to read both new and old format profile. SampleProfileReaderExtBinary/SampleProfileWriterExtBinary define the commonly used sections of a profile in extensible binary format. It is possible to define other types of profile inherited from SampleProfileReaderExtBinaryBase/SampleProfileWriterExtBinaryBase.

Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:576

Inherits from: SampleProfileReaderBinary

Member Variables

protected std::vector<SecHdrTableEntry> SecHdrTable
protected std::unique_ptr<ProfileSymbolList> ProfSymList

Inherited from SampleProfileReaderBinary:

protected Data = nullptr
protected End = nullptr
protected NameTable

Inherited from SampleProfileReader:

protected Profiles
protected Ctx
protected Buffer
protected Summary
protected Remapper
protected Format = SPF_None

Method Overview

Inherited from SampleProfileReaderBinary:

Inherited from SampleProfileReader:

Methods

SampleProfileReaderExtBinaryBase(
    std::unique_ptr<MemoryBuffer> B,
    llvm::LLVMContext& C,
    llvm::sampleprof::SampleProfileFormat Format)

Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:596

Parameters

std::unique_ptr<MemoryBuffer> B
llvm::LLVMContext& C
llvm::sampleprof::SampleProfileFormat Format

virtual bool dumpSectionInfo(
    llvm::raw_ostream& OS = dbgs())

Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:607

Parameters

llvm::raw_ostream& OS = dbgs()

uint64_t getFileSize()

Description

Get the total size of header and all sections.

Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:606

uint64_t getSectionSize(
    llvm::sampleprof::SecType Type)

Description

Get the total size of all \p Type sections.

Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:604

Parameters

llvm::sampleprof::SecType Type

virtual std::error_code readHeader()

Description

Read and validate the file header.

Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:590

std::error_code readImpl()

Description

Read sample profiles in extensible format from the associated file.

Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:601

virtual std::error_code readOneSection(
    const uint8_t* Start,
    uint64_t Size,
    llvm::sampleprof::SecType Type)

Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:592

Parameters

const uint8_t* Start
uint64_t Size
llvm::sampleprof::SecType Type

std::error_code readSecHdrTable()

Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:589

std::error_code readSecHdrTableEntry()

Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:588

virtual std::error_code verifySPMagic(
    uint64_t Magic)

Declared at: llvm/include/llvm/ProfileData/SampleProfReader.h:591

Parameters

uint64_t Magic