diff options
| author | 杨威 <[email protected]> | 2022-08-23 11:58:06 +0800 |
|---|---|---|
| committer | 杨威 <[email protected]> | 2022-08-23 11:58:28 +0800 |
| commit | f36ee772f63a0bfa0f33a73ce8d8b1060e620e90 (patch) | |
| tree | 0899d2a3bf20407cc0c31802354e6375ad419e6c | |
| parent | 0b9a9de64791f40b88931a298956d4da23497396 (diff) | |
✨ feat(sysinfo fs2): 输出每个线程TCP乱序数的histogramv4.2.89
| -rw-r--r-- | include/private/sapp_declaration.h | 1 | ||||
| -rw-r--r-- | include/private/sapp_global_val.h | 1 | ||||
| -rw-r--r-- | src/dealpkt/deal_tcp.c | 1 | ||||
| -rw-r--r-- | src/inner_plug/sapp_assistant.cpp | 80 |
4 files changed, 63 insertions, 20 deletions
diff --git a/include/private/sapp_declaration.h b/include/private/sapp_declaration.h index d0d71e4..617b5e8 100644 --- a/include/private/sapp_declaration.h +++ b/include/private/sapp_declaration.h @@ -101,6 +101,7 @@ void sapp_fs2_update_count(int field_index, unsigned long long value); void sapp_fs2_update_length(int field_index, unsigned long long value); void sapp_fs2_set_latency(int thead_seq, long long time_cost); void sapp_fs2_set_plug_entry_latency(int entry_id, long long time_cost); +void sapp_fs2_set_tcp_unorder_historgram(int thead_seq, long long unorder_num); int sapp_independent_thread_init(void); void sapp_gval_init(void); diff --git a/include/private/sapp_global_val.h b/include/private/sapp_global_val.h index 8dd481d..c6fc4e2 100644 --- a/include/private/sapp_global_val.h +++ b/include/private/sapp_global_val.h @@ -395,6 +395,7 @@ typedef struct{ int fs_id_length_array[SAPP_STAT_NUM_MAX]; int fs_latency_id_array[SAPP_MAX_THREADS]; int fs_latency_plug_entrg_id_array[SAPP_MAX_PLUG_ENTRY_NUM]; + int fs_tcp_unorder_id_array[SAPP_MAX_THREADS]; }sapp_gval_individual_fixed_fs_t; /* field stat info */ typedef struct{ diff --git a/src/dealpkt/deal_tcp.c b/src/dealpkt/deal_tcp.c index c986463..ea606ac 100644 --- a/src/dealpkt/deal_tcp.c +++ b/src/dealpkt/deal_tcp.c @@ -1174,6 +1174,7 @@ static void tcp_free_half(struct half_tcpstream *phalf,int threadnum) { struct buf_unorder *plist,*ptmp; plist = phalf->unorderlist; + sapp_fs2_set_tcp_unorder_historgram(threadnum, phalf->unorder_cnt); while (plist) { #if 0 diff --git a/src/inner_plug/sapp_assistant.cpp b/src/inner_plug/sapp_assistant.cpp index e3ba0e8..b6e2785 100644 --- a/src/inner_plug/sapp_assistant.cpp +++ b/src/inner_plug/sapp_assistant.cpp @@ -1075,6 +1075,41 @@ static int fs2_plug_entry_historgram_init(void *fs2_handle) return 0; } +void sapp_fs2_set_tcp_unorder_historgram(int thead_seq, long long unorder_num) +{ + if(sapp_global_val->individual_fixed.field_stat2_para.field_stat2_handle != NULL){ + FS_operate(sapp_global_val->individual_fixed.field_stat2_para.field_stat2_handle, + sapp_global_val->individual_fixed.field_stat2_para.fs_tcp_unorder_id_array[thead_seq], + 0, FS_OP_SET, unorder_num); + } +} + +static int fs2_tcp_unorder_historgram_init(void *fs2_handle) +{ + int i; + sapp_gval_individual_fixed_fs_t *pfs_para = &sapp_global_val->individual_fixed.field_stat2_para; + char histogram_name[16]; + /* 0������sapp���ò��, index��1��ʼ */ + for (i = 1; i < g_packet_io_thread_num; i++) + { + sprintf(histogram_name, "OoO_num(tid_%d)", i); + pfs_para->fs_tcp_unorder_id_array[i] = + FS_register_histogram(fs2_handle, // Field Stat��� + FS_CALC_SPEED, //����ۼ�ֵ��˲ʱֵ + histogram_name, //ͳ�������ƣ��ַ��� + 1, //���ٵ���Сֵ + 65536, //���ٵ����ֵ + 2); //���ȣ���С�����λ����Χ1~4 + if (pfs_para->fs_tcp_unorder_id_array[i] < 0) + { + sapp_runtime_log(RLOG_LV_FATAL, "FS_fs2_tcp_unorder_historgram_init() error, name:%s", + histogram_name); + return -1; + } + } + + return 0; +} /************************ C++ compiler **************************************/ static int sapp_fs2_init(void) @@ -1256,30 +1291,35 @@ static int sapp_fs2_init(void) pfs_para->fs_id_count_array[SAPP_STAT_UDP_OFFLOAD_PKTS] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Udp_Offload_Pkt"); pfs_para->fs_id_length_array[SAPP_STAT_UDP_OFFLOAD_BYTES] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Udp_Offload_Bit"); - - if(unlikely(g_timestamp_record_sw)) - { - for(int i = 0; i < g_packet_io_thread_num; i++) - { - char histogram_name[16]; - sprintf(histogram_name, "tid_%d(ns)", i); - pfs_para->fs_latency_id_array[i] = FS_register_histogram(fs2_handle, //Field Stat��� - FS_CALC_SPEED, //����ۼ�ֵ��˲ʱֵ - histogram_name, //ͳ�������ƣ��ַ��� - 1, //���ٵ���Сֵ - 1000000, //���ٵ����ֵ - 2); //���ȣ���С�����λ����Χ1~4 - if(send_historgram == 0) + if (fs2_tcp_unorder_historgram_init(fs2_handle) < 0) + { + return -1; + } + + if (unlikely(g_timestamp_record_sw)) + { + for (int i = 0; i < g_packet_io_thread_num; i++) + { + char histogram_name[16]; + sprintf(histogram_name, "TD_ns(tid_%d)", i); + pfs_para->fs_latency_id_array[i] = FS_register_histogram(fs2_handle, // Field Stat��� + FS_CALC_SPEED, //����ۼ�ֵ��˲ʱֵ + histogram_name, //ͳ�������ƣ��ַ��� + 1, //���ٵ���Сֵ + 1000000, //���ٵ����ֵ + 2); //���ȣ���С�����λ����Χ1~4 + if (send_historgram == 0) { FS_set_para(fs2_handle, NOT_SEND_METRIC_TO_SERVER, &pfs_para->fs_latency_id_array[i], sizeof(int)); } - } + } - if(fs2_plug_entry_historgram_init(fs2_handle) < 0){ - return -1; - } - } - FS_start(fs2_handle); + if (fs2_plug_entry_historgram_init(fs2_handle) < 0) + { + return -1; + } + } + FS_start(fs2_handle); return 0; } |
