enhance: session manager stat add tcp_segs_consumed
This commit is contained in:
@@ -15,9 +15,9 @@ cpu_mask = [5, 6, 7, 8, 9, 10, 11, 12]
|
|||||||
|
|
||||||
[ip_reassembly]
|
[ip_reassembly]
|
||||||
enable = 1
|
enable = 1
|
||||||
timeout = 10000 # range: [1, 60000] (ms)
|
timeout = 10000 # range: [1, 60000] (ms)
|
||||||
bucket_entries = 256 # range: [1, 4294967295] (must be power of 2)
|
bucket_entries = 32 # range: [1, 4294967295] (must be power of 2)
|
||||||
bucket_num = 4096 # range: [1, 4294967295]
|
bucket_num = 1024 # range: [1, 4294967295]
|
||||||
|
|
||||||
[session_manager]
|
[session_manager]
|
||||||
# max session number
|
# max session number
|
||||||
|
|||||||
@@ -430,6 +430,7 @@ static void stellar_thread_clean(struct stellar *st)
|
|||||||
struct stellar_runtime *runtime = &st->runtime;
|
struct stellar_runtime *runtime = &st->runtime;
|
||||||
struct stellar_config *config = &st->config;
|
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++)
|
for (uint16_t i = 0; i < config->pkt_io_opts.nr_threads; i++)
|
||||||
{
|
{
|
||||||
struct stellar_thread *thread = &runtime->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);
|
ip_reassembly_free(thread->ip_mgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
STELLAR_LOG_FATAL("worker thread context cleaned");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stellar_thread_run(struct stellar *st)
|
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_runtime *runtime = &st->runtime;
|
||||||
struct stellar_config *config = &st->config;
|
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++)
|
for (uint16_t i = 0; i < config->pkt_io_opts.nr_threads; i++)
|
||||||
{
|
{
|
||||||
struct stellar_thread *thread = &runtime->threads[i];
|
struct stellar_thread *thread = &runtime->threads[i];
|
||||||
@@ -472,6 +475,7 @@ static void stellar_thread_join(struct stellar *st)
|
|||||||
usleep(1000); // 1ms
|
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)
|
struct stellar *stellar_new(const char *stellar_cfg_file, const char *plugin_cfg_file, const char *log_cfg_file)
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ enum METRIC_TYPE
|
|||||||
|
|
||||||
// TCP segments
|
// TCP segments
|
||||||
METRIC_TYPE_TCP_SEGS_INPUT,
|
METRIC_TYPE_TCP_SEGS_INPUT,
|
||||||
|
METRIC_TYPE_TCP_SEGS_CONSUMED,
|
||||||
METRIC_TYPE_TCP_SEGS_TIMEOUT,
|
METRIC_TYPE_TCP_SEGS_TIMEOUT,
|
||||||
METRIC_TYPE_TCP_SEGS_RETRANSMITED,
|
METRIC_TYPE_TCP_SEGS_RETRANSMITED,
|
||||||
METRIC_TYPE_TCP_SEGS_OVERLAPPED,
|
METRIC_TYPE_TCP_SEGS_OVERLAPPED,
|
||||||
@@ -215,6 +216,7 @@ const char *name[] = {
|
|||||||
|
|
||||||
// TCP segments
|
// TCP segments
|
||||||
"tcp_segs_input",
|
"tcp_segs_input",
|
||||||
|
"tcp_segs_consumed",
|
||||||
"tcp_segs_timeout",
|
"tcp_segs_timeout",
|
||||||
"tcp_segs_retransmited",
|
"tcp_segs_retransmited",
|
||||||
"tcp_segs_overlapped",
|
"tcp_segs_overlapped",
|
||||||
@@ -522,6 +524,9 @@ void stellar_stat_output(struct stellar_stat *stat)
|
|||||||
case METRIC_TYPE_TCP_SEGS_INPUT:
|
case METRIC_TYPE_TCP_SEGS_INPUT:
|
||||||
stat->metric_val[j] += thr_stat->session_mgr->tcp_segs_input;
|
stat->metric_val[j] += thr_stat->session_mgr->tcp_segs_input;
|
||||||
break;
|
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:
|
case METRIC_TYPE_TCP_SEGS_TIMEOUT:
|
||||||
stat->metric_val[j] += thr_stat->session_mgr->tcp_segs_timeout;
|
stat->metric_val[j] += thr_stat->session_mgr->tcp_segs_timeout;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ struct tcp_segment *session_get_tcp_segment(struct session *sess)
|
|||||||
|
|
||||||
if (half->in_order.data != NULL && half->in_order.len > 0 && half->in_order_ref == 0)
|
if (half->in_order.data != NULL && half->in_order.len > 0 && half->in_order_ref == 0)
|
||||||
{
|
{
|
||||||
|
sess->mgr_stat->tcp_segs_consumed++;
|
||||||
half->in_order_ref++;
|
half->in_order_ref++;
|
||||||
return &half->in_order;
|
return &half->in_order;
|
||||||
}
|
}
|
||||||
@@ -218,6 +219,7 @@ struct tcp_segment *session_get_tcp_segment(struct session *sess)
|
|||||||
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_REORDERED, seg->len);
|
session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_REORDERED, seg->len);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
sess->mgr_stat->tcp_segs_consumed++;
|
||||||
sess->mgr_stat->tcp_segs_reordered++;
|
sess->mgr_stat->tcp_segs_reordered++;
|
||||||
}
|
}
|
||||||
return seg;
|
return seg;
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ struct session_manager_stat
|
|||||||
|
|
||||||
// TCP segments
|
// TCP segments
|
||||||
uint64_t tcp_segs_input; // sum
|
uint64_t tcp_segs_input; // sum
|
||||||
|
uint64_t tcp_segs_consumed; // sum
|
||||||
uint64_t tcp_segs_timeout; // sum
|
uint64_t tcp_segs_timeout; // sum
|
||||||
uint64_t tcp_segs_retransmited; // sum
|
uint64_t tcp_segs_retransmited; // sum
|
||||||
uint64_t tcp_segs_overlapped; // sum
|
uint64_t tcp_segs_overlapped; // sum
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ cpu_mask = [5]
|
|||||||
enable = 1
|
enable = 1
|
||||||
timeout = 10000 # range: [1, 60000] (ms)
|
timeout = 10000 # range: [1, 60000] (ms)
|
||||||
bucket_entries = 8 # range: [1, 4294967295] (must be power of 2)
|
bucket_entries = 8 # range: [1, 4294967295] (must be power of 2)
|
||||||
bucket_num = 4096 # range: [1, 4294967295]
|
bucket_num = 1024 # range: [1, 4294967295]
|
||||||
|
|
||||||
[session_manager]
|
[session_manager]
|
||||||
# max session number
|
# max session number
|
||||||
|
|||||||
Reference in New Issue
Block a user