Lines Matching +full:needs +full:- +full:double +full:- +full:reset
1 //===- SampleProfWriter.cpp - Write LLVM sample profile data --------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
18 //===----------------------------------------------------------------------===//
41 #define DEBUG_TYPE "llvm-profdata"
79 double D = (double)OutputSizeLimit / CurrentOutputSize; in Erase()
81 size_t NumToRemove = ProfileMap.size() - NewSize; in Erase()
87 llvm::drop_begin(SortedFunctions, SortedFunctions.size() - NumToRemove)) in Erase()
89 SortedFunctions.resize(SortedFunctions.size() - NumToRemove); in Erase()
109 OutputStream.reset(new raw_svector_ostream(StringBuffer)); in writeWithSizeLimitInternal()
124 Strategy->Erase(TotalSize); in writeWithSizeLimitInternal()
132 OutputStream->write(StringBuffer.data(), StringBuffer.size()); in writeWithSizeLimitInternal()
169 uint64_t SectionStart = OutputStream->tell(); in markSectionStart()
183 static_cast<raw_string_ostream *>(LocalBufStream.get())->str(); in compressAndOutput()
211 SecHdrTable.push_back({Type, Entry.Flags, SectionStart - FileStart, in addNewSection()
212 OutputStream->tell() - SectionStart, LayoutIdx}); in addNewSection()
251 encodeULEB128(Ret->second, *OutputStream); in writeCSNameIdx()
257 uint64_t Offset = OutputStream->tell(); in writeSample()
259 FuncOffsetTable[Context] = Offset - SecLBRProfileStart; in writeSample()
281 // can help profile-guided importing for ThinLTO. in writeFuncOffsetTable()
417 if (ProfSymList && ProfSymList->size() > 0) in writeProfileSymbolListSection()
418 if (std::error_code EC = ProfSymList->write(*OutputStream)) in writeProfileSymbolListSection()
427 if (Type == SecProfileSymbolList && ProfSymList && ProfSymList->toCompress()) in writeOneSection()
457 SecLBRProfileStart = OutputStream->tell(); in writeOneSection()
530 // Mark the section to have no context. Note section flag needs to be set in writeCtxSplitLayout()
535 // Mark the section to have no context. Note section flag needs to be set in writeCtxSplitLayout()
567 /// it needs to be parsed by the SampleProfileReaderText class.
582 LineLocation Loc = I->first; in writeSample()
583 const SampleRecord &Sample = I->second; in writeSample()
602 for (const auto &FS : I->second) { in writeSample()
603 LineLocation Loc = I->first; in writeSample()
613 Indent -= 1; in writeSample()
641 encodeULEB128(Ret->second, *OutputStream); in writeNameIdx()
750 SecHdrTableOffset = OutputStream->tell(); in allocSecHdrTable()
752 Writer.write(static_cast<uint64_t>(-1)); in allocSecHdrTable()
753 Writer.write(static_cast<uint64_t>(-1)); in allocSecHdrTable()
754 Writer.write(static_cast<uint64_t>(-1)); in allocSecHdrTable()
755 Writer.write(static_cast<uint64_t>(-1)); in allocSecHdrTable()
762 SmallVector<uint32_t, 16> IndexMap(SecHdrTable.size(), -1); in writeSecHdrTable()
773 // needs to be computed after SecLBRProfile (the order in SecHdrTable), in writeSecHdrTable()
774 // but it needs to be read before SecLBRProfile (the order in in writeSecHdrTable()
809 encodeULEB128(Summary->getTotalCount(), OS); in writeSummary()
810 encodeULEB128(Summary->getMaxCount(), OS); in writeSummary()
811 encodeULEB128(Summary->getMaxFunctionCount(), OS); in writeSummary()
812 encodeULEB128(Summary->getNumCounts(), OS); in writeSummary()
813 encodeULEB128(Summary->getNumFunctions(), OS); in writeSummary()
814 ArrayRef<ProfileSummaryEntry> Entries = Summary->getDetailedSummary(); in writeSummary()
866 /// Write samples of a top-level function to a binary file.
887 OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::OF_None)); in create()
889 OS.reset(new raw_fd_ostream(Filename, EC, sys::fs::OF_TextWithCRLF)); in create()
915 Writer.reset(new SampleProfileWriterRawBinary(OS)); in create()
917 Writer.reset(new SampleProfileWriterExtBinary(OS)); in create()
919 Writer.reset(new SampleProfileWriterText(OS)); in create()
928 Writer->Format = Format; in create()