Lines Matching +full:write +full:- +full:data
1 /*===- InstrProfilingWriter.c - Write instrumentation to a file or buffer -===*\
5 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 \*===----------------------------------------------------------------------===*/
42 char **Buffer = (char **)&This->WriterCtx; in lprofBufferWriter()
45 if (IOVecs[I].Data) in lprofBufferWriter()
46 memcpy(*Buffer, IOVecs[I].Data, Length); in lprofBufferWriter()
57 BufferIO->FileWriter = FileWriter; in llvmInitBufferIO()
58 BufferIO->OwnFileWriter = 0; in llvmInitBufferIO()
59 BufferIO->BufferStart = Buffer; in llvmInitBufferIO()
60 BufferIO->BufferSz = BufferSz; in llvmInitBufferIO()
61 BufferIO->CurOffset = 0; in llvmInitBufferIO()
77 if (BufferIO->OwnFileWriter) in lprofDeleteBufferIO()
78 FreeHook(BufferIO->FileWriter); in lprofDeleteBufferIO()
87 lprofBufferIOWrite(ProfBufferIO *BufferIO, const uint8_t *Data, uint32_t Size) { in lprofBufferIOWrite() argument
89 if (Size + BufferIO->CurOffset > BufferIO->BufferSz) { in lprofBufferIOWrite()
91 return -1; in lprofBufferIOWrite()
94 ProfDataIOVec IO[] = {{Data, sizeof(uint8_t), Size, 0}}; in lprofBufferIOWrite()
95 if (Size > BufferIO->BufferSz) { in lprofBufferIOWrite()
96 if (BufferIO->FileWriter->Write(BufferIO->FileWriter, IO, 1)) in lprofBufferIOWrite()
97 return -1; in lprofBufferIOWrite()
99 /* Write the data to buffer */ in lprofBufferIOWrite()
100 uint8_t *Buffer = BufferIO->BufferStart + BufferIO->CurOffset; in lprofBufferIOWrite()
104 BufferIO->CurOffset = in lprofBufferIOWrite()
105 (uint8_t *)BufferWriter.WriterCtx - BufferIO->BufferStart; in lprofBufferIOWrite()
111 if (BufferIO->CurOffset) { in lprofBufferIOFlush()
113 {BufferIO->BufferStart, sizeof(uint8_t), BufferIO->CurOffset, 0}}; in lprofBufferIOFlush()
114 if (BufferIO->FileWriter->Write(BufferIO->FileWriter, IO, 1)) in lprofBufferIOFlush()
115 return -1; in lprofBufferIOFlush()
116 BufferIO->CurOffset = 0; in lprofBufferIOFlush()
121 /* Write out value profile data for function specified with \c Data.
124 * value profile data is written out to \c BufferIO piecemeal.
128 const __llvm_profile_data *Data) { in writeOneValueProfData() argument
134 if (!Data->NumValueSites[I]) in writeOneValueProfData()
138 VPDataReader->GetValueProfRecordHeaderSize(Data->NumValueSites[I]) - in writeOneValueProfData()
147 /* If NumValueKinds returned is 0, there is nothing to write, report in writeOneValueProfData()
149 if (!(NumValueKinds = VPDataReader->InitRTRecord(Data, SiteCountArray))) in writeOneValueProfData()
152 /* First write the header structure. */ in writeOneValueProfData()
153 VPHeader.TotalSize = VPDataReader->GetValueProfDataSize(); in writeOneValueProfData()
157 return -1; in writeOneValueProfData()
161 if ((void *)VPDataReader->GetFirstValueProfRecord(&VPHeader) != in writeOneValueProfData()
163 return -1; in writeOneValueProfData()
165 /* Write out the value profile record for each value kind in writeOneValueProfData()
175 if (!Data->NumValueSites[I]) in writeOneValueProfData()
178 /* Write out the record header. */ in writeOneValueProfData()
180 RecordHeader.NumValueSites = Data->NumValueSites[I]; in writeOneValueProfData()
183 return -1; in writeOneValueProfData()
185 /* Write out the site value count array including padding space. */ in writeOneValueProfData()
187 VPDataReader->GetValueProfRecordHeaderSize(Data->NumValueSites[I]) - in writeOneValueProfData()
190 return -1; in writeOneValueProfData()
192 /* Write out the value profile data for each value site. */ in writeOneValueProfData()
193 for (J = 0; J < Data->NumValueSites[I]; J++) { in writeOneValueProfData()
196 NRemain = VPDataReader->GetNumValueDataForSite(I, J); in writeOneValueProfData()
199 /* Read and write out value data in small chunks till it is done. */ in writeOneValueProfData()
203 VPDataReader->GetValueData(I, /* ValueKind */ in writeOneValueProfData()
208 return -1; in writeOneValueProfData()
209 NRemain -= NRead; in writeOneValueProfData()
231 return -1; in writeValueProfData()
235 return -1; in writeValueProfData()
303 &PaddingBytesAfterVNames) == -1) in lprofWriteDataImpl()
304 return -1; in lprofWriteDataImpl()
312 /* On WIN64, label differences are truncated 32-bit values. Truncate in lprofWriteDataImpl()
319 /* The data and names sections are omitted in lightweight mode. */ in lprofWriteDataImpl()
325 /* Write the profile header. */ in lprofWriteDataImpl()
327 if (Writer->Write(Writer, IOVec, sizeof(IOVec) / sizeof(*IOVec))) in lprofWriteDataImpl()
328 return -1; in lprofWriteDataImpl()
330 /* Write the binary id lengths and data. */ in lprofWriteDataImpl()
331 if (__llvm_write_binary_ids(Writer) == -1) in lprofWriteDataImpl()
332 return -1; in lprofWriteDataImpl()
334 /* Write the profile data. */ in lprofWriteDataImpl()
348 if (Writer->Write(Writer, IOVecData, sizeof(IOVecData) / sizeof(*IOVecData))) in lprofWriteDataImpl()
349 return -1; in lprofWriteDataImpl()
361 * Write binary id length and then its data, because binary id does not
373 if (Writer->Write(Writer, BinaryIdIOVec, in lprofWriteOneBinaryId()
375 return -1; in lprofWriteOneBinaryId()