• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 #ifndef HIPERF_VIRTUAL_RUNTIME_TEST_H
16 #define HIPERF_VIRTUAL_RUNTIME_TEST_H
17 
18 #include "callstack_test.h"
19 #include "debug_logger.h"
20 #include "utilities.h"
21 #include "virtual_runtime.h"
22 #include "virtual_thread.h"
23 
24 namespace OHOS {
25 namespace Developtools {
26 namespace HiPerf {
27 static const std::string TEST_DWARF_RECORD = "hiperf_643_644_sample_record_213_6754913387560.dump";
28 constexpr const pid_t TEST_DWARF_RECORD_PID = 643;
29 constexpr const pid_t TEST_DWARF_RECORD_TID = 644;
30 /*
31  SAMPLE: id= 72 size 8424 pid 643 tid 644 ip nr 0 reg nr 16, stacks 8192 time 6754913387560
32  (1/16)unwind symbol:  va: 0x0000000000003539::LoopFunction(int)
33  (2/16)unwind symbol:   va: 0x0000000000003645::CallStack10(int, int)
34  (3/16)unwind symbol:    va: 0x0000000000003671::CallStack9(int, int)
35  (4/16)unwind symbol:     va: 0x00000000000036b5::CallStack8(int, int)
36  (5/16)unwind symbol:      va: 0x00000000000036f9::CallStack7(int, int)
37  (6/16)unwind symbol:       va: 0x000000000000373d::CallStack6(int, int)
38  (7/16)unwind symbol:        va: 0x0000000000003781::CallStack5(int, int)
39  (8/16)unwind symbol:         va: 0x00000000000037c5::CallStack4(int, int)
40  (9/16)unwind symbol:          va: 0x0000000000003809::CallStack3(int, int)
41  (10/16)unwind symbol:           va: 0x000000000000384d::CallStack2(int, int)
42  (11/16)unwind symbol:            va: 0x0000000000003891::CallStack1(int, int)
43  (12/16)unwind symbol:             va: 0x00000000000038d5::CallStack0(int, int)
44  (13/16)unwind symbol:              va: 0x0000000000003919::ExampleThread(int, int)
45  (14/16)unwind symbol:               va: 0x0000000000003fe3::void*
46  std::__h::__thread_proxy<std::__h::tuple<std::__h::unique_ptr<std::__h::__thread_struct,
47  std::__h::default_delete<std::__h::__thread_struct> >, void (*)(int, int), int, int> >(void*)
48  (15/16)unwind symbol:                va: 0x000000000005506c::__aeabi_read_tp
49  (16/16)unwind symbol:                 va: 0x000000000005506c::__aeabi_read_tp
50 */
51 constexpr const size_t TEST_DWARF_RECORD_STACK_SIZE = 8192u;
52 static const std::vector<std::pair<uint64_t, std::string>> TEST_RECORD_CALLSTACK_IP_FUNC = {
53     {0x0000000000003539, "LoopFunction(int)"}, // base ip sp
54     {0x0000000000003645, "CallStack10(int, int)"}, {0x0000000000003671, "CallStack9(int, int)"},
55     {0x00000000000036b5, "CallStack8(int, int)"},  {0x00000000000036f9, "CallStack7(int, int)"},
56     {0x000000000000373d, "CallStack6(int, int)"},  {0x0000000000003781, "CallStack5(int, int)"},
57     {0x00000000000037c5, "CallStack4(int, int)"},  {0x0000000000003809, "CallStack3(int, int)"},
58     {0x000000000000384d, "CallStack2(int, int)"},  {0x0000000000003891, "CallStack1(int, int)"},
59     {0x00000000000038d5, "CallStack0(int, int)"},  {0x0000000000003919, "ExampleThread(int, int)"},
60 };
61 /*
62   event_attr:
63     type 1, size 120, config 0
64     sample_freq 4000
65     sample_type (0x133e7)
66     read_format (0x7)
67     disabled 1, inherit 1, pinned 0, exclusive 0
68     exclude_user 0, exclude_kernel 0, exclude_hv 0, exclude_idle 0
69     mmap 1, mmap2 1, comm 1, comm_exec 0, freq 1
70     inherit_stat 0, enable_on_exec 0, task 0, use_clockid 0
71     watermark 0, precise_ip 0, mmap_data 0, clockid 0
72     sample_id_all 0, exclude_host 0, exclude_guest 0
73     branch_sample_type 0x0
74     exclude_callchain_kernel 0, exclude_callchain_user 1
75     sample_regs_user 0xffff
76     sample_stack_user 0x2000
77 */
78 constexpr const uint64_t TEST_RECORD_SAMPLE_TYPE = 0x133e7;
79 constexpr const size_t TEST_DWARF_RECORD_REGS_USER = 0xffff;
80 } // namespace HiPerf
81 } // namespace Developtools
82 } // namespace OHOS
83 #endif