Skip to content

Commit

Permalink
fix pid filter bug
Browse files Browse the repository at this point in the history
1. Wirte a simple go, just print pid and get some website.
func main() {
	 pid := os.Getpid()
         fmt.Println(pid)
         response, err := http.Get("http://www.baidu.com")
        ....
}

./main
3581

2. But when run `tcpconnlat`, we just go tid 3585, (not pid 3581)
#./tcpconnlat
PID    COMM         IP SADDR            DADDR            DPORT LAT(ms)
3585   main         4  10.0.2.15        180.101.49.11    80    60.68

3. So run `./tcpconnlat -p 3581` not work
I have tested this situation under kernel 3.10 and 5.0.9.
  • Loading branch information
DavadDi authored and yonghong-song committed Feb 16, 2020
1 parent 0d0d353 commit a28ad05
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/tcpconnlat.py
Expand Up @@ -105,7 +105,7 @@ def positive_float(val):
int trace_connect(struct pt_regs *ctx, struct sock *sk)
{
u32 pid = bpf_get_current_pid_tgid();
u32 pid = bpf_get_current_pid_tgid() >> 32;
FILTER
struct info_t info = {.pid = pid};
info.ts = bpf_ktime_get_ns();
Expand Down

0 comments on commit a28ad05

Please sign in to comment.