1 /*
2  * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef _RUN_INTEGRATION_PROFILER_H_
8 #define _RUN_INTEGRATION_PROFILER_H_
9 
10 #include "stdio.h"
11 #include "string.h"
12 
13 /* cc lib */
14 #include "cc_pal_types.h"
15 #include "cc_pal_perf.h"
16 
17 /* pal */
18 #include "test_pal_mem.h"
19 #include "run_integration_pal_log.h"
20 
21 #define PARAM_LEN                   30
22 
23 typedef uint64_t runItPerfData_t;
24 
25 typedef enum runItPerfType_t
26 {
27     PERF_TYPE_TEST_NOT_SET,
28 
29     TEST_MAX = 256,
30 
31     RESERVE32 = 0x7FFFFFFF
32 } runItPerfType_t;
33 
34 /**
35  * @brief   initialise performance test mechanism
36  *
37  * @param[in]
38  * *
39  * @return None
40  */
41 void runIt_perfInit(void);
42 
43 /**
44  * register api to DB
45  *
46  * @param func          address of function
47  * @param name          name of function
48  * @param param         param ti distinguish between flows
49  */
50 void runIt_perfEntryInit(const char* name, const char* param, uint8_t isHw);
51 
52 /**
53  * @brief   opens new entry in perf buffer to record new entry
54  *
55  * @param[in] entryType -  entry type (defined in cc_pal_perf.h) to be recorded in buffer
56  *
57  * @return A non-zero value in case of failure.
58  */
59 runItPerfData_t runIt_perfOpenNewEntry(runItPerfType_t entryType);
60 
61 
62 /**
63  * @brief   closes entry in perf buffer previously opened by runIt_perfOpenNewEntry
64  *
65  * @param[in] idx -  index of the entry to be closed, the return value of runIt_perfOpenNewEntry
66  * @param[in] entryType -  entry type (defined in cc_pal_perf.h) to be recorded in buffer
67  *
68  * @return A non-zero value in case of failure.
69  */
70 void runIt_perfCloseEntry(runItPerfData_t idx, runItPerfType_t entryType);
71 
72 
73 /**
74  * @brief   dumps the performance buffer
75  *
76  * @param[in] None
77  *
78  * @return None
79  */
80 void runIt_perfDump(void);
81 
82 
83 /**
84  * @brief   terminates resources used for performance tests
85  *
86  * @param[in]
87  * *
88  * @return None
89  */
90 void runIt_perfFin(void);
91 
92 /**
93  *
94  * @param typeStr
95  * @return
96  */
97 runItPerfType_t runIt_perfTypeFromStr(const char* typeStr, const char* paramStr);
98 
99 /**
100  *
101  * @param func
102  * @param paramStr
103  * @return
104  */
105 runItPerfType_t runIt_perfTypeFromFunc(void* func, const char* paramStr);
106 
107 /**
108  *
109  * @param type
110  * @param pStr
111  * @param buffLen
112  * @return
113  */
114 char* runIt_perfTypeStr(runItPerfType_t type, char* pStr, uint32_t buffLen);
115 
116 #endif //_RUN_INTEGRATION_PROFILER_H_
117