增加连接层的性能统计

This commit is contained in:
Lu Qiuwen
2018-11-02 13:52:30 +08:00
parent 2e13728bfc
commit b3b65369d8
6 changed files with 152 additions and 92 deletions

View File

@@ -7,9 +7,26 @@
struct ssl_mgr;
struct key_keeper;
struct kni_acceptor;
enum TFE_STAT_FIELD
{
{
STAT_SIGPIPE,
/* FDs */
STAT_FD_OPEN_BY_KNI_ACCEPT,
STAT_FD_CLOSE_BY_KNI_ACCEPT_FAIL,
STAT_FD_CLOSE_BY_EVENT_WRITE,
STAT_FD_CLOSE_BY_EVENT_EOF,
STAT_FD_CLOSE_BY_EVENT_ERROR,
/* FDs */
STAT_FD_INSTANT_CLOSE,
STAT_FD_DEFER_CLOSE_IN_QUEUE,
STAT_FD_DEFER_CLOSE_SUCCESS,
/* Stream */
STAT_STREAM_CREATE,
STAT_STREAM_DESTROY,
/* Stream Protocol */
STAT_STREAM_TCP_PLAIN,
STAT_STREAM_TCP_SSL,
TFE_STAT_MAX
};
@@ -65,10 +82,12 @@ struct tfe_proxy
/* PERFOMANCE MONIOTR VARIABLES*/
long long stat_val[TFE_STAT_MAX];
int fs_id[TFE_STAT_MAX];
};
extern struct tfe_proxy * g_default_proxy;
#define TFE_PROXY_STAT_INCREASE(field, val) \
do { __atomic_fetch_add(&g_default_proxy->stat_val[field], val, __ATOMIC_RELAXED); } while(0)
struct tfe_thread_ctx * tfe_proxy_thread_ctx_acquire(struct tfe_proxy * ctx);
void tfe_proxy_thread_ctx_release(struct tfe_thread_ctx * thread_ctx);
@@ -76,4 +95,3 @@ void tfe_proxy_thread_ctx_release(struct tfe_thread_ctx * thread_ctx);
struct tfe_proxy * tfe_proxy_new(const char * profile);
int tfe_proxy_fds_accept(struct tfe_proxy * ctx, const struct tfe_proxy_accept_para * para);
void tfe_proxy_run(struct tfe_proxy * proxy);