Skip to content

Commit 4a762de

Browse files
committed
review cmdline
1 parent 2f357bb commit 4a762de

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/estimator/profile.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,16 @@ type bytesEntry struct {
350350
}
351351

352352
func (p *Profiler) filterPID(pid string) (int, error) {
353+
procParallel, err := exec.Command("cat", "/host_proc/"+pid+"/cmdline").Output()
354+
if err != nil {
355+
return 0, err
356+
}
357+
358+
if bytes.Contains(procParallel, []byte("postgres")) &&
359+
bytes.Contains(procParallel, []byte("parallel worker for PID "+strconv.Itoa(p.opts.Pid))) {
360+
return p.opts.Pid, nil
361+
}
362+
353363
procStatus, err := exec.Command("cat", "/host_proc/"+pid+"/status").Output()
354364
if err != nil {
355365
return 0, err

0 commit comments

Comments
 (0)