1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 #include "spe_decoder_test.h"
16
17 #include "command.h"
18 #include "perf_events.h"
19 #include "subcommand_dump.h"
20 #include "subcommand_record.h"
21 #include "test_utilities.h"
22
23 using namespace testing::ext;
24 namespace OHOS {
25 namespace Developtools {
26 namespace HiPerf {
27
28 class SpeDecoderTest : public testing::Test {
29 public:
30 static void SetUpTestCase(void);
31 static void TearDownTestCase(void);
32 void SetUp();
33 void TearDown();
34 };
35
SetUpTestCase()36 void SpeDecoderTest::SetUpTestCase() {}
37
TearDownTestCase()38 void SpeDecoderTest::TearDownTestCase() {}
39
SetUp()40 void SpeDecoderTest::SetUp()
41 {
42 SubCommand::ClearSubCommands(); // clear the subCommands left from other UT
43 ASSERT_EQ(SubCommand::GetSubCommands().size(), 0u);
44 SubCommand::RegisterSubCommand("record", std::make_unique<SubCommandRecord>());
45 SubCommand::RegisterSubCommand("dump", std::make_unique<SubCommandDump>());
46 ASSERT_EQ(SubCommand::GetSubCommands().size(), 2u); // 2u: 2 size
47 }
48
TearDown()49 void SpeDecoderTest::TearDown()
50 {
51 ASSERT_EQ(SubCommand::GetSubCommands().size(), 2u); // 2u: 2 size
52 SubCommand::ClearSubCommands();
53 ASSERT_EQ(SubCommand::GetSubCommands().size(), 0u);
54 MemoryHold::Get().Clean();
55 }
56
57 /**
58 * @tc.name: TestGetSpeEventNameByType
59 * @tc.desc:
60 * @tc.type: FUNC
61 */
62 HWTEST_F(SpeDecoderTest, TestGetSpeEventNameByType, TestSize.Level1)
63 {
64 std::string eventName = "";
65 GetSpeEventNameByType(PERF_SPE_L1D_ACCESS, eventName);
66 ASSERT_EQ(eventName, "l1d-access");
67 GetSpeEventNameByType(PERF_SPE_L1D_MISS, eventName);
68 ASSERT_EQ(eventName, "l1d-miss");
69 GetSpeEventNameByType(PERF_SPE_LLC_ACCESS, eventName);
70 ASSERT_EQ(eventName, "llc-access");
71 GetSpeEventNameByType(PERF_SPE_LLC_MISS, eventName);
72 ASSERT_EQ(eventName, "llc-miss");
73 GetSpeEventNameByType(PERF_SPE_TLB_ACCESS, eventName);
74 ASSERT_EQ(eventName, "tlb-access");
75 GetSpeEventNameByType(PERF_SPE_TLB_MISS, eventName);
76 ASSERT_EQ(eventName, "tlb-miss");
77 GetSpeEventNameByType(PERF_SPE_BRANCH_MISS, eventName);
78 ASSERT_EQ(eventName, "branch-miss");
79 GetSpeEventNameByType(PERF_SPE_REMOTE_ACCESS, eventName);
80 ASSERT_EQ(eventName, "remote-access");
81 GetSpeEventNameByType(PERF_SPE_SVE_PARTIAL_PRED, eventName);
82 ASSERT_EQ(eventName, "paritial_read");
83 GetSpeEventNameByType(PERF_SPE_SVE_EMPTY_PRED, eventName);
84 ASSERT_EQ(eventName, "empty_read");
85 GetSpeEventNameByType(1 << 10, eventName); // 10: displacement
86 ASSERT_EQ(eventName, "unknow");
87 }
88
89 /**
90 * @tc.name: TestRecord
91 * @tc.desc:
92 * @tc.type: FUNC
93 */
94 HWTEST_F(SpeDecoderTest, TestRecord, TestSize.Level0)
95 {
96 StdoutRecord stdoutRecord;
97 std::string testProcesses = "com.ohos.launcher";
98 if (!CheckTestApp(testProcesses)) {
99 testProcesses = "hiview";
100 }
101 std::string cmdString = "record -e arm_spe_0/load_filter=1,min_latency=100/ -d 10 --app ";
102 cmdString += " " + testProcesses;
103 printf("command : %s\n", cmdString.c_str());
104 // it need load some symbols and much more log
105 stdoutRecord.Start();
106 const auto startTime = std::chrono::steady_clock::now();
107 bool ret = Command::DispatchCommand(cmdString);
108 const auto costMs = std::chrono::duration_cast<std::chrono::milliseconds>(
109 std::chrono::steady_clock::now() - startTime);
110 std::string stringOut = stdoutRecord.Stop();
111 printf("run %" PRId64 " ms return %d\n", (uint64_t)costMs.count(), static_cast<int>(ret));
112 if (GetSpeType() == UINT_MAX) {
113 EXPECT_EQ(false, ret);
114 } else {
115 EXPECT_EQ(true, ret);
116 }
117 }
118
119 /**
120 * @tc.name: TestDump
121 * @tc.desc:
122 * @tc.type: FUNC
123 */
124 HWTEST_F(SpeDecoderTest, TestDump, TestSize.Level1)
125 {
126 if (access("/data/test/resource/testdata/spe_perf.data", R_OK) == 0) {
127 StdoutRecord stdoutRecord;
128
129 std::string cmdString = "dump -i /data/test/resource/testdata/spe_perf.data";
130
131 // it need load some symbols and much more log
132 ScopeDebugLevel tempLogLevel {LEVEL_DEBUG};
133
134 stdoutRecord.Start();
135 const auto startTime = std::chrono::steady_clock::now();
136 bool ret = Command::DispatchCommand(cmdString);
137 const auto costMs = std::chrono::duration_cast<std::chrono::milliseconds>(
138 std::chrono::steady_clock::now() - startTime);
139 std::string stringOut = stdoutRecord.Stop();
140
141 printf("command : %s(run %" PRId64 " ms) return %d\n", cmdString.c_str(),
142 static_cast<uint64_t>(costMs.count()), static_cast<int>(ret));
143 EXPECT_EQ(true, ret);
144 } else {
145 printf("spe_perf.data not exist.\n");
146 }
147 }
148
149 /**
150 * @tc.name: TestSpeDecoder
151 * @tc.desc:
152 * @tc.type: FUNC
153 */
154 HWTEST_F(SpeDecoderTest, TestSpeDecoder, TestSize.Level1)
155 {
156 const size_t dataDize = 192;
157 const u8 rawData[dataDize] = {0xb0, 0x68, 0xe0, 0x20, 0x84, 0xc0, 0xff, 0xff,
158 0xa0, 0x99, 0x06, 0x00, 0x98, 0x08, 0x00, 0x62,
159 0x16, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00,
160 0xb2, 0xb0, 0x80, 0xad, 0xae, 0xe5, 0xff, 0xff,
161 0x00, 0x9a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x71,
162 0x46, 0xf9, 0xd5, 0x4a, 0x10, 0x62, 0x01, 0x00,
163 0xb0, 0x0c, 0x27, 0xb9, 0xf2, 0x59, 0x00, 0x00,
164 0x80, 0x99, 0x07, 0x00, 0x98, 0x0a, 0x00, 0x62,
165 0x12, 0x00, 0x00, 0x00, 0x49, 0x01, 0x00, 0x00,
166 0xb2, 0x60, 0x73, 0x2b, 0x81, 0x5a, 0x00, 0x00,
167 0x00, 0x9a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x71,
168 0x20, 0x43, 0xd6, 0x4a, 0x10, 0x62, 0x01, 0x00,
169 0xb0, 0x68, 0x54, 0xf9, 0xf4, 0x59, 0x00, 0x00,
170 0x80, 0x99, 0x02, 0x00, 0x98, 0x03, 0x00, 0x62,
171 0x42, 0x00, 0x00, 0x00, 0x4a, 0x01, 0x00, 0x00,
172 0xb1, 0x6c, 0x54, 0xf9, 0xf4, 0x59, 0x00, 0x00,
173 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
174 0xa1, 0x6c, 0xd6, 0x4a, 0x10, 0x62, 0x01, 0x00,
175 0xb0, 0xb4, 0x2b, 0x20, 0x84, 0xc0, 0xff, 0xff,
176 0xa0, 0x99, 0x02, 0x00, 0x98, 0x03, 0x00, 0x62,
177 0x02, 0x00, 0x00, 0x00, 0x4a, 0x02, 0x00, 0x00,
178 0xb1, 0xac, 0x5c, 0x35, 0x84, 0xc0, 0xff, 0xff,
179 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
180 0xcc, 0x99, 0xd6, 0x4a, 0x10, 0x62, 0x01, 0x00};
181 SpeDecoder *decoder = SpeDecoderDataNew(rawData, dataDize);
182 EXPECT_EQ(decoder != nullptr, true);
183 std::vector<SpeRecord> records;
184 while (true) {
185 int ret = SpeDecode(decoder);
186 if (ret <= 0) {
187 break;
188 }
189 struct SpeRecord record = SpeRecord(decoder->record);
190 records.emplace_back(record);
191 }
192 EXPECT_EQ(records.empty(), false);
193 std::vector<ReportItemAuxRawData> auxRawData;
194 for (auto rec: records) {
195 u64 pc = 0;
196 if (rec.from_ip) {
197 pc = rec.from_ip;
198 } else if (rec.to_ip) {
199 pc = rec.to_ip;
200 } else {
201 continue;
202 }
203 VirtualRuntime virtualRuntime;
204 DfxSymbol symbol = virtualRuntime.GetSymbol(pc, 101, 102); // 101: pid, 102: tid
205 struct ReportItemAuxRawData reportItem = {rec.type, 0.0f, 1, symbol.comm_.data(), pc,
206 symbol.module_.data(), symbol.GetName().data(),
207 symbol.fileVaddr_};
208 auxRawData.emplace_back(reportItem);
209 }
210 AddReportItems(auxRawData);
211 SpeDecoderFree(decoder);
212 }
213
214 /**
215 * @tc.name: TestSpeDumpRawData1
216 * @tc.desc:
217 * @tc.type: FUNC
218 */
219 HWTEST_F(SpeDecoderTest, TestSpeDumpRawData1, TestSize.Level2)
220 {
221 const size_t dataDize = 1624;
222 u8 rawData[dataDize] = {0xb0, 0x9c, 0x87, 0xc1, 0x0a, 0x80, 0xff, 0xff,
223 0xa0, 0x99, 0x08, 0x00, 0x98, 0x0a, 0x00, 0x62,
224 0x16, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00,
225 0xb2, 0x70, 0xea, 0xab, 0xe6, 0xe4, 0xff, 0xff,
226 0x00, 0x9a, 0x01, 0x00, 0x64, 0x02, 0x00, 0x00,
227 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
228 0x80, 0x46, 0x1d, 0x6d, 0x90, 0x80, 0x00, 0x00,
229 0xb0, 0xc4, 0xe2, 0xad, 0x6c, 0x5a, 0x00, 0x00,
230 0x80, 0x99, 0x06, 0x00, 0x98, 0x08, 0x00, 0x62,
231 0x16, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00,
232 0xb2, 0x80, 0x26, 0xae, 0x6c, 0x5a, 0x00, 0x00,
233 0x00, 0x9a, 0x01, 0x00, 0x64, 0xbb, 0x05, 0x00,
234 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
235 0x82, 0xc8, 0x1d, 0x6d, 0x90, 0x08, 0x00, 0x00,
236 0xb0, 0xe4, 0xf4, 0xb5, 0x00, 0xb4, 0xff, 0xff,
237 0xa0, 0x99, 0x06, 0x00, 0x98, 0x08, 0x00, 0x62,
238 0x16, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00,
239 0xb2, 0xb0, 0x23, 0xc8, 0x00, 0x64, 0xff, 0xff,
240 0x00, 0x9a, 0x01, 0x00, 0x64, 0x00, 0x00, 0x00,
241 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
242 0x52, 0x04, 0x1e, 0x6d, 0x90, 0x08, 0x00, 0x00,
243 0xb0, 0x84, 0x53, 0xb8, 0x00, 0xb4, 0xff, 0xff,
244 0xa0, 0x99, 0x02, 0x00, 0x98, 0x03, 0x00, 0x62,
245 0x02, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00,
246 0xb1, 0xe0, 0xf4, 0xb5, 0x00, 0xb4, 0xff, 0xff,
247 0xa0, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
248 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
249 0xa5, 0x0b, 0x1e, 0x6d, 0x90, 0x80, 0x00, 0x00,
250 0xb0, 0x98, 0x59, 0xc3, 0x0a, 0x80, 0xff, 0xff,
251 0xa0, 0x99, 0x05, 0x00, 0x98, 0x06, 0x00, 0x62,
252 0x42, 0x00, 0x00, 0x00, 0x4a, 0x01, 0x00, 0x00,
253 0xb1, 0x9c, 0x59, 0xc3, 0x0a, 0x80, 0xff, 0xff,
254 0xa0, 0x00, 0x00, 0x00, 0x64, 0x02, 0x00, 0x00,
255 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
256 0x55, 0x28, 0x1e, 0x6d, 0x90, 0x08, 0x00, 0x00,
257 0xb0, 0x10, 0xd3, 0xaa, 0x00, 0xb4, 0xff, 0xff,
258 0xa0, 0x99, 0x06, 0x00, 0x98, 0x08, 0x00, 0x62,
259 0x16, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00,
260 0xb2, 0xa0, 0xfd, 0xc5, 0x7d, 0xb4, 0xff, 0xff,
261 0x00, 0x9a, 0x01, 0x00, 0x64, 0x00, 0x00, 0x00,
262 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
263 0x08, 0x3a, 0x1e, 0x6d, 0x90, 0x08, 0x00, 0x00,
264 0xb0, 0x34, 0xd2, 0x8c, 0x6f, 0x5a, 0x00, 0x00,
265 0x80, 0x99, 0x06, 0x00, 0x98, 0x08, 0x00, 0x62,
266 0x16, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00,
267 0xb2, 0x70, 0x16, 0x29, 0x7a, 0x5a, 0x00, 0x00,
268 0x00, 0x9a, 0x01, 0x00, 0x64, 0xbb, 0x05, 0x00,
269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
270 0x51, 0x62, 0x1e, 0x6d, 0x90, 0x08, 0x00, 0x00,
271 0xb0, 0xe8, 0xa8, 0xe5, 0x6b, 0x5a, 0x00, 0x00,
272 0x80, 0x99, 0x07, 0x00, 0x98, 0x0a, 0x00, 0x62,
273 0x12, 0x00, 0x00, 0x00, 0x49, 0x01, 0x00, 0x00,
274 0xb2, 0xa0, 0x02, 0x29, 0x7a, 0x5a, 0x00, 0x00,
275 0x00, 0x9a, 0x01, 0x00, 0x64, 0xbb, 0x05, 0x00,
276 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
277 0x8c, 0x87, 0x1e, 0x6d, 0x90, 0x08, 0x00, 0x00,
278 0xb0, 0x9c, 0x1c, 0x12, 0x6b, 0x5a, 0x00, 0x00,
279 0x80, 0x99, 0x08, 0x00, 0x98, 0x09, 0x00, 0x62,
280 0x82, 0x00, 0x00, 0x00, 0x4a, 0x01, 0x00, 0x00,
281 0xb1, 0x7c, 0x1c, 0x12, 0x6b, 0x5a, 0x00, 0x00,
282 0x80, 0x00, 0x00, 0x00, 0x64, 0xbb, 0x05, 0x00,
283 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
284 0x4c, 0x9c, 0x1e, 0x6d, 0x90, 0x08, 0x00, 0x00,
285 0xb0, 0x44, 0x7e, 0xe5, 0x6b, 0x5a, 0x00, 0x00,
286 0x80, 0x99, 0x03, 0x00, 0x98, 0x04, 0x00, 0x62,
287 0x02, 0x00, 0x00, 0x00, 0x4a, 0x02, 0x00, 0x00,
288 0xb1, 0x04, 0x65, 0xe5, 0x6b, 0x5a, 0x00, 0x00,
289 0x80, 0x00, 0x00, 0x00, 0x64, 0xbb, 0x05, 0x00,
290 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
291 0x44, 0x10, 0x1f, 0x6d, 0x90, 0x08, 0x00, 0x00,
292 0xb0, 0x9c, 0x7b, 0xe5, 0x6b, 0x5a, 0x00, 0x00,
293 0x80, 0x99, 0x06, 0x00, 0x98, 0x09, 0x00, 0x62,
294 0x12, 0x08, 0x00, 0x00, 0x49, 0x01, 0x00, 0x00,
295 0xb2, 0xe8, 0x0c, 0x29, 0x7a, 0x5a, 0x00, 0x00,
296 0x00, 0x9a, 0x01, 0x00, 0x64, 0xbb, 0x05, 0x00,
297 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
298 0xc8, 0x2e, 0x1f, 0x6d, 0x90, 0x08, 0x00, 0x00,
299 0xb0, 0x10, 0x9e, 0xe5, 0x6b, 0x5a, 0x00, 0x00,
300 0x80, 0x99, 0xc5, 0x00, 0x98, 0xc6, 0x00, 0x62,
301 0x02, 0x00, 0x00, 0x00, 0x4a, 0x02, 0x00, 0x00,
302 0xb1, 0x0c, 0x73, 0xe5, 0x6b, 0x5a, 0x00, 0x00,
303 0x80, 0x00, 0x00, 0x00, 0x64, 0xbb, 0x05, 0x00,
304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
305 0xc1, 0x73, 0x1f, 0x6d, 0x90, 0x08, 0x00, 0x00,
306 0xb0, 0x88, 0x43, 0xc4, 0x0a, 0x80, 0xff, 0xff,
307 0xa0, 0x99, 0x0c, 0x00, 0x98, 0x0d, 0x00, 0x62,
308 0x02, 0x00, 0x00, 0x00, 0x4a, 0x02, 0x00, 0x00,
309 0xb1, 0xc4, 0x5b, 0xf0, 0x0a, 0x80, 0xff, 0xff,
310 0xa0, 0x00, 0x00, 0x00, 0x64, 0x02, 0x00, 0x00,
311 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
312 0x34, 0x9a, 0x1f, 0x6d, 0x90, 0x80, 0x00, 0x00,
313 0xb0, 0xa8, 0xcf, 0xef, 0x0a, 0x80, 0xff, 0xff,
314 0xa0, 0x00, 0x06, 0x00, 0x98, 0x08, 0x00, 0x62,
315 0x16, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00,
316 0xb2, 0xbc, 0x74, 0xfc, 0xc1, 0xe4, 0xff, 0xff,
317 0x00, 0x9a, 0x01, 0x00, 0x64, 0x02, 0x00, 0x00,
318 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
319 0xd7, 0xb3, 0x1f, 0x6d, 0x90, 0x08, 0x00, 0x00,
320 0xb0, 0x9c, 0x53, 0xb8, 0x00, 0xb4, 0xff, 0xff,
321 0xa0, 0x99, 0x06, 0x00, 0x98, 0x08, 0x00, 0x62,
322 0x16, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00,
323 0xb2, 0x08, 0x00, 0xc4, 0x7d, 0xb4, 0xff, 0xff,
324 0x00, 0x9a, 0x01, 0x00, 0x64, 0xbb, 0x05, 0x00,
325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
326 0x0c, 0xc0, 0x1f, 0x6d, 0x90, 0x08, 0x00, 0x00,
327 0xb0, 0x18, 0x3a, 0xa5, 0x00, 0xb4, 0xff, 0xff,
328 0xa0, 0x99, 0x07, 0x00, 0x98, 0x08, 0x00, 0x62,
329 0x02, 0x00, 0x00, 0x00, 0x4a, 0x01, 0x00, 0x00,
330 0xb1, 0x48, 0x3a, 0xa5, 0x00, 0xb4, 0xff, 0xff,
331 0xa0, 0x00, 0x00, 0x00, 0x64, 0xbb, 0x05, 0x00,
332 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
333 0xb2, 0xce, 0x1f, 0x6d, 0x90, 0x08, 0x00, 0x00,
334 0xb0, 0x04, 0x0e, 0xb9, 0x00, 0xb4, 0xff, 0xff,
335 0xa0, 0x99, 0x06, 0x00, 0x98, 0x09, 0x00, 0x62,
336 0x12, 0x00, 0x00, 0x00, 0x49, 0x01, 0x00, 0x00,
337 0xb2, 0xa0, 0xfc, 0xc5, 0x7d, 0xb4, 0xff, 0xff,
338 0x00, 0x9a, 0x01, 0x00, 0x64, 0x00, 0x00, 0x00,
339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
340 0x9f, 0x63, 0x20, 0x6d, 0x90, 0x08, 0x00, 0x00,
341 0xb0, 0x5c, 0x12, 0xb9, 0x00, 0xb4, 0xff, 0xff,
342 0xa0, 0x99, 0x06, 0x00, 0x98, 0x09, 0x00, 0x62,
343 0x12, 0x00, 0x00, 0x00, 0x49, 0x01, 0x00, 0x00,
344 0xb2, 0x60, 0xfc, 0xc5, 0x7d, 0xb4, 0xff, 0xff,
345 0x00, 0x9a, 0x01, 0x00, 0x64, 0x00, 0x00, 0x00,
346 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
347 0x23, 0x82, 0x20, 0x6d, 0x90, 0x08, 0x00, 0x00,
348 0xb0, 0x98, 0x0f, 0xb9, 0x00, 0xb4, 0xff, 0xff,
349 0xa0, 0x99, 0x0a, 0x00, 0x98, 0x0b, 0x00, 0x62,
350 0x02, 0x00, 0x00, 0x00, 0x4a, 0x01, 0x00, 0x00,
351 0xb1, 0xac, 0x0f, 0xb9, 0x00, 0xb4, 0xff, 0xff,
352 0xa0, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
353 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
354 0xaf, 0x8a, 0x20, 0x6d, 0x90, 0x08, 0x00, 0x00,
355 0xb0, 0x14, 0xf3, 0xb1, 0x00, 0xb4, 0xff, 0xff,
356 0xa0, 0x99, 0x09, 0x00, 0x98, 0x0c, 0x00, 0x62,
357 0x12, 0x08, 0x00, 0x00, 0x49, 0x01, 0x00, 0x00,
358 0xb2, 0xd8, 0xfa, 0xc5, 0x7d, 0xb4, 0xff, 0xff,
359 0x00, 0x9a, 0x01, 0x00, 0x64, 0x00, 0x00, 0x00,
360 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
361 0x48, 0x96, 0x20, 0x6d, 0x90, 0x08, 0x00, 0x00,
362 0xb0, 0x64, 0x0e, 0xb0, 0x00, 0xb4, 0xff, 0xff,
363 0xa0, 0x99, 0x0f, 0x00, 0x98, 0x10, 0x00, 0x62,
364 0x42, 0x00, 0x00, 0x00, 0x4a, 0x01, 0x00, 0x00,
365 0xb1, 0x68, 0x0e, 0xb0, 0x00, 0xb4, 0xff, 0xff,
366 0xa0, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
367 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
368 0x37, 0x9e, 0x20, 0x6d, 0x90, 0x08, 0x00, 0x00,
369 0xb0, 0x74, 0x1f, 0xb3, 0x00, 0xb4, 0xff, 0xff,
370 0xa0, 0x99, 0x07, 0x00, 0x98, 0x08, 0x00, 0x00,
371 0x12, 0x00, 0x00, 0x00, 0x49, 0x01, 0x00, 0x00,
372 0xb2, 0xa0, 0xfc, 0xc5, 0x7d, 0xb4, 0xff, 0xff,
373 0x00, 0x9a, 0x01, 0x00, 0x64, 0x00, 0x00, 0x00,
374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
375 0xd6, 0xc2, 0x20, 0x6d, 0x90, 0x08, 0x00, 0x00,
376 0xb0, 0xe8, 0xf4, 0xb5, 0x00, 0xb4, 0xff, 0xff,
377 0xa0, 0x99, 0x02, 0x00, 0x98, 0x03, 0x00, 0x62,
378 0x02, 0x00, 0x00, 0x00, 0x4a, 0x02, 0x00, 0x00,
379 0xb1, 0x7c, 0x95, 0xb5, 0x00, 0xb4, 0xff, 0xff,
380 0xa0, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
381 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
382 0x29, 0xca, 0x20, 0x6d, 0x90, 0x08, 0x00, 0x00,
383 0xb0, 0x78, 0x4d, 0xd2, 0x6a, 0x5a, 0x00, 0x00,
384 0x80, 0x99, 0x07, 0x00, 0x98, 0x0a, 0x00, 0x62,
385 0x12, 0x00, 0x00, 0x00, 0x4a, 0x01, 0x00, 0x00,
386 0xb2, 0x50, 0x16, 0x29, 0x7a, 0x5a, 0x00, 0x00,
387 0x00, 0x9a, 0x01, 0x00, 0x64, 0xbb, 0x05, 0x00,
388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
389 0x0a, 0xfe, 0x20, 0x6d, 0x90, 0x08, 0x00, 0x00,
390 0xb0, 0x04, 0x27, 0xa9, 0x00, 0xb4, 0xff, 0xff,
391 0xa0, 0x99, 0x07, 0x00, 0x98, 0x09, 0x00, 0x62,
392 0x16, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00,
393 0xb2, 0xb8, 0xd4, 0x29, 0xdd, 0xe5, 0xff, 0xff,
394 0x00, 0x9a, 0x01, 0x00, 0x64, 0x00, 0x00, 0x00,
395 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
396 0x2e, 0x12, 0x21, 0x6d, 0x90, 0x08, 0x00, 0x00,
397 0xb0, 0xf8, 0xb4, 0xb6, 0x00, 0x64, 0xff, 0xff,
398 0xa0, 0x99, 0x06, 0x00, 0x98, 0x08, 0x00, 0x62,
399 0x16, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00,
400 0xb2, 0x40, 0xfd, 0xc5, 0x7d, 0xb4, 0xff, 0xff,
401 0x00, 0x9a, 0x01, 0x00, 0x64, 0x00, 0x00, 0x00,
402 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
403 0x81, 0x19, 0x21, 0x6d, 0x90, 0x08, 0x00, 0x00,
404 0xb0, 0xb4, 0x1b, 0xa6, 0x00, 0xb4, 0xff, 0xff,
405 0xa0, 0x99, 0x02, 0x00, 0x98, 0x03, 0x00, 0x62,
406 0x02, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00,
407 0xb1, 0xe0, 0xf4, 0xb5, 0x00, 0xb4, 0xff, 0xff,
408 0xa0, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
409 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
410 0xc4, 0x28, 0x21, 0x6d, 0x90, 0x08, 0x00, 0x00,
411 0xb0, 0x70, 0x2d, 0xd0, 0x0a, 0x80, 0x00, 0x00,
412 0xa0, 0x99, 0x06, 0x00, 0x98, 0x08, 0x00, 0x62,
413 0x16, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00,
414 0xb2, 0xd0, 0xc2, 0x8e, 0x01, 0x8c, 0xff, 0xff,
415 0x00, 0x9a, 0x01, 0x00, 0x64, 0x02, 0x00, 0x00,
416 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
417 0xa5, 0x5c, 0x21, 0x6d, 0x90, 0x08, 0x00, 0x00,
418 0xb0, 0x34, 0xa0, 0xb8, 0x00, 0xb4, 0xff, 0xff,
419 0xa0, 0x99, 0x02, 0x00, 0x98, 0x03, 0x00, 0x62,
420 0x02, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00,
421 0xb1, 0xe8, 0x9f, 0xb8, 0x00, 0xb4, 0xff, 0xff,
422 0xa0, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
423 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71,
424 0x0f, 0x75, 0x21, 0x6d, 0x90, 0x08, 0x00, 0x00};
425 EXPECT_EQ(SpeDumpRawData(rawData, dataDize, 1, nullptr), true);
426 }
427
428 /**
429 * @tc.name: TestSpeDumpRawData2
430 * @tc.desc:
431 * @tc.type: FUNC
432 */
433 HWTEST_F(SpeDecoderTest, TestSpeDumpRawData2, TestSize.Level1)
434 {
435 const size_t dataDize = 112;
436 u8 rawData[dataDize] = {0x00, 0x00, 0x00, 0x71, 0x32, 0x5a, 0x28, 0x6d,
437 0x90, 0x08, 0x00, 0x00, 0x00, 0x90, 0x70, 0x0a,
438 0x6b, 0x5a, 0x00, 0x00, 0x80, 0x99, 0x02, 0x00,
439 0x98, 0x03, 0x00, 0x62, 0x02, 0x00, 0x00, 0x00,
440 0x4a, 0x01, 0x00, 0x00, 0xb1, 0x0c, 0x71, 0x0a,
441 0x6b, 0x5a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
442 0x64, 0xbb, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
443 0x00, 0x00, 0x00, 0x71, 0x21, 0x62, 0x28, 0x6d,
444 0x90, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
445 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
446 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
447 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
448 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
449 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
450 EXPECT_EQ(SpeDumpRawData(rawData, dataDize, 1, nullptr), true);
451 }
452 } // namespace HiPerf
453 } // namespace Developtools
454 } // namespace OHOS