summaryrefslogtreecommitdiff
path: root/shaping/include/shaper.h
diff options
context:
space:
mode:
Diffstat (limited to 'shaping/include/shaper.h')
-rw-r--r--shaping/include/shaper.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/shaping/include/shaper.h b/shaping/include/shaper.h
index 7821459..a218884 100644
--- a/shaping/include/shaper.h
+++ b/shaping/include/shaper.h
@@ -6,6 +6,9 @@
#include "session_table.h"
#include "utils.h"
#include "shaper_stat.h"
+extern "C" {
+#include "timeout.h"
+}
#define SHAPING_DIR_IN 0x1
#define SHAPING_DIR_OUT 0x2
@@ -22,6 +25,9 @@
#define SHAPING_WROK_THREAD_NUM_MAX 128
+#define SHAPING_STAT_REFRESH_INTERVAL_SEC 2
+#define SHAPING_STAT_REFRESH_MAX_PER_POLLING 5
+
#define SHAPING_GLOBAL_CONF_FILE "./conf/shaping.conf"
struct shaping_system_conf {
@@ -46,6 +52,8 @@ struct shaping_thread_ctx {
struct swarmkv *swarmkv_db;//handle of swarmkv
struct shaping_maat_info *maat_info;
struct session_table *session_table;
+ struct timeouts *expires;
+ time_t last_update_timeout_sec;
int session_need_reset;
struct shaping_system_conf conf;
};
@@ -84,9 +92,8 @@ struct shaping_profile_info {
int priority;
int in_deposit_token;
int out_deposit_token;
- int async_token_ref_count;
- int async_queue_len_ref_count;
unsigned long long enqueue_time_us;//to calculate max latency
+ unsigned long long last_failed_get_token_ms;
unsigned char is_priority_blocked;
unsigned char is_invalid;
struct shaping_stat_for_profile stat;
@@ -142,6 +149,8 @@ struct shaping_flow {
unsigned long long processed_pkts;
struct timespec stat_update_time;
time_t check_rule_time;
+ struct timeout timeout_handle;
+ time_t last_update_timeout_sec;
};
struct shaper_flow_instance {
@@ -151,7 +160,7 @@ struct shaper_flow_instance {
struct shaper;//instance of shaping, thread unsafe
-struct shaping_flow* shaping_flow_new();
+struct shaping_flow* shaping_flow_new(struct shaping_thread_ctx *ctx);
void shaping_flow_free(struct shaping_thread_ctx *ctx, struct shaping_flow *sf);
struct shaper* shaper_new(unsigned int priority_queue_len_max);
void shaper_free(struct shaper *sp);