enhance: session manager stat add tcp_segs_consumed

This commit is contained in:
luwenpeng
2024-08-21 16:33:00 +08:00
parent 114fc434b3
commit 3636406c91
6 changed files with 16 additions and 4 deletions

View File

@@ -430,6 +430,7 @@ static void stellar_thread_clean(struct stellar *st)
struct stellar_runtime *runtime = &st->runtime;
struct stellar_config *config = &st->config;
STELLAR_LOG_FATAL("cleaning worker thread context ...");
for (uint16_t i = 0; i < config->pkt_io_opts.nr_threads; i++)
{
struct stellar_thread *thread = &runtime->threads[i];
@@ -439,6 +440,7 @@ static void stellar_thread_clean(struct stellar *st)
ip_reassembly_free(thread->ip_mgr);
}
}
STELLAR_LOG_FATAL("worker thread context cleaned");
}
static int stellar_thread_run(struct stellar *st)
@@ -464,6 +466,7 @@ static void stellar_thread_join(struct stellar *st)
struct stellar_runtime *runtime = &st->runtime;
struct stellar_config *config = &st->config;
STELLAR_LOG_FATAL("waiting worker thread stop ...");
for (uint16_t i = 0; i < config->pkt_io_opts.nr_threads; i++)
{
struct stellar_thread *thread = &runtime->threads[i];
@@ -472,6 +475,7 @@ static void stellar_thread_join(struct stellar *st)
usleep(1000); // 1ms
}
}
STELLAR_LOG_FATAL("all worker thread stoped");
}
struct stellar *stellar_new(const char *stellar_cfg_file, const char *plugin_cfg_file, const char *log_cfg_file)

View File

@@ -109,6 +109,7 @@ enum METRIC_TYPE
// TCP segments
METRIC_TYPE_TCP_SEGS_INPUT,
METRIC_TYPE_TCP_SEGS_CONSUMED,
METRIC_TYPE_TCP_SEGS_TIMEOUT,
METRIC_TYPE_TCP_SEGS_RETRANSMITED,
METRIC_TYPE_TCP_SEGS_OVERLAPPED,
@@ -215,6 +216,7 @@ const char *name[] = {
// TCP segments
"tcp_segs_input",
"tcp_segs_consumed",
"tcp_segs_timeout",
"tcp_segs_retransmited",
"tcp_segs_overlapped",
@@ -522,6 +524,9 @@ void stellar_stat_output(struct stellar_stat *stat)
case METRIC_TYPE_TCP_SEGS_INPUT:
stat->metric_val[j] += thr_stat->session_mgr->tcp_segs_input;
break;
case METRIC_TYPE_TCP_SEGS_CONSUMED:
stat->metric_val[j] += thr_stat->session_mgr->tcp_segs_consumed;
break;
case METRIC_TYPE_TCP_SEGS_TIMEOUT:
stat->metric_val[j] += thr_stat->session_mgr->tcp_segs_timeout;
break;