summaryrefslogtreecommitdiff
path: root/shaping/test/stub.cpp
diff options
context:
space:
mode:
author刘畅 <[email protected]>2023-11-09 07:39:58 +0000
committer刘畅 <[email protected]>2023-11-09 07:39:58 +0000
commitf1c9565d486fe9a278996a3cfd8be6f77cf7a977 (patch)
tree0dff7a2c4a4f41ed2ddb0090dc52b2ede60c27fa /shaping/test/stub.cpp
parent3e0e8c399905c65cd9638907f5d5e245f2c50a9a (diff)
parent0e780765553bbcf62fa604add488cca48d49ea03 (diff)
Merge branch 'optimize_performance' into 'rel'v1.3.7
性能优化 See merge request tango/shaping-engine!50
Diffstat (limited to 'shaping/test/stub.cpp')
-rw-r--r--shaping/test/stub.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/shaping/test/stub.cpp b/shaping/test/stub.cpp
index 25d4550..db7ce23 100644
--- a/shaping/test/stub.cpp
+++ b/shaping/test/stub.cpp
@@ -50,7 +50,8 @@ struct stub_matched_rules matched_rules;
struct shaping_profile pf_array[MAX_STUB_PROFILE_NUM];
static int profile_priority_len[MAX_STUB_PROFILE_NUM][10] = {{0}};
-static unsigned long long curr_time = 2000000000;//2s
+static unsigned long long curr_time_ns = 2000000000;//2s
+static unsigned int curr_time_s = 0;
void * stub_get_token_thread_func(void *data)
{
@@ -151,16 +152,23 @@ struct stub_pkt_queue* stub_get_tx_queue()
return &tx_queue;
}
-void stub_curr_time_inc(unsigned long long time_ns)
+void stub_curr_time_ns_inc(unsigned long long time_ns)
{
- curr_time += time_ns;
+ curr_time_ns += time_ns;
return;
}
-unsigned long long stub_curr_time_get()
+void stub_curr_time_s_inc(int time_s)
{
- return curr_time;
+ curr_time_s += time_s;
+
+ return;
+}
+
+unsigned long long stub_curr_time_ns_get()
+{
+ return curr_time_ns;
}
void stub_init()
@@ -193,8 +201,8 @@ void stub_init()
int clock_gettime (clockid_t __clock_id, struct timespec *__tp)
{
- __tp->tv_sec = 0;
- __tp->tv_nsec = curr_time;
+ __tp->tv_sec = curr_time_s;
+ __tp->tv_nsec = curr_time_ns;
return 0;
}
@@ -262,6 +270,11 @@ struct swarmkv *swarmkv_open(struct swarmkv_options *opts, const char * cluster_
return db;
}
+long long swarmkv_caller_get_pending_commands(struct swarmkv *db)
+{
+ return 0;
+}
+
int swarmkv_options_set_log_path(struct swarmkv_options *opts, const char *logpath)
{
return 0;