Lines Matching +full:write +full:- +full:0

1 //===- FDRTraceWriter.cpp - XRay FDR Trace Writer ---------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Test a utility that can write out XRay FDR Mode formatted trace files.
11 //===----------------------------------------------------------------------===//
25 int> = 0>
26 static size_t write(support::endian::Writer &OS, Tuple &&T) { in write() function
27 OS.write(std::get<Index>(T)); in write()
28 return sizeof(std::get<Index>(T)) + IndexedWriter<Index + 1>::write(OS, T); in write()
35 int> = 0>
36 static size_t write(support::endian::Writer &OS, Tuple &&) { in write() function
37 return 0; in write()
44 // we ensure this is the case when we write out the first byte of the record. in writeMetadata()
45 uint8_t FirstByte = (static_cast<uint8_t>(Kind) << 1) | uint8_t{0x01u}; in writeMetadata()
47 // Write in field order. in writeMetadata()
48 OS.write(FirstByte); in writeMetadata()
49 auto Bytes = IndexedWriter<0>::write(OS, T); in writeMetadata()
50 assert(Bytes <= 15 && "Must only ever write at most 16 byte metadata!"); in writeMetadata()
53 OS.write('\0'); in writeMetadata()
61 // We need to re-construct a header, by writing the fields we care about for in FDRTraceWriter()
64 (H.ConstantTSC ? 0x01 : 0x0) | (H.NonstopTSC ? 0x02 : 0x0); in FDRTraceWriter()
66 // For endian-correctness, we need to write these fields in the order they in FDRTraceWriter()
68 OS.write(H.Version); in FDRTraceWriter()
69 OS.write(H.Type); in FDRTraceWriter()
70 OS.write(BitField); in FDRTraceWriter()
71 OS.write(H.CycleFrequency); in FDRTraceWriter()
74 OS.write(FreeFormBytes); in FDRTraceWriter()
100 OS.write(Bytes); in visit()
109 OS.write(Bytes); in visit()
118 OS.write(Bytes); in visit()
131 return writeMetadata<0u>(OS, R.tid()); in visit()
135 return writeMetadata<1u>(OS, 0); in visit()
139 // Write out the data in "field" order, to be endian-aware. in visit()
140 uint32_t TypeRecordFuncId = uint32_t{R.functionId() & ~uint32_t{0x0Fu << 28}}; in visit()
144 TypeRecordFuncId &= ~uint32_t{0x01}; in visit()
145 OS.write(TypeRecordFuncId); in visit()
146 OS.write(R.delta()); in visit()