• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
3  * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice, this list of
9  * conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice, this list
12  * of conditions and the following disclaimer in the documentation and/or other materials
13  * provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors may be used
16  * to endorse or promote products derived from this software without specific prior written
17  * permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #include "It_extend_cpup.h"
33 
GetNopCount(void)34 UINT32 GetNopCount(void)
35 {
36     return LOS_CyclePerTickGet();
37 }
38 
39 #ifdef LOSCFG_CPUP_INCLUDE_IRQ
40 
41 CPUP_INFO_S g_testPstHwiCpupAll[OS_HWI_MAX_NUM];
42 CPUP_INFO_S g_testPstHwiCpup10s[OS_HWI_MAX_NUM];
43 CPUP_INFO_S g_testPstHwiCpup1s[OS_HWI_MAX_NUM];
44 
TestGetSingleHwiCpup(UINT32 hwi,UINT32 mode)45 UINT32 TestGetSingleHwiCpup(UINT32 hwi, UINT32 mode)
46 {
47     UINT32 size;
48     UINT32 tempHwi;
49     if (hwi > OS_HWI_MAX_NUM) {
50         return -1;
51     }
52 
53     size = sizeof(CPUP_INFO_S) * LOS_GetSystemHwiMaximum();
54     switch (mode) {
55         case CPUP_LAST_ONE_SECONDS:
56             (VOID)memset_s((VOID *)g_testPstHwiCpup1s, size, 0, size);
57             (VOID)LOS_GetAllIrqCpuUsage(CPUP_LAST_ONE_SECONDS, g_testPstHwiCpup1s, size);
58             tempHwi = g_testPstHwiCpup1s[hwi].usage;
59             break;
60         case CPUP_LAST_TEN_SECONDS:
61             (VOID)memset_s((VOID *)g_testPstHwiCpup10s, size, 0, size);
62             (VOID)LOS_GetAllIrqCpuUsage(CPUP_LAST_TEN_SECONDS, g_testPstHwiCpup10s, size);
63             tempHwi = g_testPstHwiCpup10s[hwi].usage;
64             break;
65         case CPUP_ALL_TIME:
66             /* fall-through */
67         default:
68             (VOID)memset_s((VOID *)g_testPstHwiCpupAll, size, 0, size);
69             (VOID)LOS_GetAllIrqCpuUsage(CPUP_ALL_TIME, g_testPstHwiCpupAll, size);
70             tempHwi = g_testPstHwiCpupAll[hwi].usage;
71             break;
72     }
73     return tempHwi;
74 }
75 #endif
76 
77 
ItSuiteExtendCpup(VOID)78 VOID ItSuiteExtendCpup(VOID)
79 {
80 #if defined(LOSCFG_TEST_SMOKE)
81     ItExtendCpup001();
82     ItExtendCpup002();
83 #endif
84 
85 #if defined(LOSCFG_TEST_FULL)
86     ItExtendCpup003();
87     ItExtendCpup004();
88     ItExtendCpup005();
89     ItExtendCpup006();
90     ItExtendCpup007();
91     ItExtendCpup008();
92     ItExtendCpup011();
93     ItExtendCpup012();
94 #endif
95 
96 #if defined(LOSCFG_TEST_LLT)
97     LltExtendCpup003();
98     ItExtendCpup009();
99     ItExtendCpup010();
100 #endif
101 
102 #ifdef LOSCFG_KERNEL_SMP
103     ItSmpExtendCpup001();
104     ItSmpExtendCpup002();
105 #ifdef LOSCFG_CPUP_INCLUDE_IRQ
106     ItSmpExtendCpup003();
107     ItSmpExtendCpup004();
108 #endif
109     ItSmpExtendCpup005();
110     ItSmpExtendCpup007();
111     ItSmpExtendCpup008();
112     ItSmpExtendCpup009();
113     ItSmpExtendCpup010();
114     ItSmpExtendCpup011();
115     ItSmpExtendCpup012();
116 #endif
117 }
118