O-RAN E Maintenance Release contribution for ODULOW
[o-du/phy.git] / fhi_lib / app / src / app_profile_xran.h
1 /******************************************************************************
2 *
3 *   Copyright (c) 2020 Intel.
4 *
5 *   Licensed under the Apache License, Version 2.0 (the "License");
6 *   you may not use this file except in compliance with the License.
7 *   You may obtain a copy of the License at
8 *
9 *       http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *   Unless required by applicable law or agreed to in writing, software
12 *   distributed under the License is distributed on an "AS IS" BASIS,
13 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *   See the License for the specific language governing permissions and
15 *   limitations under the License.
16 *
17 *******************************************************************************/
18
19 #ifndef _APP_PROFILE_XRAN_H_
20 #define _APP_PROFILE_XRAN_H_
21
22 #include "config.h"
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 struct xran_mlog_times
29 {
30     uint64_t ticks_per_usec;
31     uint64_t core_total_time;   /* in us */
32     uint64_t core_used_time;    /* in us */
33     uint64_t xran_total_time;   /* in us */
34     uint64_t mlog_total_time;   /* in us */
35 };
36
37 struct xran_mlog_stats
38 {
39     uint32_t cnt;
40     uint32_t max;
41     uint32_t min;
42     float avg;
43 };
44
45 struct xran_mlog_taskid
46 {
47     uint16_t taskId;
48     uint16_t taskType;
49     char taskName[80];
50 };
51
52 enum xran_mlog_task_type {
53     XRAN_TASK_TYPE_GNB = 0,
54     XRAN_TASK_TYPE_BBDEV,
55     XRAN_TASK_TYPE_TIMER,
56     XRAN_TASK_TYPE_RADIO,
57     XRAN_TASK_TYPE_CP,
58     XRAN_TASK_TYPE_UP,
59     XRAN_TASK_TYPE_MAX, /* The last entry : total# of types */
60 };
61
62 #define XRAN_REPORT_FILE    "xran_mlog_stats"
63
64 #ifdef MLOG_ENABLED
65 int32_t app_profile_xran_print_mlog_stats(char *usecase_file);
66 #else
67 #define app_profile_xran_print_mlog_stats(a)
68 #endif
69
70 #ifndef WIN32
71 #ifdef PRINTF_ERR_OK
72 #define print_err(fmt, args...) printf("%s:[err] " fmt "\n", __FUNCTION__, ## args)
73 #else  /* PRINTF_LOG_OK */
74 #define print_err(fmt, args...)
75 #endif  /* PRINTF_LOG_OK */
76 #else
77 #define print_err(fmt, ...) printf("%s:[err] " fmt "\n", __FUNCTION__, __VA_ARGS__)
78 #endif
79
80 #ifdef __cplusplus
81 }
82 #endif
83
84 extern struct xran_mlog_times mlog_times;
85
86 #endif /* _APP_PROFILE_XRAN_ */