From: Steven Rostedt <rostedt@goodmis.org>
To: bijan tabatabai <bijan311@gmail.com>
Cc: Bijan Tabatabai <bijan311@yahoo.com>, linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH] trace-cmd: Stop recording when processes traced with -P exit
Date: Mon, 20 Apr 2020 22:31:18 -0400	[thread overview]
Message-ID: <20200420223118.5a6db47f@oasis.local.home> (raw)
In-Reply-To: <CAMvvPS5eAoA6nsv9s7iA7wU1g3LKGXOusgg0Lfnyag25L0oTjQ@mail.gmail.com>
On Mon, 20 Apr 2020 21:01:00 -0500
bijan tabatabai <bijan311@gmail.com> 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
next prev parent reply	other threads:[~2020-04-21  2:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200418163605.32461-1-bijan311.ref@yahoo.com>
     [not found] ` <20200418163605.32461-1-bijan311@yahoo.com>
2020-04-20 21:07   ` [PATCH] trace-cmd: Stop recording when processes traced with -P exit Steven Rostedt
2020-04-21  2:01     ` bijan tabatabai
2020-04-21  2:31       ` Steven Rostedt [this message]
2020-04-21  3:16         ` bijan tabatabai
2020-04-21 13:26           ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=20200420223118.5a6db47f@oasis.local.home \
    --to=rostedt@goodmis.org \
    --cc=bijan311@gmail.com \
    --cc=bijan311@yahoo.com \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).