summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authoryangwei <[email protected]>2023-08-06 01:02:40 +0800
committeryangwei <[email protected]>2023-08-06 18:11:03 +0800
commit01ec05ddb201c685c7038973ac4a74a53ee10e47 (patch)
tree4a184838b659b312f777833f0dca00f067e4f07b /include
parent738415d84e1196e09d7ddcdd1abede6a4e7a5168 (diff)
🦄 refactor(packet process latency): process_latency threshold use ms
1、统计包处理延迟,在未开启histogram_enabled时,使用自带的ms计时器判断,精度为ms,仅在开启histogram_enabled后启用clock_gettime使用ns精度计时器 2、移除toml中的enabled_log_level设置,使用MESA_handle_runtime_log_level_enabled接口实时判断当前的log_level
Diffstat (limited to 'include')
-rw-r--r--include/private/sapp_declaration.h18
-rw-r--r--include/private/sapp_global_val.h5
2 files changed, 15 insertions, 8 deletions
diff --git a/include/private/sapp_declaration.h b/include/private/sapp_declaration.h
index 3ec9189..360efa7 100644
--- a/include/private/sapp_declaration.h
+++ b/include/private/sapp_declaration.h
@@ -23,7 +23,6 @@ extern volatile long long g_current_time_ms;
/* ��Ƕ�ײ��̫��, ʹ�ü������ */
-#define ABBR_SAPP_LOG_LEVEL sapp_global_val->config.profiling.log.enabled_log_level
#define ABBR_SAPP_LOG_HANDLE sapp_global_val->individual_fixed.log_handle
#define ABBR_SAPP_PLUGIN_LOG_HANDLE sapp_global_val->individual_fixed.plugin_log_handle
@@ -84,9 +83,10 @@ extern volatile long long g_current_time_ms;
#define g_packet_io_cap_mode sapp_global_val->config.packet_io.internal.interface.type_bin
#define g_packet_io_cap_level sapp_global_val->individual_fixed.packet_io_cap_level
//#define g_timestamp_record_sw MESA_handle_runtime_log_level_enabled(ABBR_PROCESS_LATENCY_LOG_HANDLE, sapp_global_val->config.profiling.process_latency_enabled_log_level)
-#define g_timestamp_record_sw sapp_global_val->config.profiling.process_latency_enabled_log_level>20
-#define g_timestamp_record_threshold sapp_global_val->config.profiling.process_latency_threshold_in_ns
+//#define g_timestamp_record_sw sapp_global_val->config.profiling.process_latency_enabled_log_level>20
+
+#define g_timestamp_record_threshold sapp_global_val->config.profiling.process_latency_threshold_in_ms
#define g_discard_ack_sw sapp_global_val->config.protocol_feature.tcp_drop_pure_ack_pkt
#define g_tcp_syn_option_parse_enabled sapp_global_val->config.protocol_feature.tcp_syn_option_parse_enabled
@@ -94,8 +94,6 @@ extern volatile long long g_current_time_ms;
#define g_ipv6_send_packet_enabled sapp_global_val->config.protocol_feature.ipv6_send_packet_enabled
#define G_SKIP_NOT_IP_LAYER sapp_global_val->config.protocol_feature.skip_not_ip_layer_over_eth
-//#define sapp_runtime_log(log_level, format, args...) do{if(log_level>=ABBR_SAPP_LOG_LEVEL){MESA_handle_runtime_log(ABBR_SAPP_LOG_HANDLE, log_level, "sapp", format, ##args);}}while(0)
-
#define sapp_runtime_log(log_level, format, ...) \
do \
{ \
@@ -106,6 +104,16 @@ do
} \
} while (0)
+#define sapp_process_latency_log(log_level, format, ...) \
+do \
+{ \
+ if (MESA_handle_runtime_log_level_enabled(ABBR_PROCESS_LATENCY_LOG_HANDLE, log_level)) \
+ { \
+ MESA_handle_runtime_log(ABBR_PROCESS_LATENCY_LOG_HANDLE, log_level, "process_latency ", "file %s, line %d, " format, \
+ __FILE__, __LINE__, ##__VA_ARGS__); \
+ } \
+} while (0)
+
extern void sapp_log(int level, int print_sw, int file_sw, const char *format, ...);
int sapp_parse_cmd_args(int argc, char *argv[]);
diff --git a/include/private/sapp_global_val.h b/include/private/sapp_global_val.h
index 2b368bf..ad65aa5 100644
--- a/include/private/sapp_global_val.h
+++ b/include/private/sapp_global_val.h
@@ -127,7 +127,6 @@ typedef struct{
typedef struct{
- int enabled_log_level;
char sapp_log_category[NAME_MAX];
char sapp_plugin_log_category[NAME_MAX];
}sapp_config_profiling_log_t;
@@ -149,8 +148,8 @@ typedef struct{
//process_latency and sanity_check
char process_latency_log_category[NAME_MAX];
- int process_latency_enabled_log_level;
- int process_latency_threshold_in_ns; /* nanosecond, �����ļ��ﵥλ��microsecond, ��Ҫ����1000 */
+ int histogram_enabled;
+ int process_latency_threshold_in_ms; /* nanosecond, �����ļ��ﵥλ��microsecond, ��Ҫ����1000 */
/* ��ȷģʽ������, fs2����ͳ��Ҳ�dz���CPU, ÿ������Ҫ����FS_operate(),
���ͣ�þ�ȷģʽ, ����fs2���DZ������һ��ʱ������ֵ, ��Сֵ����һ��ʱ���ƽ��ֵ, ������FS_operate()����,
��ȷ�Ƚ�����һЩ, ���������˵���FS_operate()�Ĵ���.