diff options
| -rw-r--r-- | CMakeLists.txt | 4 | ||||
| -rw-r--r-- | ci/travis.sh | 2 | ||||
| -rw-r--r-- | common/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | shaping/src/shaper.cpp | 35 | ||||
| -rw-r--r-- | shaping/test/gtest_shaper.cpp | 2 |
5 files changed, 40 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e8f403..684e108 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,8 +67,8 @@ add_library(MESA_prof_load SHARED IMPORTED GLOBAL) set_property(TARGET MESA_prof_load PROPERTY IMPORTED_LOCATION ${MESA_FRAMEWORK_LIB_DIR}/libMESA_prof_load.so) set_property(TARGET MESA_prof_load PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${MESA_FRAMEWORK_INCLUDE_DIR}) -set(MRZCPD_LIB_DIR /opt/mrzcpd/lib) -set(MRZCPD_INCLUDE_DIR /opt/mrzcpd/include) +set(MRZCPD_LIB_DIR /opt/tsg/mrzcpd/lib) +set(MRZCPD_INCLUDE_DIR /opt/tsg/mrzcpd/include) add_library(mrzcpd SHARED IMPORTED GLOBAL) set_property(TARGET mrzcpd PROPERTY IMPORTED_LOCATION ${MRZCPD_LIB_DIR}/libmarsio.so) diff --git a/ci/travis.sh b/ci/travis.sh index 695b014..a8b7553 100644 --- a/ci/travis.sh +++ b/ci/travis.sh @@ -37,7 +37,7 @@ yum install -y libasan yum install -y systemd-devel yum install -y tsg_master-devel yum install -y framework_env -yum install -y mrzcpd +yum install -y mrzcpd-corei7 yum install -y libfieldstat3-devel yum install -y libmaatframe-devel yum install -y libswarmkv-devel diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 3a39583..622884b 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -1,7 +1,7 @@ add_library(common src/log.cpp src/session_table.cpp src/utils.cpp src/addr_tuple4.cpp src/raw_packet.cpp src/mpack.c) target_link_libraries(common PUBLIC MESA_handle_logger) -#target_link_libraries(common PUBLIC mrzcpd) +target_link_libraries(common PUBLIC mrzcpd) target_include_directories(common PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include) add_subdirectory(libavl) diff --git a/shaping/src/shaper.cpp b/shaping/src/shaper.cpp index 9000bac..3ef35c1 100644 --- a/shaping/src/shaper.cpp +++ b/shaping/src/shaper.cpp @@ -1308,6 +1308,40 @@ static struct shaping_flow *shaper_raw_pkt_session_handle(struct shaping_thread_ return sf; } +static void shaper_datapath_telemetry_info_append(struct shaping_marsio_info *marsio_info, marsio_buff_t *buff, struct shaping_flow *sf) +{ + char datapath_telemetry_str[512] = {0}; + struct shaping_rule_info *rule = NULL; + int len = 0; + + if (marsio_dp_trace_measurements_can_emit(marsio_info->instance, buff, DP_TRACE_MEASUREMENT_TYPE_TELEMETRY)) { + len += snprintf(datapath_telemetry_str + len, sizeof(datapath_telemetry_str) - len, "shaping:"); + + for (int i= 0; i < sf->rule_num; i++) { + rule = &sf->matched_rule_infos[i]; + + len += snprintf(datapath_telemetry_str + len, sizeof(datapath_telemetry_str) - len, "rule_id=%d, primary_pf_id=%d", rule->id, rule->primary.id); + + if (rule->borrowing_num > 0) { + len += snprintf(datapath_telemetry_str + len, sizeof(datapath_telemetry_str) - len, ", borrow_pf_ids:["); + } + for (int j = 0; j < rule->borrowing_num; j++) { + if (j != 0) { + len += snprintf(datapath_telemetry_str + len, sizeof(datapath_telemetry_str) - len, ","); + } + len += snprintf(datapath_telemetry_str + len, sizeof(datapath_telemetry_str) - len, "%d", rule->borrowing[j].id); + } + if (rule->borrowing_num > 0) { + len += snprintf(datapath_telemetry_str + len, sizeof(datapath_telemetry_str) - len, "]"); + } + len += snprintf(datapath_telemetry_str + len, sizeof(datapath_telemetry_str) - len, ";"); + } + + marsio_dp_trace_measurement_emit_str(marsio_info->instance, buff, DP_TRACE_MEASUREMENT_TYPE_TELEMETRY, "shaping", datapath_telemetry_str); + } + return; +} + void shaper_packet_recv_and_process(struct shaping_thread_ctx *ctx) { marsio_buff_t *rx_buff[SHAPER_MARSIO_RX_BRUST_MAX]; @@ -1333,6 +1367,7 @@ void shaper_packet_recv_and_process(struct shaping_thread_ctx *ctx) marsio_send_burst(ctx->marsio_info->mr_path, ctx->thread_index, &rx_buff[i], 1); shaper_global_stat_throughput_tx_inc(&ctx->thread_global_stat, meta.raw_len); } else { + shaper_datapath_telemetry_info_append(ctx->marsio_info, rx_buff[i], sf); shaping_packet_process(ctx, rx_buff[i], &meta, sf); } diff --git a/shaping/test/gtest_shaper.cpp b/shaping/test/gtest_shaper.cpp index fe322b6..c0a0711 100644 --- a/shaping/test/gtest_shaper.cpp +++ b/shaping/test/gtest_shaper.cpp @@ -429,7 +429,7 @@ TEST(max_min_host_fairness_profile, udp_tx_in_order) stat_file = fopen(SHAPING_STAT_FILE_NAME, "r"); memset(line, 0, sizeof(line)); ASSERT_TRUE(NULL != fgets(line, sizeof(line), stat_file)); - shaping_stat_judge(line, 0, 0, 1, 100, 10000, 0, 0, 171000, SHAPING_DIR_OUT, profile_type_primary);//max latency is last 10 pkts + shaping_stat_judge(line, 0, 0, 1, 100, 10000, 0, 0, 180000, SHAPING_DIR_OUT, profile_type_primary);//max latency is last 10 pkts fclose(stat_file); stat_file = fopen(SHAPING_STAT_FILE_NAME, "w");//clear stat file fclose(stat_file); |
