Re: [PATCH] trace-cmd: Stop recording when processes traced with -P exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 20 Apr 2020 21:01:00 -0500
bijan tabatabai <bijan311@xxxxxxxxx> wrote:

> Hi Steve,
> 
> > Won't that while loop just go into a spin?
> >
> > What about something like a fsnotify on a /proc/<pid>/ file?
> >
> > I rather have trace-cmd sleep and wake up when a task exits, than to do a
> > spin. Like it does for the -F option.  
> 
> I just tried doing this using the inotify API and hit a snag.
> It turns out inotify can't monitor pseudo-filesystems like /proc, so I
> don't think that suggestion will work.
> 
> What if I put a call to sleep in the loop?
> It's not the most elegant solution, but that way it wouldn't be too
> different from the current code that sleeps for 10 seconds after
> checking if finished is set to true.

Perhaps using the new pidfd interface may work here.

  https://lwn.net/Articles/794707/

It was added in 5.4 (which is still rather new), but this would be a
new trace-cmd feature as well.

-- Steve




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux