98 lines
2.9 KiB
C
98 lines
2.9 KiB
C
/*
|
|
* Copyright (c) @CompanyNameMagicTag 2021-2021. All rights reserved.
|
|
* Description: zdiag dfx
|
|
* This file should be changed only infrequently and with great care.
|
|
*/
|
|
|
|
#ifndef __ZDIAG_DFX_H__
|
|
#define __ZDIAG_DFX_H__
|
|
|
|
#include "errcode.h"
|
|
#include "zdiag_dfx_st.h"
|
|
#include "diag.h"
|
|
|
|
zdiag_dfx_stat_t *uapi_zdiag_get_dfx_stat(void);
|
|
errcode_t diag_dfx_cmd(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option);
|
|
|
|
static inline void diag_dfx_channel_receive_data(uint32_t chan_id, uint32_t cnt)
|
|
{
|
|
zdiag_dfx_stat_t *g_zdiag_dfx_stat = uapi_zdiag_get_dfx_stat();
|
|
if (chan_id < DIAG_DFX_SUPPORT_MAX_CHANNEL) {
|
|
g_zdiag_dfx_stat->channel_receive_data_cnt[chan_id] += cnt;
|
|
}
|
|
}
|
|
|
|
static inline void diag_dfx_channel_receive_frame(uint32_t chan_id, uint32_t cnt)
|
|
{
|
|
zdiag_dfx_stat_t *g_zdiag_dfx_stat = uapi_zdiag_get_dfx_stat();
|
|
if (chan_id < DIAG_DFX_SUPPORT_MAX_CHANNEL) {
|
|
g_zdiag_dfx_stat->channel_receive_frame_cnt[chan_id] += cnt;
|
|
}
|
|
}
|
|
|
|
static inline void diag_dfx_alloc_pkt(uint32_t pkt_type, uint32_t size)
|
|
{
|
|
zdiag_dfx_stat_t *g_zdiag_dfx_stat = uapi_zdiag_get_dfx_stat();
|
|
if (pkt_type < DIAG_DFX_SUPPORT_MAX_PKT_MEM_TYPE) {
|
|
g_zdiag_dfx_stat->mem_pkt_alloc_size[pkt_type] += size;
|
|
}
|
|
}
|
|
|
|
static inline void diag_dfx_free_pkt(uint32_t pkt_type, uint32_t size)
|
|
{
|
|
zdiag_dfx_stat_t *g_zdiag_dfx_stat = uapi_zdiag_get_dfx_stat();
|
|
if (pkt_type < DIAG_DFX_SUPPORT_MAX_PKT_MEM_TYPE) {
|
|
g_zdiag_dfx_stat->mem_pkt_free_size[pkt_type] += size;
|
|
}
|
|
}
|
|
|
|
static inline void zdiag_dfx_put_msg_2_cache_fail(void)
|
|
{
|
|
zdiag_dfx_stat_t *g_zdiag_dfx_stat = uapi_zdiag_get_dfx_stat();
|
|
g_zdiag_dfx_stat->put_msg_2_cache_fail_times++;
|
|
}
|
|
|
|
static inline void zdiag_dfx_log_received(void)
|
|
{
|
|
zdiag_dfx_stat_t *g_zdiag_dfx_stat = uapi_zdiag_get_dfx_stat();
|
|
g_zdiag_dfx_stat->log_receive_times++;
|
|
}
|
|
|
|
static inline void zdiag_dfx_log_reported(void)
|
|
{
|
|
zdiag_dfx_stat_t *g_zdiag_dfx_stat = uapi_zdiag_get_dfx_stat();
|
|
g_zdiag_dfx_stat->log_reported_times++;
|
|
}
|
|
|
|
static inline void zdiag_dfx_send_local_q_success(void)
|
|
{
|
|
zdiag_dfx_stat_t *g_zdiag_dfx_stat = uapi_zdiag_get_dfx_stat();
|
|
g_zdiag_dfx_stat->send_local_q_success++;
|
|
}
|
|
|
|
static inline void zdiag_dfx_send_local_q_fail(void)
|
|
{
|
|
zdiag_dfx_stat_t *g_zdiag_dfx_stat = uapi_zdiag_get_dfx_stat();
|
|
g_zdiag_dfx_stat->send_local_q_fail++;
|
|
}
|
|
|
|
static inline void zdiag_dfx_rev_msg(void)
|
|
{
|
|
zdiag_dfx_stat_t *g_zdiag_dfx_stat = uapi_zdiag_get_dfx_stat();
|
|
g_zdiag_dfx_stat->msg_rev_cnt++;
|
|
}
|
|
|
|
static inline void zdiag_dfx_rev_pkt_msg(void)
|
|
{
|
|
zdiag_dfx_stat_t *g_zdiag_dfx_stat = uapi_zdiag_get_dfx_stat();
|
|
g_zdiag_dfx_stat->diag_pkt_msg_rev_cnt++;
|
|
}
|
|
|
|
static inline void zdiag_dfx_rev_beat_herat_msg(void)
|
|
{
|
|
zdiag_dfx_stat_t *g_zdiag_dfx_stat = uapi_zdiag_get_dfx_stat();
|
|
g_zdiag_dfx_stat->beat_heart_msg_rev_cnt++;
|
|
}
|
|
|
|
#endif
|