summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-xray
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2017-09-18 06:08:46 +0000
committerDean Michael Berris <dberris@google.com>2017-09-18 06:08:46 +0000
commit0f84a7d355bb547efb950a473fce0bc55f3b1415 (patch)
treeff4336d57cafa42b5773d6fa985f69a29f9e4b86 /llvm/tools/llvm-xray
parent7f10a34d88c5e8c9e2a3dbd13f19c1bf760736e3 (diff)
downloadbcm5719-llvm-0f84a7d355bb547efb950a473fce0bc55f3b1415.tar.gz
bcm5719-llvm-0f84a7d355bb547efb950a473fce0bc55f3b1415.zip
[XRay][tools] Support tail-call exits before we write them in the runtime
Summary: This change adds support for explicit tail-exit records to be written by the XRay runtime. This lets us differentiate the tail exit records/events in the log, and allows us to treat those exit events especially in the future. For now we allow printing those out in YAML (and reading them in). Reviewers: kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37964 llvm-svn: 313514
Diffstat (limited to 'llvm/tools/llvm-xray')
-rw-r--r--llvm/tools/llvm-xray/xray-account.cc6
-rw-r--r--llvm/tools/llvm-xray/xray-converter.cc3
-rw-r--r--llvm/tools/llvm-xray/xray-graph.cc3
-rw-r--r--llvm/tools/llvm-xray/xray-stacks.cc3
4 files changed, 12 insertions, 3 deletions
diff --git a/llvm/tools/llvm-xray/xray-account.cc b/llvm/tools/llvm-xray/xray-account.cc
index e97b4d8d1ed..74907044848 100644
--- a/llvm/tools/llvm-xray/xray-account.cc
+++ b/llvm/tools/llvm-xray/xray-account.cc
@@ -150,7 +150,8 @@ bool LatencyAccountant::accountRecord(const XRayRecord &Record) {
ThreadStack.emplace_back(Record.FuncId, Record.TSC);
break;
}
- case RecordTypes::EXIT: {
+ case RecordTypes::EXIT:
+ case RecordTypes::TAIL_EXIT: {
if (ThreadStack.empty())
return false;
@@ -419,6 +420,9 @@ template <> struct format_provider<llvm::xray::RecordTypes> {
case RecordTypes::EXIT:
Stream << "exit";
break;
+ case RecordTypes::TAIL_EXIT:
+ Stream << "tail-exit";
+ break;
}
}
};
diff --git a/llvm/tools/llvm-xray/xray-converter.cc b/llvm/tools/llvm-xray/xray-converter.cc
index 2583ec95149..4769186a19e 100644
--- a/llvm/tools/llvm-xray/xray-converter.cc
+++ b/llvm/tools/llvm-xray/xray-converter.cc
@@ -128,6 +128,9 @@ void TraceConverter::exportAsRAWv1(const Trace &Records, raw_ostream &OS) {
case RecordTypes::EXIT:
Writer.write(uint8_t{1});
break;
+ case RecordTypes::TAIL_EXIT:
+ Writer.write(uint8_t{2});
+ break;
}
Writer.write(R.FuncId);
Writer.write(R.TSC);
diff --git a/llvm/tools/llvm-xray/xray-graph.cc b/llvm/tools/llvm-xray/xray-graph.cc
index 685c24cb918..da2d04cf0b9 100644
--- a/llvm/tools/llvm-xray/xray-graph.cc
+++ b/llvm/tools/llvm-xray/xray-graph.cc
@@ -214,7 +214,8 @@ Error GraphRenderer::accountRecord(const XRayRecord &Record) {
ThreadStack.push_back({Record.FuncId, Record.TSC});
break;
}
- case RecordTypes::EXIT: {
+ case RecordTypes::EXIT:
+ case RecordTypes::TAIL_EXIT: {
// FIXME: Refactor this and the account subcommand to reduce code
// duplication
if (ThreadStack.size() == 0 || ThreadStack.back().FuncId != Record.FuncId) {
diff --git a/llvm/tools/llvm-xray/xray-stacks.cc b/llvm/tools/llvm-xray/xray-stacks.cc
index 63982634576..40dcc31cd1f 100644
--- a/llvm/tools/llvm-xray/xray-stacks.cc
+++ b/llvm/tools/llvm-xray/xray-stacks.cc
@@ -352,7 +352,8 @@ public:
}
return AccountRecordStatus::OK;
}
- case RecordTypes::EXIT: {
+ case RecordTypes::EXIT:
+ case RecordTypes::TAIL_EXIT: {
bool wasLastRecordExit = state->wasLastRecordExit;
state->wasLastRecordExit = true;
// The exit case is more interesting, since we want to be able to deduce
OpenPOWER on IntegriCloud