public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Pádraig Brady" <P@draigBrady.com>
To: Namhyung Kim <namhyung@kernel.org>, Steven Rostedt <rostedt@goodmis.org>
Cc: Shuah Khan <shuahkh@osg.samsung.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Dave Jones <davej@codemonkey.org.uk>,
	Luis Henriques <luis.henriques@canonical.com>
Subject: Re: [PATCH] ftracetest: Do not use usleep
Date: Tue, 31 Mar 2015 02:08:06 +0100	[thread overview]
Message-ID: <5519F376.30105@draigBrady.com> (raw)
In-Reply-To: <20150331004855.GF32033@sejong>

On 31/03/15 01:48, Namhyung Kim wrote:
> Hi Steve,
> 
> On Mon, Mar 30, 2015 at 05:15:11PM -0400, Steven Rostedt wrote:
>> On Thu, 26 Mar 2015 09:32:23 +0900
>> Namhyung Kim <namhyung@kernel.org> wrote:
>>
>>> The usleep is only provided on distros from Redhat so running ftracetest
>>> on other distro resulted in failures due to the missing usleep.
>>>
>>> The reason of using [u]sleep in the test was to generate (scheduler)
>>> events. But as we use 'cat trace | grep | wc -l' to read the events,
>>> the command themselves already generate some events before reading the
>>> trace file so no need to call [u]sleep explicitly.
>>
>> Note, opening "trace" via cat stops tracing. There is a possible race
>> where the cat will not produce events. My worry is that if the shell
>> implements its own "cat" command, it may not fork, and open the trace
>> file. Which would not have any events in it, and opening it will
>> disable the rest of the command from having events.
> 
> I understand your point.  But this is not just cat, it needs grep and
> wc also.  So I think there should be scheduler event(s).
> 
>>
>> What about using:
>>
>>  ping localhost -c 1
>>
>> ?
> 
> I'm okay with ping though but worried if some tiny system might lack
> the ping command..

I'd use a fallback method like:

  yield() { sleep .001 || usleep 1 || sleep 1; }

Then just s/usleep 1/yield/

cheers,
Pádraig.

  parent reply	other threads:[~2015-03-31  1:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-26  0:32 [PATCH] ftracetest: Do not use usleep Namhyung Kim
2015-03-30 20:47 ` Shuah Khan
2015-03-30 21:15 ` Steven Rostedt
2015-03-31  0:48   ` Namhyung Kim
2015-03-31  1:04     ` Steven Rostedt
2015-03-31  1:08     ` Pádraig Brady [this message]
2015-03-31  1:29       ` 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=5519F376.30105@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=davej@codemonkey.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luis.henriques@canonical.com \
    --cc=mpe@ellerman.id.au \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=shuahkh@osg.samsung.com \
    /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