session manager stat metric rename

This commit is contained in:
luwenpeng
2024-08-16 18:41:02 +08:00
parent b77c8e6ba1
commit d1df1bb18b
14 changed files with 370 additions and 370 deletions

View File

@@ -46,52 +46,52 @@ struct session_manager
* Session Manager Stat
******************************************************************************/
#define SESS_MGR_STAT_INC(stat, state, proto) \
{ \
switch ((state)) \
{ \
case SESSION_STATE_OPENING: \
(stat)->curr_##proto##_sess_opening++; \
break; \
case SESSION_STATE_ACTIVE: \
(stat)->curr_##proto##_sess_active++; \
break; \
case SESSION_STATE_CLOSING: \
(stat)->curr_##proto##_sess_closing++; \
break; \
case SESSION_STATE_DISCARD: \
(stat)->curr_##proto##_sess_discard++; \
break; \
case SESSION_STATE_CLOSED: \
(stat)->curr_##proto##_sess_closed++; \
break; \
default: \
break; \
} \
#define SESS_MGR_STAT_INC(stat, state, proto) \
{ \
switch ((state)) \
{ \
case SESSION_STATE_OPENING: \
(stat)->proto##_sess_opening++; \
break; \
case SESSION_STATE_ACTIVE: \
(stat)->proto##_sess_active++; \
break; \
case SESSION_STATE_CLOSING: \
(stat)->proto##_sess_closing++; \
break; \
case SESSION_STATE_DISCARD: \
(stat)->proto##_sess_discard++; \
break; \
case SESSION_STATE_CLOSED: \
(stat)->proto##_sess_closed++; \
break; \
default: \
break; \
} \
}
#define SESS_MGR_STAT_DEC(stat, state, proto) \
{ \
switch ((state)) \
{ \
case SESSION_STATE_OPENING: \
(stat)->curr_##proto##_sess_opening--; \
break; \
case SESSION_STATE_ACTIVE: \
(stat)->curr_##proto##_sess_active--; \
break; \
case SESSION_STATE_CLOSING: \
(stat)->curr_##proto##_sess_closing--; \
break; \
case SESSION_STATE_DISCARD: \
(stat)->curr_##proto##_sess_discard--; \
break; \
case SESSION_STATE_CLOSED: \
(stat)->curr_##proto##_sess_closed--; \
break; \
default: \
break; \
} \
#define SESS_MGR_STAT_DEC(stat, state, proto) \
{ \
switch ((state)) \
{ \
case SESSION_STATE_OPENING: \
(stat)->proto##_sess_opening--; \
break; \
case SESSION_STATE_ACTIVE: \
(stat)->proto##_sess_active--; \
break; \
case SESSION_STATE_CLOSING: \
(stat)->proto##_sess_closing--; \
break; \
case SESSION_STATE_DISCARD: \
(stat)->proto##_sess_discard--; \
break; \
case SESSION_STATE_CLOSED: \
(stat)->proto##_sess_closed--; \
break; \
default: \
break; \
} \
}
#define SESS_MGR_STAT_UPDATE(stat, curr, next, proto) \
@@ -456,7 +456,7 @@ static enum flow_direction identify_direction_by_history(const struct session *s
// on new session
static int tcp_overload_bypass(struct session_manager *mgr, const struct tuple6 *key)
{
if (key->ip_proto == IPPROTO_TCP && mgr->stat.curr_tcp_sess_used >= mgr->opts.max_tcp_session_num)
if (key->ip_proto == IPPROTO_TCP && mgr->stat.tcp_sess_used >= mgr->opts.max_tcp_session_num)
{
mgr->stat.tcp_pkts_bypass_table_full++;
return 1;
@@ -466,7 +466,7 @@ static int tcp_overload_bypass(struct session_manager *mgr, const struct tuple6
static int udp_overload_bypass(struct session_manager *mgr, const struct tuple6 *key)
{
if (key->ip_proto == IPPROTO_UDP && mgr->stat.curr_udp_sess_used >= mgr->opts.max_udp_session_num)
if (key->ip_proto == IPPROTO_UDP && mgr->stat.udp_sess_used >= mgr->opts.max_udp_session_num)
{
mgr->stat.udp_pkts_bypass_table_full++;
return 1;
@@ -691,7 +691,7 @@ static struct session *session_manager_new_tcp_session(struct session_manager *m
}
// tcp table full evict old session
if (mgr->opts.tcp_overload_evict_old_sess && mgr->stat.curr_tcp_sess_used >= mgr->opts.max_tcp_session_num - EVICTE_SESSION_BURST)
if (mgr->opts.tcp_overload_evict_old_sess && mgr->stat.tcp_sess_used >= mgr->opts.max_tcp_session_num - EVICTE_SESSION_BURST)
{
struct session *evic_sess = session_table_find_lru(mgr->tcp_sess_table);
session_manager_evicte_session(mgr, evic_sess, LRU_EVICT);
@@ -730,8 +730,8 @@ static struct session *session_manager_new_tcp_session(struct session_manager *m
}
SESS_MGR_STAT_INC(&mgr->stat, next_state, tcp);
mgr->stat.curr_tcp_sess_used++;
mgr->stat.total_tcp_sess_used++;
mgr->stat.tcp_sess_used++;
mgr->stat.history_tcp_sessions++;
return sess;
}
@@ -739,7 +739,7 @@ static struct session *session_manager_new_tcp_session(struct session_manager *m
static struct session *session_manager_new_udp_session(struct session_manager *mgr, const struct packet *pkt, const struct tuple6 *key)
{
// udp table full evict old session
if (mgr->opts.udp_overload_evict_old_sess && mgr->stat.curr_udp_sess_used >= mgr->opts.max_udp_session_num - EVICTE_SESSION_BURST)
if (mgr->opts.udp_overload_evict_old_sess && mgr->stat.udp_sess_used >= mgr->opts.max_udp_session_num - EVICTE_SESSION_BURST)
{
struct session *evic_sess = session_table_find_lru(mgr->udp_sess_table);
session_manager_evicte_session(mgr, evic_sess, LRU_EVICT);
@@ -764,8 +764,8 @@ static struct session *session_manager_new_udp_session(struct session_manager *m
session_table_add(mgr->udp_sess_table, sess);
SESS_MGR_STAT_INC(&mgr->stat, next_state, udp);
mgr->stat.curr_udp_sess_used++;
mgr->stat.total_udp_sess_used++;
mgr->stat.udp_sess_used++;
mgr->stat.history_udp_sessions++;
return sess;
}
@@ -1030,7 +1030,7 @@ void session_manager_free_session(struct session_manager *mgr, struct session *s
session_table_del(mgr->tcp_sess_table, sess);
}
SESS_MGR_STAT_DEC(&mgr->stat, session_get_current_state(sess), tcp);
mgr->stat.curr_tcp_sess_used--;
mgr->stat.tcp_sess_used--;
break;
case SESSION_TYPE_UDP:
if (session_table_find_sessid(mgr->udp_sess_table, session_get_id(sess), 0) == sess)
@@ -1038,7 +1038,7 @@ void session_manager_free_session(struct session_manager *mgr, struct session *s
session_table_del(mgr->udp_sess_table, sess);
}
SESS_MGR_STAT_DEC(&mgr->stat, session_get_current_state(sess), udp);
mgr->stat.curr_udp_sess_used--;
mgr->stat.udp_sess_used--;
break;
default:
assert(0);