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