del: 将go版本的内容删除,只保留处理日志功能

This commit is contained in:
2026-03-30 15:57:36 +08:00
parent 88ed9e2707
commit 24467c04c0
117 changed files with 142 additions and 13890 deletions

51
include/latencylog.h Normal file
View File

@@ -0,0 +1,51 @@
#ifndef OMNI_LATENCYLOG_H
#define OMNI_LATENCYLOG_H
#include "protocol.h"
#ifdef __cplusplus
extern "C" {
#endif
#define EVENT_A_APP_PREP_BEGIN "A_APP_PREP_BEGIN"
#define EVENT_A_TX_SCHED "A_TX_SCHED"
#define EVENT_A_TX_SOFTWARE "A_TX_SOFTWARE"
#define EVENT_A_TX_HARDWARE "A_TX_HARDWARE"
#define EVENT_B_RX_HARDWARE "B_RX_HARDWARE"
#define EVENT_B_RX_SOFTWARE "B_RX_SOFTWARE"
#define EVENT_B_APP_RECV "B_APP_RECV"
#define EVENT_B_PERSIST_BEGIN "B_PERSIST_BEGIN"
#define EVENT_B_PERSIST_END "B_PERSIST_END"
#define EVENT_SEND_HANDOFF_BEGIN "send_handoff_begin"
#define EVENT_SEND_HANDOFF_END "send_handoff_end"
typedef struct latency_event {
int64_t ts_unix_nano;
char node_role[OMNI_MAX_NODE_ROLE];
char node_id[OMNI_MAX_PEER_ID];
char event[OMNI_MAX_EVENT_NAME];
message_type_t message_type;
uint64_t message_id;
char from[OMNI_MAX_PEER_ID];
char to[OMNI_MAX_PEER_ID];
char file_name[OMNI_MAX_FILE_NAME];
int body_size;
} latency_event_t;
typedef struct latency_logger {
omni_file_logger_t file_logger;
int enabled;
} latency_logger_t;
latency_logger_t *latencylog_open_jsonl(const char *path);
void latencylog_close(latency_logger_t *logger);
int latencylog_log_event(latency_logger_t *logger, const latency_event_t *event);
int latencylog_is_business_message(const message_t *msg);
void latencylog_log_message_event(latency_logger_t *logger, const char *node_role, const char *node_id, const char *event_name, const message_t *msg);
void latencylog_log_message_event_at(latency_logger_t *logger, const char *node_role, const char *node_id, const char *event_name, int64_t ts_unix_nano, const message_t *msg);
#ifdef __cplusplus
}
#endif
#endif