mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-21 03:05:26 -04:00
3fe1b12fca
Summary: This change cuts across compiler-rt and llvm, to increment the FDR log version number to 4, and include the CPU ID in the custom event records. This is a step towards allowing us to change the `llvm::xray::Trace` object to start representing both custom and typed events in the stream of records. Follow-on changes will allow us to change the kinds of records we're presenting in the stream of traces, to incorporate the data in custom/typed events. A follow-on change will handle the typed event case, where it may not fit within the 15-byte buffer for metadata records. This work is part of the larger effort to enable writing analysis and processing tools using a common in-memory representation of the events found in traces. The work will focus on porting existing tools in LLVM to use the common representation and informing the design of a library/framework for expressing trace event analysis as C++ programs. Reviewers: mboerger, eizan Subscribers: hiraditya, mgrang, llvm-commits Differential Revision: https://reviews.llvm.org/D53920 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345798 91177308-0d34-0410-b5e6-96231b3b80d8
91 lines
2.6 KiB
C++
91 lines
2.6 KiB
C++
//===- RecordPrinter.cpp - FDR Record Printer -----------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
#include "llvm/XRay/RecordPrinter.h"
|
|
|
|
#include "llvm/Support/FormatVariadic.h"
|
|
|
|
namespace llvm {
|
|
namespace xray {
|
|
|
|
Error RecordPrinter::visit(BufferExtents &R) {
|
|
OS << formatv("<Buffer: size = {0} bytes>", R.size()) << Delim;
|
|
return Error::success();
|
|
}
|
|
|
|
Error RecordPrinter::visit(WallclockRecord &R) {
|
|
OS << formatv("<Wall Time: seconds = {0}.{1,0+6}>", R.seconds(), R.nanos())
|
|
<< Delim;
|
|
return Error::success();
|
|
}
|
|
|
|
Error RecordPrinter::visit(NewCPUIDRecord &R) {
|
|
OS << formatv("<CPU: id = {0}, tsc = {1}>", R.cpuid(), R.tsc()) << Delim;
|
|
return Error::success();
|
|
}
|
|
|
|
Error RecordPrinter::visit(TSCWrapRecord &R) {
|
|
OS << formatv("<TSC Wrap: base = {0}>", R.tsc()) << Delim;
|
|
return Error::success();
|
|
}
|
|
|
|
Error RecordPrinter::visit(CustomEventRecord &R) {
|
|
OS << formatv(
|
|
"<Custom Event: tsc = {0}, cpu = {1}, size = {2}, data = '{3}'>",
|
|
R.tsc(), R.cpu(), R.size(), R.data())
|
|
<< Delim;
|
|
return Error::success();
|
|
}
|
|
|
|
Error RecordPrinter::visit(CallArgRecord &R) {
|
|
OS << formatv("<Call Argument: data = {0} (hex = {0:x})>", R.arg()) << Delim;
|
|
return Error::success();
|
|
}
|
|
|
|
Error RecordPrinter::visit(PIDRecord &R) {
|
|
OS << formatv("<PID: {0}>", R.pid()) << Delim;
|
|
return Error::success();
|
|
}
|
|
|
|
Error RecordPrinter::visit(NewBufferRecord &R) {
|
|
OS << formatv("<Thread ID: {0}>", R.tid()) << Delim;
|
|
return Error::success();
|
|
}
|
|
|
|
Error RecordPrinter::visit(EndBufferRecord &R) {
|
|
OS << "<End of Buffer>" << Delim;
|
|
return Error::success();
|
|
}
|
|
|
|
Error RecordPrinter::visit(FunctionRecord &R) {
|
|
// FIXME: Support symbolization here?
|
|
switch (R.recordType()) {
|
|
case RecordTypes::ENTER:
|
|
OS << formatv("<Function Enter: #{0} delta = +{0}>", R.functionId(),
|
|
R.delta());
|
|
break;
|
|
case RecordTypes::ENTER_ARG:
|
|
OS << formatv("<Function Enter With Arg: #{0} delta = +{0}>",
|
|
R.functionId(), R.delta());
|
|
break;
|
|
case RecordTypes::EXIT:
|
|
OS << formatv("<Function Exit: #{0} delta = +{0}>", R.functionId(),
|
|
R.delta());
|
|
break;
|
|
case RecordTypes::TAIL_EXIT:
|
|
OS << formatv("<Function Tail Exit: #{0} delta = +{0}>", R.functionId(),
|
|
R.delta());
|
|
break;
|
|
}
|
|
OS << Delim;
|
|
return Error::success();
|
|
}
|
|
|
|
} // namespace xray
|
|
} // namespace llvm
|