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) {
27 OS.write(std::get<Index>(T));
28 return sizeof(std::get<Index>(T)) + IndexedWriter<Index + 1>::write(OS, T);
35 int> = 0>
36 static size_t write(support::endian::Writer &OS, Tuple &&) {
37 return 0;
44 // we ensure this is the case when we write out the first byte of the record.
45 uint8_t FirstByte = (static_cast<uint8_t>(Kind) << 1) | uint8_t{0x01u};
47 // Write in field order.
48 OS.write(FirstByte);
49 auto Bytes = IndexedWriter<0>::write(OS, T);
50 assert(Bytes <= 15 && "Must only ever write at most 16 byte metadata!");
53 OS.write('\0');
61 // We need to re-construct a header, by writing the fields we care about for
64 (H.ConstantTSC ? 0x01 : 0x0) | (H.NonstopTSC ? 0x02 : 0x0);
66 // For endian-correctness, we need to write these fields in the order they
68 OS.write(H.Version);
69 OS.write(H.Type);
70 OS.write(BitField);
71 OS.write(H.CycleFrequency);
74 OS.write(FreeFormBytes);
100 OS.write(Bytes);
109 OS.write(Bytes);
118 OS.write(Bytes);
131 return writeMetadata<0u>(OS, R.tid());
135 return writeMetadata<1u>(OS, 0);
139 // Write out the data in "field" order, to be endian-aware.
140 uint32_t TypeRecordFuncId = uint32_t{R.functionId() & ~uint32_t{0x0Fu << 28}};
144 TypeRecordFuncId &= ~uint32_t{0x01};
145 OS.write(TypeRecordFuncId);
146 OS.write(R.delta());