diff options
| author | root <[email protected]> | 2024-07-10 03:04:14 +0000 |
|---|---|---|
| committer | root <[email protected]> | 2024-07-10 03:04:14 +0000 |
| commit | 5a259e650ff56cb70ddbc26ce962bb164bca9c1a (patch) | |
| tree | 0f061be53dbc4e2332c771672b5b5671999a089d | |
| parent | 23ddf75eaad60fd42693dbf6b9558806247dc519 (diff) | |
add bytehound toolsbytehound_memory_profiling
| -rw-r--r-- | deps/bytehound/bytehound.tar.gz | bin | 0 -> 51487906 bytes | |||
| -rw-r--r-- | shaping/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | shaping/src/main.cpp | 23 | ||||
| -rw-r--r-- | shaping/src/shaper.cpp | 4 |
4 files changed, 26 insertions, 4 deletions
diff --git a/deps/bytehound/bytehound.tar.gz b/deps/bytehound/bytehound.tar.gz Binary files differnew file mode 100644 index 0000000..a667ae6 --- /dev/null +++ b/deps/bytehound/bytehound.tar.gz diff --git a/shaping/CMakeLists.txt b/shaping/CMakeLists.txt index 19862eb..6c7923c 100644 --- a/shaping/CMakeLists.txt +++ b/shaping/CMakeLists.txt @@ -8,11 +8,12 @@ target_link_libraries(shaper PUBLIC fieldstat3) target_link_libraries(shaper PUBLIC pthread) target_include_directories(shaper PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include) target_include_directories(shaper PUBLIC ${PROJECT_SOURCE_DIR}/deps/timeout) +link_directories(shaper PUBLIC ${PROJECT_SOURCE_DIR}/deps/bytehound) add_executable(shaping_engine src/main.cpp) target_link_libraries(shaping_engine PUBLIC shaper) target_link_libraries(shaping_engine PUBLIC maatframe) target_link_libraries(shaping_engine PUBLIC mrzcpd) -target_link_libraries(shaping_engine PUBLIC libjemalloc-static dl) +target_link_libraries(shaping_engine PUBLIC dl bytehound) #libjemalloc-static dl) target_link_libraries(shaping_engine PUBLIC swarmkv) install(TARGETS shaping_engine RUNTIME DESTINATION bin COMPONENT Program) diff --git a/shaping/src/main.cpp b/shaping/src/main.cpp index 597230b..f2f0323 100644 --- a/shaping/src/main.cpp +++ b/shaping/src/main.cpp @@ -65,6 +65,26 @@ static void sig_handler(int signo) return; } +/*static void signal_nouse_handler(int signo) +{ + printf("%s, SIGNAL:%d recviced!\n", __FUNCTION__, signo); + + bool active = true; + int ret; + ret=mallctl("prof.dump", NULL, NULL, NULL, 0); + printf("mallctl prof.dump return %d\n", ret); + ret=mallctl("prof.active", NULL, NULL, &active, sizeof(bool)); + printf("mallctl prof.active:%d return %d\n", active, ret); + int prof_interval_s=10; + sleep(prof_interval_s); + active = false; + ret=mallctl("prof.active", NULL, NULL, &active, sizeof(bool)); + printf("mallctl prof.active:%d return %d\n", active, ret); + ret=mallctl("prof.dump", NULL, NULL, NULL, 0); + printf("mallctl prof.dump return %d\n", ret); + +}*/ + int main(int argc, char **argv) { struct shaping_ctx *ctx = NULL; @@ -88,6 +108,7 @@ int main(int argc, char **argv) LOG_CLOSE(); return -1; } + /*signal(SIGUSR1, signal_nouse_handler); bool flag = true; int ret = mallctl("background_thread", NULL, NULL, &flag, sizeof(flag)); @@ -95,7 +116,7 @@ int main(int argc, char **argv) LOG_ERROR("%s: mallctl(background_thread) failed, ret %d", LOG_TAG_SHAPING, ret); LOG_CLOSE(); return -1; - } + }*/ ctx = shaping_engine_init(); if (!ctx) { diff --git a/shaping/src/shaper.cpp b/shaping/src/shaper.cpp index 89e5d1b..f363435 100644 --- a/shaping/src/shaper.cpp +++ b/shaping/src/shaper.cpp @@ -643,7 +643,7 @@ static void shaper_token_get_from_profile(struct shaping_thread_ctx *ctx, struct struct shaping_profile_hash_node *pf_hash_node = pf_info->hash_node; char key[32] = {0}; - if (pf_hash_node->tconsume_ref_cnt > 0) { + if (pf_hash_node->tconsume_ref_cnt > 20) { return; } @@ -676,7 +676,7 @@ static void shaper_token_get_from_profile(struct shaping_thread_ctx *ctx, struct case PROFILE_TYPE_MAX_MIN_HOST_FAIRNESS: swarmkv_ftconsume(ctx->swarmkv_db, key, strlen(key), sf->src_ip_str, sf->src_ip_str_len, sf->matched_rule_infos[sf->anchor[dir]].fair_factor, req_token_bits, shaper_token_get_cb, arg); //TODO: ftconsume with flexiable - //swarmkv_async_command(ctx->swarmkv_db, shaper_token_get_cb, arg, "FTCONSUME %s %s %d %d %s", key, sf->src_ip_str, sf->matched_rule_infos[sf->anchor].fair_factor, req_token_bits, "FLEXIBLE"); + //swarmkv_async_command(ctx->swarmkv_db, shaper_token_get_cb, arg, "FTCONSUME %s %s %d %d %s", key, sf->src_ip_str, sf->matched_rule_infos[sf->anchor[dir]].fair_factor, req_token_bits, "FLEXIBLE"); break; case PROFILE_TYPE_SPLIT_BY_LOCAL_HOST: swarmkv_btconsume(ctx->swarmkv_db, key, strlen(key), sf->src_ip_str, sf->src_ip_str_len, req_token_bits * TOKEN_MULTIPLE_DEFAULT, shaper_token_get_cb, arg); |
