1 // Copyright 2016 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "perf_test_files.h"
6
7 namespace perf_test_files {
8
GetPerfDataFiles()9 const std::vector<const char*>& GetPerfDataFiles() {
10 static const std::vector<const char*>* files = new std::vector<const char*>{
11 // The following perf data contains the following event types, as passed
12 // to perf record via the -e option:
13 // - cycles
14 // - instructions
15 // - cache-references
16 // - cache-misses
17 // - branches
18 // - branch-misses
19
20 // Obtained with "perf record -- echo > /dev/null"
21 "perf.data.singleprocess-3.4",
22
23 // Obtained with "perf record -a -- sleep $N", for N in {0, 1, 5}.
24 "perf.data.systemwide.0-3.4",
25 #ifdef TEST_LARGE_PERF_DATA
26 "perf.data.systemwide.1-3.4",
27 "perf.data.systemwide.5-3.4",
28
29 // Obtained with "perf record -a -- sleep $N", for N in {0, 1, 5}.
30 // While in the background, this loop is running:
31 // while true; do ls > /dev/null; done
32 "perf.data.busy.0-3.4",
33 "perf.data.busy.1-3.4",
34 "perf.data.busy.5-3.4",
35 #endif // defined(TEST_LARGE_PERF_DATA)
36
37 // Obtained with "perf record -a -- sleep 2"
38 // While in the background, this loop is running:
39 // while true; do restart powerd; sleep .2; done
40 "perf.data.forkexit-3.4",
41
42 #ifdef TEST_CALLGRAPH
43 // Obtained with "perf record -a -g -- sleep 2"
44 "perf.data.callgraph-3.4",
45 #endif
46 // Obtained with "perf record -a -b -- sleep 2"
47 "perf.data.branch-3.4",
48 #ifdef TEST_CALLGRAPH
49 // Obtained with "perf record -a -g -b -- sleep 2"
50 "perf.data.callgraph_and_branch-3.4",
51 #endif
52
53 // Obtained with "perf record -a -R -- sleep 2"
54 "perf.data.raw-3.4",
55 #ifdef TEST_CALLGRAPH
56 // Obtained with "perf record -a -R -g -b -- sleep 2"
57 "perf.data.raw_callgraph_branch-3.4",
58 #endif
59
60 // Data from other architectures.
61 "perf.data.i686-3.4", // 32-bit x86
62 "perf.data.armv7-3.4", // ARM v7
63
64 // Same as above, obtained from a system running kernel v3.8.
65 "perf.data.singleprocess-3.8",
66 "perf.data.systemwide.0-3.8",
67 #ifdef TEST_LARGE_PERF_DATA
68 "perf.data.systemwide.1-3.8",
69 "perf.data.systemwide.5-3.8",
70 "perf.data.busy.0-3.8",
71 "perf.data.busy.1-3.8",
72 "perf.data.busy.5-3.8",
73 #endif // defined(TEST_LARGE_PERF_DATA)
74
75 "perf.data.forkexit-3.8",
76 #ifdef TEST_CALLGRAPH
77 "perf.data.callgraph-3.8",
78 #endif
79 "perf.data.branch-3.8",
80 #ifdef TEST_CALLGRAPH
81 "perf.data.callgraph_and_branch-3.8",
82 #endif
83 "perf.data.armv7.perf_3.14-3.8", // ARM v7 obtained using perf 3.14.
84
85 // Obtained from a system that uses NUMA topology.
86 "perf.data.numatopology-3.2",
87
88 // Obtained to test GROUP_DESC feature
89 "perf.data.group_desc-4.4",
90
91 // Perf data that contains hardware and software events.
92 // Command:
93 // perf record -a -c 1000000 -e cycles,branch-misses,cpu-clock -- \
94 // sleep 2
95 // HW events are cycles and branch-misses, SW event is cpu-clock.
96 // This also tests non-consecutive event types.
97 "perf.data.hw_and_sw-3.4",
98
99 // This test first mmap()s a DSO, then fork()s to copy the mapping to the
100 // child and then modifies the mapping by mmap()ing a DSO on top of the
101 // old one. It then records SAMPLEs events in the child. It ensures the
102 // SAMPLEs in the child are attributed to the first DSO that was mmap()ed,
103 // not the second one.
104 "perf.data.remmap-3.2",
105
106 // This is sample with a frequency higher than the max frequency, so it
107 // has throttle and unthrottle events.
108 "perf.data.throttle-3.8",
109
110 // Perf data that contains intel pt events from perf-4.14
111 // Command:
112 // perf record -e intel_pt// -e cycles -o /tmp/perf.data.intel_pt-4.14
113 // -- echo "Hello, World!"
114 "perf.data.intel_pt-4.14",
115 };
116 return *files;
117 }
118
GetPerfPipedDataFiles()119 const std::vector<const char*>& GetPerfPipedDataFiles() {
120 static const std::vector<const char*>* files = new std::vector<const char*>{
121 "perf.data.piped.target-3.4",
122 "perf.data.piped.target.throttled-3.4",
123 "perf.data.piped.target-3.8",
124
125 /* Piped data that contains hardware and software events.
126 * Command:
127 * perf record -a -c 1000000 -e cycles,branch-misses,cpu-clock -o - \
128 * -- sleep 2
129 * HW events are cycles and branch-misses, SW event is cpu-clock.
130 */
131 "perf.data.piped.hw_and_sw-3.4",
132
133 // Piped data with extra data at end.
134 "perf.data.piped.extrabyte-3.4",
135 "perf.data.piped.extradata-3.4",
136
137 // Perf data that contains intel pt events collected in piped mode from
138 // perf-4.14
139 // Command:
140 // perf record -e intel_pt// -e cycles -o - -- echo "Hello, World!" | \
141 // cat &> /tmp/perf.data.piped.intel_pt-4.14
142 "perf.data.piped.intel_pt-4.14",
143 };
144 return *files;
145 }
146
GetCorruptedPerfPipedDataFiles()147 const std::vector<const char*>& GetCorruptedPerfPipedDataFiles() {
148 static const std::vector<const char*>* files = new std::vector<const char*>{
149 // Has a SAMPLE event with size set to zero. Don't go into an infinite
150 // loop.
151 "perf.data.piped.corrupted.zero_size_sample-3.2",
152 };
153 return *files;
154 }
155
GetPerfDataProtoFiles()156 const std::vector<const char*>& GetPerfDataProtoFiles() {
157 static const std::vector<const char*>* files = new std::vector<const char*>{
158 "perf.callgraph.pb_text",
159 };
160 return *files;
161 }
162
163 } // namespace perf_test_files
164