summaryrefslogtreecommitdiff
path: root/src/http_decoder_stat.h
diff options
context:
space:
mode:
authorlijia <[email protected]>2024-06-06 11:16:22 +0800
committerlijia <[email protected]>2024-06-06 11:16:22 +0800
commit7d6170a23027aff0ebf2e7832dc11e4bbdce57ea (patch)
treeaf9caf24c274b561bc92f07f8db7c14b89c5e425 /src/http_decoder_stat.h
parent1c232f0176c43c93c3e787ac83f3573bf42c58f1 (diff)
add fieldstat4 statistics, push transaction free msg in session closing state.v2.0.3
Diffstat (limited to 'src/http_decoder_stat.h')
-rw-r--r--src/http_decoder_stat.h58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/http_decoder_stat.h b/src/http_decoder_stat.h
index dbf245f..235475d 100644
--- a/src/http_decoder_stat.h
+++ b/src/http_decoder_stat.h
@@ -1,5 +1,59 @@
#ifndef _HTTP_DECODER_STAT_H_
#define _HTTP_DECODER_STAT_H_ 1
-int http_decoder_stat_init(struct http_decoder_context *ctx, int thread_num);
-void http_decoder_stat_output(struct http_decoder_context *ctx, int thread_id);
+
+#include <fieldstat/fieldstat_easy.h>
+enum http_decoder_stat_type
+{
+ HTTPD_STAT_BYTES_C2S = 0,
+ HTTPD_STAT_BYTES_S2C,
+ HTTPD_STAT_TCP_SEG_C2S,
+ HTTPD_STAT_TCP_SEG_S2C,
+ HTTPD_STAT_HEADERS_C2S,
+ HTTPD_STAT_HEADERS_S2C,
+ HTTPD_STAT_URL_BYTES,
+ HTTPD_STAT_SESSION_NEW,
+ HTTPD_STAT_SESSION_FREE,
+ HTTPD_STAT_SESSION_EXCEPTION, // rst, kickout, lost packet, etc.
+ HTTPD_STAT_TRANSACTION_NEW,
+ HTTPD_STAT_TRANSACTION_FREE,
+ HTTPD_STAT_ASYMMETRY_SESSION_C2S,
+ HTTPD_STAT_ASYMMETRY_SESSION_S2C,
+ HTTPD_STAT_ASYMMETRY_TRANSACTION_C2S,
+ HTTPD_STAT_ASYMMETRY_TRANSACTION_S2C,
+ HTTPD_STAT_PARSE_ERR,
+ HTTPD_STAT_MAX,
+};
+
+struct hd_stat_config_tuple
+{
+ enum http_decoder_stat_type type;
+ const char *name;
+};
+
+struct hd_statistics
+{
+ // long long incoming_bytes;
+ // long long incoming_tcp_seg;
+ // long long session_new;
+ // long long session_free;
+ // long long transaction_new;
+ // long long transaction_free;
+ // long long incoming_trans;
+ // long long err_pkts;
+
+ long long counter[HTTPD_STAT_MAX];
+ int batch; //call fieldstat_easy_counter_incrby() per batch
+}__attribute__ ((aligned (64)));
+
+struct http_decoder_stat
+{
+ struct fieldstat_easy *fse;
+ int stat_interval_pkts; // call fieldstat_incrby every stat_interval_pkts
+ int field_stat_id[HTTPD_STAT_MAX];
+ struct hd_statistics *stats; //multi thread
+};
+
+int http_decoder_stat_init(struct http_decoder_stat *hd_stat, int thread_max, int stat_interval_pkts, int stat_interval_time);
+void http_decoder_stat_free(struct http_decoder_stat *hd_stat);
+void http_decoder_stat_update(struct http_decoder_stat *hd_stat, int thread_id, enum http_decoder_stat_type type, long long value);
#endif \ No newline at end of file