/* * Copyright (c) Hisilicon Technologies Co., Ltd. 2020-2020. All rights reserved. * Description: Application programming interfaces (APIs) of the dft_event. * Author: Hisilicon * Create: 2020-10-21 */ #ifndef DFT_EVENT_H #define DFT_EVENT_H #ifdef __cplusplus #if __cplusplus extern "C" { #endif #endif /* * * brief Create a dft_event. CNcomment:创建故障事件。CNend * attention \n * NA. * param[in] id event identifier. CNcomment: 事件标识符,每个事件具有唯一ID。CNend * param[out] handle event handle. CNcomment: 事件句柄。CNend * retval ::SUCCESS success. CNcomment: 成功。CNend * retval ::FAILURE failure. CNcomment: 失败。CNend * see \n * NA */ int dft_event_create(int id, unsigned int *handle); /* * * brief Destory a dft_event. CNcomment:销毁故障事件。CNend * attention \n * NA. * param[in] handle event handle. CNcomment: 事件句柄。CNend * retval \n * NA. * see \n * NA. */ void dft_event_destroy(unsigned int handle); /* * * brief Set the occurrence time of the event. CNcomment: 设置故障事件的发生时间。CNend * attention \n * NA. * param[in] handle event handle. CNcomment: 事件句柄。CNend * param[in] seconds time. CNcomment: 事件发生的时间。CNend * retval ::SUCCESS success. CNcomment: 成功。CNend * retval ::FAILURE failure. CNcomment: 失败。CNend * see \n * NA. */ int dft_event_set_time(unsigned int handle, long long seconds); /* * * brief Load a digital type of load for the event. CNcomment: 给故障事件装载数字类型的负荷。CNend * attention \n * NA. * param[in] handle event handle. CNcomment: 事件句柄。 CNend * param[in] key key. CNcomment: 负载的键。 CNend * param[in] value value. CNcomment: 负载的值。 CNend * retval ::SUCCESS success. CNcomment: 成功。 CNend * retval ::FAILURE failure. CNcomment: 失败。 CNend * see \n * NA. */ int dft_event_put_integral(unsigned int handle, const char *key, long value); /* * * brief Load a digital type of load for the event. CNcomment: 给故障事件装载浮点类型的负荷。CNend * attention \n * NA. * param[in] handle event handle. CNcomment: 事件句柄。 CNend * param[in] key key. CNcomment: 负载的键。 CNend * param[in] value value. CNcomment: 负载的值。 CNend * retval ::SUCCESS success. CNcomment: 成功。 CNend * retval ::FAILURE failure. CNcomment: 失败。 CNend * see \n * NA. */ int dft_event_put_float(unsigned int handle, const char *key, float value); /* * * brief Load string type load for event. CNcomment: 给故障事件装载字符串类型的负荷。CNend * attention \n * NA. * param[in] handle event handle. CNcomment: 事件句柄。 CNend * param[in] key key. CNcomment: 负载的键。 CNend * param[in] value value. CNcomment: 负载的值。 CNend * retval ::SUCCESS success. CNcomment: 成功。 CNend * retval ::FAILURE failure. CNcomment: 失败。 CNend * see \n * NA. */ int dft_event_put_string(unsigned int handle, const char *key, const char *value); /* * * brief Add logs that need to be packaged for events. CNcomment: 给故障事件添加需要打包的日志。CNend * attention \n * NA. * param[in] handle event handle. CNcomment: 事件句柄。 CNend * param[in] path path. CNcomment: 随事件携带的日志文件路径。 CNend * retval ::SUCCESS success. CNcomment: 成功。 CNend * retval ::FAILURE failure. CNcomment: 失败。 CNend * see \n * NA. */ int dft_event_add_file_path(unsigned int handle, const char *path); /* * * brief Load a digital type of load for the event. CNcomment: 给故障事件装载事件类型的负荷。CNend * attention \n * NA. * param[in] handle event handle. CNcomment: 事件句柄。 CNend * param[in] key key. CNcomment: 负载的键。 CNend * param[in] value value. CNcomment: 负载的事件句柄。 CNend * retval ::SUCCESS success. CNcomment: 成功。 CNend * retval ::FAILURE failure. CNcomment: 失败。 CNend * see \n * NA. */ int dft_event_put_event(unsigned int handle, const char *key, unsigned int value); /* * * brief Load a digital type of load for the event. CNcomment: 给故障事件装载事件数组类型的负荷。CNend * attention \n * NA. * param[in] handle event handle. CNcomment: 事件句柄。 CNend * param[in] key key. CNcomment: 负载的键。 CNend * param[in] value value. CNcomment: 负载的句柄数组首地址。 CNend * param[in] length length. CNcomment: 负载的句柄数组长度。 CNend * retval ::SUCCESS success. CNcomment: 成功。 CNend * retval ::FAILURE failure. CNcomment: 失败。 CNend * see \n * NA. */ int dft_event_put_event_array(unsigned int handle, const char *key, const unsigned int *value, int length); /* * * brief Report a dft_event. CNcomment: 上报事件。CNend * attention \n * NA. * param[in] handle event handle. CNcomment: 事件句柄。 CNend * retval ::SUCCESS success. CNcomment: 成功。 CNend * retval ::FAILURE failure. CNcomment: 失败。 CNend * see \n * NA. */ int dft_event_report(unsigned int handle); /* * * brief print event info. CNcomment: 打印事件信息。CNend * attention \n * NA. * param[in] msg event info. CNcomment: 事件信息。 CNend * retval ::SUCCESS success. CNcomment: 成功。 CNend * retval ::FAILURE failure. CNcomment: 失败。 CNend * see \n * NA. */ int dft_event_print(const char *msg); #ifdef __cplusplus #if __cplusplus } #endif #endif #endif /* __DFT_EVENT_H__ */