//===- RecordPrinter.cpp - FDR Record Printer -----------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "llvm/XRay/RecordPrinter.h" #include "llvm/Support/FormatVariadic.h" namespace llvm { namespace xray { Error RecordPrinter::visit(BufferExtents &R) { OS << formatv("", R.size()) << Delim; return Error::success(); } Error RecordPrinter::visit(WallclockRecord &R) { OS << formatv("", R.seconds(), R.nanos()) << Delim; return Error::success(); } Error RecordPrinter::visit(NewCPUIDRecord &R) { OS << formatv("", R.cpuid(), R.tsc()) << Delim; return Error::success(); } Error RecordPrinter::visit(TSCWrapRecord &R) { OS << formatv("", R.tsc()) << Delim; return Error::success(); } Error RecordPrinter::visit(CustomEventRecord &R) { OS << formatv( "", R.tsc(), R.cpu(), R.size(), R.data()) << Delim; return Error::success(); } Error RecordPrinter::visit(CustomEventRecordV5 &R) { OS << formatv("", R.delta(), R.size(), R.data()) << Delim; return Error::success(); } Error RecordPrinter::visit(TypedEventRecord &R) { OS << formatv( "", R.arg()) << Delim; return Error::success(); } Error RecordPrinter::visit(PIDRecord &R) { OS << formatv("", R.pid()) << Delim; return Error::success(); } Error RecordPrinter::visit(NewBufferRecord &R) { OS << formatv("", R.tid()) << Delim; return Error::success(); } Error RecordPrinter::visit(EndBufferRecord &R) { OS << "" << Delim; return Error::success(); } Error RecordPrinter::visit(FunctionRecord &R) { // FIXME: Support symbolization here? switch (R.recordType()) { case RecordTypes::ENTER: OS << formatv("", R.functionId(), R.delta()); break; case RecordTypes::ENTER_ARG: OS << formatv("", R.functionId(), R.delta()); break; case RecordTypes::EXIT: OS << formatv("", R.functionId(), R.delta()); break; case RecordTypes::TAIL_EXIT: OS << formatv("", R.functionId(), R.delta()); break; case RecordTypes::CUSTOM_EVENT: case RecordTypes::TYPED_EVENT: // TODO: Flag as a bug? break; } OS << Delim; return Error::success(); } } // namespace xray } // namespace llvm