Prechádzať zdrojové kódy

Feature #TASK_QT-18250 重新恢复为前八个

rock.wu 9 mesiacov pred
rodič
commit
0f996fff36

+ 3 - 3
ebpftracer/ebpf/utrace/go/include/go_types.h

@@ -43,9 +43,9 @@ struct go_iface
 };
 
 struct map_bucket {
-    char tophash[20];
-    struct go_string_ot keys[20];
-    struct go_slice_ot values[20];
+    char tophash[8];
+    struct go_string_ot keys[8];
+    struct go_slice_ot values[8];
     void *overflow;
 
 	void *headers_ptr;

+ 5 - 6
ebpftracer/ebpf/utrace/go/net/server.probe.bpf.c

@@ -289,7 +289,7 @@ static __always_inline struct map_bucket *get_map_bucket(void *headers_ptr_ptr)
 	}
 	__builtin_memset(map_value, 0, sizeof(struct map_bucket));
 
-	for (u32 j = 0; j < 20; j++) {
+	for (u32 j = 0; j < 8; j++) {
 		if (j >= bucket_count) {
 			break;
 		}
@@ -307,7 +307,6 @@ static __always_inline char *get_header_val(struct map_bucket *map_value,u32 off
 		if (map_value->tophash[i] != 0 && map_value->keys[i].len == CW_HEADER_KEY_LENGTH) {
 			char current_header_key[CW_HEADER_KEY_LENGTH];
 			bpf_probe_read(current_header_key, sizeof(current_header_key), map_value->keys[i].str);
-			cw_bpf_debug("get_header_val str is %s",current_header_key);
 			if ((current_header_key[0] == CW_HEADER_KEY_VAL[0]
 			     || current_header_key[0] == CW_HEADER_KEY_UFIRST_VAL[0])
 			    && current_header_key[1] == CW_HEADER_KEY_UFIRST_VAL[1]
@@ -332,15 +331,15 @@ static __always_inline char *get_header_val(struct map_bucket *map_value,u32 off
 
 // 分段获取 header_val
 static __always_inline char *get_header_val_off(struct map_bucket *map_value) {
-	char *val = get_header_val(map_value, 0, 5);
+	char *val = get_header_val(map_value, 0, 2);
 	if (val == NULL) {
-		val = get_header_val(map_value, 5, 10);
+		val = get_header_val(map_value, 2, 4);
 	}
 	if (val == NULL) {
-		val = get_header_val(map_value, 10,	15);
+		val = get_header_val(map_value, 4,	6);
 	}
 	if (val == NULL) {
-		val = get_header_val(map_value, 15, 20);
+		val = get_header_val(map_value, 6, 8);
 	}
 	return val;
 }