summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-xray
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2017-01-10 02:38:11 +0000
committerDean Michael Berris <dberris@google.com>2017-01-10 02:38:11 +0000
commitf8f909f848e7373dfa9dfcb99336bffb023aaa07 (patch)
treebdac41cbc9fdae039ae6d0e641941ca01ea3b387 /llvm/test/tools/llvm-xray
parentf388f78bc6664bde093d5f30c59a5148e14d9523 (diff)
downloadbcm5719-llvm-f8f909f848e7373dfa9dfcb99336bffb023aaa07.tar.gz
bcm5719-llvm-f8f909f848e7373dfa9dfcb99336bffb023aaa07.zip
[XRay] Implement `llvm-xray convert` -- trace file conversion
This is the second part of a multi-part change to define additional subcommands to the `llvm-xray` tool. This change defines a conversion subcommand to take XRay log files, and turns them from one format to another (binary or YAML). This currently only supports the first version of the log file format, defined in the compiler-rt runtime. Depends on D21987. Reviewers: dblaikie, echristo Subscribers: mehdi_amini, dberris, beanz, llvm-commits Differential Revision: https://reviews.llvm.org/D24376 llvm-svn: 291529
Diffstat (limited to 'llvm/test/tools/llvm-xray')
-rwxr-xr-xllvm/test/tools/llvm-xray/X86/Inputs/elf64-objcopied-instrmap.binbin0 -> 144070 bytes
-rwxr-xr-xllvm/test/tools/llvm-xray/X86/Inputs/elf64-sample-o2.binbin0 -> 478375 bytes
-rw-r--r--llvm/test/tools/llvm-xray/X86/Inputs/naive-log-simple.xraybin0 -> 224 bytes
-rw-r--r--llvm/test/tools/llvm-xray/X86/Inputs/simple-xray-instrmap.yaml14
-rw-r--r--llvm/test/tools/llvm-xray/X86/bad-instrmap-sizes.txt (renamed from llvm/test/tools/llvm-xray/X86/bad-instrmap-sizes.bin)0
-rw-r--r--llvm/test/tools/llvm-xray/X86/convert-roundtrip.yaml28
-rw-r--r--llvm/test/tools/llvm-xray/X86/convert-to-yaml.txt23
-rw-r--r--llvm/test/tools/llvm-xray/X86/convert-with-debug-syms.txt23
-rw-r--r--llvm/test/tools/llvm-xray/X86/convert-with-standalone-instrmap.txt23
-rw-r--r--llvm/test/tools/llvm-xray/X86/convert-with-yaml-instrmap.txt23
10 files changed, 134 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-xray/X86/Inputs/elf64-objcopied-instrmap.bin b/llvm/test/tools/llvm-xray/X86/Inputs/elf64-objcopied-instrmap.bin
new file mode 100755
index 00000000000..4e1f982e267
--- /dev/null
+++ b/llvm/test/tools/llvm-xray/X86/Inputs/elf64-objcopied-instrmap.bin
Binary files differ
diff --git a/llvm/test/tools/llvm-xray/X86/Inputs/elf64-sample-o2.bin b/llvm/test/tools/llvm-xray/X86/Inputs/elf64-sample-o2.bin
new file mode 100755
index 00000000000..fe31f9514d3
--- /dev/null
+++ b/llvm/test/tools/llvm-xray/X86/Inputs/elf64-sample-o2.bin
Binary files differ
diff --git a/llvm/test/tools/llvm-xray/X86/Inputs/naive-log-simple.xray b/llvm/test/tools/llvm-xray/X86/Inputs/naive-log-simple.xray
new file mode 100644
index 00000000000..284bc6b63e9
--- /dev/null
+++ b/llvm/test/tools/llvm-xray/X86/Inputs/naive-log-simple.xray
Binary files differ
diff --git a/llvm/test/tools/llvm-xray/X86/Inputs/simple-xray-instrmap.yaml b/llvm/test/tools/llvm-xray/X86/Inputs/simple-xray-instrmap.yaml
new file mode 100644
index 00000000000..483d3e4f2c8
--- /dev/null
+++ b/llvm/test/tools/llvm-xray/X86/Inputs/simple-xray-instrmap.yaml
@@ -0,0 +1,14 @@
+---
+- { id: 1, address: 0x000000000041CA40, function: 0x000000000041CA40, kind: function-enter,
+ always-instrument: true }
+- { id: 1, address: 0x000000000041CA50, function: 0x000000000041CA40, kind: tail-exit,
+ always-instrument: true }
+- { id: 2, address: 0x000000000041CA70, function: 0x000000000041CA70, kind: function-enter,
+ always-instrument: true }
+- { id: 2, address: 0x000000000041CA7C, function: 0x000000000041CA70, kind: tail-exit,
+ always-instrument: true }
+- { id: 3, address: 0x000000000041CAA0, function: 0x000000000041CAA0, kind: function-enter,
+ always-instrument: true }
+- { id: 3, address: 0x000000000041CAB4, function: 0x000000000041CAA0, kind: function-exit,
+ always-instrument: true }
+...
diff --git a/llvm/test/tools/llvm-xray/X86/bad-instrmap-sizes.bin b/llvm/test/tools/llvm-xray/X86/bad-instrmap-sizes.txt
index 4ea33510e5d..4ea33510e5d 100644
--- a/llvm/test/tools/llvm-xray/X86/bad-instrmap-sizes.bin
+++ b/llvm/test/tools/llvm-xray/X86/bad-instrmap-sizes.txt
diff --git a/llvm/test/tools/llvm-xray/X86/convert-roundtrip.yaml b/llvm/test/tools/llvm-xray/X86/convert-roundtrip.yaml
new file mode 100644
index 00000000000..5eca93a2d39
--- /dev/null
+++ b/llvm/test/tools/llvm-xray/X86/convert-roundtrip.yaml
@@ -0,0 +1,28 @@
+#RUN: llvm-xray convert %s -i=yaml -f=raw -o %t && llvm-xray convert %t -f=yaml -o - | FileCheck %s
+---
+header:
+ version: 1
+ type: 0
+ constant-tsc: true
+ nonstop-tsc: true
+ cycle-frequency: 2601000000
+records:
+ - { type: 0, func-id: 1, cpu: 1, thread: 111, kind: function-enter,
+ tsc: 10001 }
+ - { type: 0, func-id: 1, cpu: 1, thread: 111, kind: function-exit,
+ tsc: 10100 }
+...
+
+#CHECK: ---
+#CHECK-NEXT: header:
+#CHECK-NEXT: version: 1
+#CHECK-NEXT: type: 0
+#CHECK-NEXT: constant-tsc: true
+#CHECK-NEXT: nonstop-tsc: true
+#CHECK-NEXT: cycle-frequency: 2601000000
+#CHECK-NEXT: records:
+#CHECK-NEXT: - { type: 0, func-id: 1, function: '1', cpu: 1, thread: 111, kind: function-enter,
+#CHECK-NEXT: tsc: 10001 }
+#CHECK-NEXT: - { type: 0, func-id: 1, function: '1', cpu: 1, thread: 111, kind: function-exit,
+#CHECK-NEXT: tsc: 10100 }
+#CHECK-NEXT: ...
diff --git a/llvm/test/tools/llvm-xray/X86/convert-to-yaml.txt b/llvm/test/tools/llvm-xray/X86/convert-to-yaml.txt
new file mode 100644
index 00000000000..c402bc18d83
--- /dev/null
+++ b/llvm/test/tools/llvm-xray/X86/convert-to-yaml.txt
@@ -0,0 +1,23 @@
+; RUN: llvm-xray convert %S/Inputs/naive-log-simple.xray -f=yaml -o - | FileCheck %s
+
+; CHECK: ---
+; CHECK-NEXT: header:
+; CHECK-NEXT: version: 1
+; CHECK-NEXT: type: 0
+; CHECK-NEXT: constant-tsc: true
+; CHECK-NEXT: nonstop-tsc: true
+; CHECK-NEXT: cycle-frequency: 2601000000
+; CHECK-NEXT: records:
+; CHECK-NEXT: - { type: 0, func-id: 3, function: '3', cpu: 37, thread: 84697, kind: function-enter,
+; CHECK-NEXT: tsc: 3315356841453914 }
+; CHECK-NEXT: - { type: 0, func-id: 2, function: '2', cpu: 37, thread: 84697, kind: function-enter,
+; CHECK-NEXT: tsc: 3315356841454542 }
+; CHECK-NEXT: - { type: 0, func-id: 2, function: '2', cpu: 37, thread: 84697, kind: function-exit,
+; CHECK-NEXT: tsc: 3315356841454670 }
+; CHECK-NEXT: - { type: 0, func-id: 1, function: '1', cpu: 37, thread: 84697, kind: function-enter,
+; CHECK-NEXT: tsc: 3315356841454762 }
+; CHECK-NEXT: - { type: 0, func-id: 1, function: '1', cpu: 37, thread: 84697, kind: function-exit,
+; CHECK-NEXT: tsc: 3315356841454802 }
+; CHECK-NEXT: - { type: 0, func-id: 3, function: '3', cpu: 37, thread: 84697, kind: function-exit,
+; CHECK-NEXT: tsc: 3315356841494828 }
+; CHECK-NEXT: ...
diff --git a/llvm/test/tools/llvm-xray/X86/convert-with-debug-syms.txt b/llvm/test/tools/llvm-xray/X86/convert-with-debug-syms.txt
new file mode 100644
index 00000000000..d7e892bedaa
--- /dev/null
+++ b/llvm/test/tools/llvm-xray/X86/convert-with-debug-syms.txt
@@ -0,0 +1,23 @@
+; RUN: llvm-xray convert -m %S/Inputs/elf64-sample-o2.bin -y %S/Inputs/naive-log-simple.xray -f=yaml -o - 2>&1 | FileCheck %s
+
+; CHECK: ---
+; CHECK-NEXT: header:
+; CHECK-NEXT: version: 1
+; CHECK-NEXT: type: 0
+; CHECK-NEXT: constant-tsc: true
+; CHECK-NEXT: nonstop-tsc: true
+; CHECK-NEXT: cycle-frequency: 2601000000
+; CHECK-NEXT: records:
+; CHECK-NEXT: - { type: 0, func-id: 3, function: main, cpu: 37, thread: 84697, kind: function-enter,
+; CHECK-NEXT: tsc: 3315356841453914 }
+; CHECK-NEXT: - { type: 0, func-id: 2, function: 'foo()', cpu: 37, thread: 84697, kind: function-enter,
+; CHECK-NEXT: tsc: 3315356841454542 }
+; CHECK-NEXT: - { type: 0, func-id: 2, function: 'foo()', cpu: 37, thread: 84697, kind: function-exit,
+; CHECK-NEXT: tsc: 3315356841454670 }
+; CHECK-NEXT: - { type: 0, func-id: 1, function: 'bar()', cpu: 37, thread: 84697, kind: function-enter,
+; CHECK-NEXT: tsc: 3315356841454762 }
+; CHECK-NEXT: - { type: 0, func-id: 1, function: 'bar()', cpu: 37, thread: 84697, kind: function-exit,
+; CHECK-NEXT: tsc: 3315356841454802 }
+; CHECK-NEXT: - { type: 0, func-id: 3, function: main, cpu: 37, thread: 84697, kind: function-exit,
+; CHECK-NEXT: tsc: 3315356841494828 }
+; CHECK-NEXT: ...
diff --git a/llvm/test/tools/llvm-xray/X86/convert-with-standalone-instrmap.txt b/llvm/test/tools/llvm-xray/X86/convert-with-standalone-instrmap.txt
new file mode 100644
index 00000000000..71c17280df4
--- /dev/null
+++ b/llvm/test/tools/llvm-xray/X86/convert-with-standalone-instrmap.txt
@@ -0,0 +1,23 @@
+; RUN: llvm-xray convert -m %S/Inputs/elf64-objcopied-instrmap.bin -y %S/Inputs/naive-log-simple.xray -f=yaml -o - 2>&1 | FileCheck %s
+
+; CHECK: ---
+; CHECK-NEXT: header:
+; CHECK-NEXT: version: 1
+; CHECK-NEXT: type: 0
+; CHECK-NEXT: constant-tsc: true
+; CHECK-NEXT: nonstop-tsc: true
+; CHECK-NEXT: cycle-frequency: 2601000000
+; CHECK-NEXT: records:
+; CHECK-NEXT: - { type: 0, func-id: 3, function: '@(41caa0)', cpu: 37, thread: 84697,
+; CHECK-NEXT: kind: function-enter, tsc: 3315356841453914 }
+; CHECK-NEXT: - { type: 0, func-id: 2, function: '@(41ca70)', cpu: 37, thread: 84697,
+; CHECK-NEXT: kind: function-enter, tsc: 3315356841454542 }
+; CHECK-NEXT: - { type: 0, func-id: 2, function: '@(41ca70)', cpu: 37, thread: 84697,
+; CHECK-NEXT: kind: function-exit, tsc: 3315356841454670 }
+; CHECK-NEXT: - { type: 0, func-id: 1, function: '@(41ca40)', cpu: 37, thread: 84697,
+; CHECK-NEXT: kind: function-enter, tsc: 3315356841454762 }
+; CHECK-NEXT: - { type: 0, func-id: 1, function: '@(41ca40)', cpu: 37, thread: 84697,
+; CHECK-NEXT: kind: function-exit, tsc: 3315356841454802 }
+; CHECK-NEXT: - { type: 0, func-id: 3, function: '@(41caa0)', cpu: 37, thread: 84697,
+; CHECK-NEXT: kind: function-exit, tsc: 3315356841494828 }
+; CHECK-NEXT: ...
diff --git a/llvm/test/tools/llvm-xray/X86/convert-with-yaml-instrmap.txt b/llvm/test/tools/llvm-xray/X86/convert-with-yaml-instrmap.txt
new file mode 100644
index 00000000000..01191c9c2a3
--- /dev/null
+++ b/llvm/test/tools/llvm-xray/X86/convert-with-yaml-instrmap.txt
@@ -0,0 +1,23 @@
+; RUN: llvm-xray convert -m %S/Inputs/simple-xray-instrmap.yaml -t yaml %S/Inputs/naive-log-simple.xray -f=yaml -o - | FileCheck %s
+
+; CHECK: ---
+; CHECK-NEXT: header:
+; CHECK-NEXT: version: 1
+; CHECK-NEXT: type: 0
+; CHECK-NEXT: constant-tsc: true
+; CHECK-NEXT: nonstop-tsc: true
+; CHECK-NEXT: cycle-frequency: 2601000000
+; CHECK-NEXT: records:
+; CHECK-NEXT: - { type: 0, func-id: 3, function: '3', cpu: 37, thread: 84697, kind: function-enter,
+; CHECK-NEXT: tsc: 3315356841453914 }
+; CHECK-NEXT: - { type: 0, func-id: 2, function: '2', cpu: 37, thread: 84697, kind: function-enter,
+; CHECK-NEXT: tsc: 3315356841454542 }
+; CHECK-NEXT: - { type: 0, func-id: 2, function: '2', cpu: 37, thread: 84697, kind: function-exit,
+; CHECK-NEXT: tsc: 3315356841454670 }
+; CHECK-NEXT: - { type: 0, func-id: 1, function: '1', cpu: 37, thread: 84697, kind: function-enter,
+; CHECK-NEXT: tsc: 3315356841454762 }
+; CHECK-NEXT: - { type: 0, func-id: 1, function: '1', cpu: 37, thread: 84697, kind: function-exit,
+; CHECK-NEXT: tsc: 3315356841454802 }
+; CHECK-NEXT: - { type: 0, func-id: 3, function: '3', cpu: 37, thread: 84697, kind: function-exit,
+; CHECK-NEXT: tsc: 3315356841494828 }
+; CHECK-NEXT: ...
OpenPOWER on IntegriCloud