89 lines
2.3 KiB
C
89 lines
2.3 KiB
C
#ifndef OMNI_KCP_SESSION_STATS_H
|
|
#define OMNI_KCP_SESSION_STATS_H
|
|
|
|
#include "omni_common.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define KCP_SESSION_STATS_RECORD_SESSION_SAMPLE "session_sample"
|
|
#define KCP_SESSION_STATS_RECORD_PROCESS_SAMPLE "process_snmp_sample"
|
|
|
|
typedef struct kcp_session_stats_record {
|
|
char record_type[32];
|
|
char node_role[OMNI_MAX_NODE_ROLE];
|
|
char node_id[OMNI_MAX_PEER_ID];
|
|
char local_addr[OMNI_MAX_ADDR_TEXT];
|
|
char remote_addr[OMNI_MAX_ADDR_TEXT];
|
|
int has_conv;
|
|
uint32_t conv;
|
|
int64_t ts_unix_nano;
|
|
char sample_reason[32];
|
|
int has_rto_ms;
|
|
uint32_t rto_ms;
|
|
int has_srtt_ms;
|
|
int32_t srtt_ms;
|
|
int has_srttvar_ms;
|
|
int32_t srttvar_ms;
|
|
int has_snd_wnd;
|
|
uint32_t snd_wnd;
|
|
int has_rmt_wnd;
|
|
uint32_t rmt_wnd;
|
|
int has_inflight;
|
|
uint32_t inflight;
|
|
int has_window_limit;
|
|
uint32_t window_limit;
|
|
int has_window_pressure_pct;
|
|
double window_pressure_pct;
|
|
int has_bytes_sent;
|
|
uint64_t bytes_sent;
|
|
int has_bytes_received;
|
|
uint64_t bytes_received;
|
|
int has_in_pkts;
|
|
uint64_t in_pkts;
|
|
int has_out_pkts;
|
|
uint64_t out_pkts;
|
|
int has_in_segs;
|
|
uint64_t in_segs;
|
|
int has_out_segs;
|
|
uint64_t out_segs;
|
|
int has_retrans_segs;
|
|
uint64_t retrans_segs;
|
|
int has_fast_retrans_segs;
|
|
uint64_t fast_retrans_segs;
|
|
int has_early_retrans_segs;
|
|
uint64_t early_retrans_segs;
|
|
int has_lost_segs;
|
|
uint64_t lost_segs;
|
|
int has_repeat_segs;
|
|
uint64_t repeat_segs;
|
|
int has_in_errs;
|
|
uint64_t in_errs;
|
|
int has_kcp_in_errs;
|
|
uint64_t kcp_in_errs;
|
|
int has_ring_buffer_snd_queue;
|
|
uint64_t ring_buffer_snd_queue;
|
|
int has_ring_buffer_rcv_queue;
|
|
uint64_t ring_buffer_rcv_queue;
|
|
int has_ring_buffer_snd_buffer;
|
|
uint64_t ring_buffer_snd_buffer;
|
|
int has_curr_estab;
|
|
uint64_t curr_estab;
|
|
} kcp_session_stats_record_t;
|
|
|
|
typedef struct kcp_session_stats_logger {
|
|
omni_file_logger_t file_logger;
|
|
int enabled;
|
|
} kcp_session_stats_logger_t;
|
|
|
|
kcp_session_stats_logger_t *kcp_session_stats_open_jsonl(const char *path);
|
|
void kcp_session_stats_close(kcp_session_stats_logger_t *logger);
|
|
int kcp_session_stats_log(kcp_session_stats_logger_t *logger, const kcp_session_stats_record_t *record);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|