All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ftracetest: Replace usleep with sleep 0.000001
@ 2014-12-10  4:38 Michael Ellerman
  2014-12-10  8:19 ` Namhyung Kim
  2014-12-20 20:42 ` Pavel Machek
  0 siblings, 2 replies; 10+ messages in thread
From: Michael Ellerman @ 2014-12-10  4:38 UTC (permalink / raw)
  To: rostedt; +Cc: namhyung, masami.hiramatsu.pt, linux-kernel

usleep is a Fedoraism, it's not generally available on Debian based
systems AFAICS.

GNU sleep accepts a floating point argument, so use that instead.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 tools/testing/selftests/ftrace/test.d/event/event-enable.tc     | 6 +++---
 tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/ftrace/test.d/event/event-enable.tc b/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
index 668616d9bb03..c5343add3407 100644
--- a/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
+++ b/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
@@ -21,7 +21,7 @@ reset_tracer
 do_reset
 
 echo 'sched:sched_switch' > set_event
-usleep 1
+sleep 0.000001
 
 count=`cat trace | grep sched_switch | wc -l`
 if [ $count -eq 0 ]; then
@@ -31,7 +31,7 @@ fi
 do_reset
 
 echo 1 > events/sched/sched_switch/enable
-usleep 1
+sleep 0.000001
 
 count=`cat trace | grep sched_switch | wc -l`
 if [ $count -eq 0 ]; then
@@ -41,7 +41,7 @@ fi
 do_reset
 
 echo 0 > events/sched/sched_switch/enable
-usleep 1
+sleep 0.000001
 
 count=`cat trace | grep sched_switch | wc -l`
 if [ $count -ne 0 ]; then
diff --git a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
index 655c415b6e7f..84a2020d4e7b 100644
--- a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
+++ b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
@@ -21,7 +21,7 @@ reset_tracer
 do_reset
 
 echo 'sched:*' > set_event
-usleep 1
+sleep 0.000001
 
 count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
 if [ $count -lt 3 ]; then
@@ -31,7 +31,7 @@ fi
 do_reset
 
 echo 1 > events/sched/enable
-usleep 1
+sleep 0.000001
 
 count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
 if [ $count -lt 3 ]; then
@@ -41,7 +41,7 @@ fi
 do_reset
 
 echo 0 > events/sched/enable
-usleep 1
+sleep 0.000001
 
 count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
 if [ $count -ne 0 ]; then
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] ftracetest: Replace usleep with sleep 0.000001
  2014-12-10  4:38 [PATCH] ftracetest: Replace usleep with sleep 0.000001 Michael Ellerman
@ 2014-12-10  8:19 ` Namhyung Kim
  2014-12-11  5:12   ` Masami Hiramatsu
  2014-12-20 20:42 ` Pavel Machek
  1 sibling, 1 reply; 10+ messages in thread
From: Namhyung Kim @ 2014-12-10  8:19 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Steven Rostedt, Masami Hiramatsu, linux-kernel

Hi Michael,

On Wed, Dec 10, 2014 at 1:38 PM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> usleep is a Fedoraism, it's not generally available on Debian based
> systems AFAICS.
>
> GNU sleep accepts a floating point argument, so use that instead.

I tested it on busybox not Debian, sorry.  But it seems busybox's
sleep doesn't support floating point argument..

  / # ls -l `which sleep`
  lrwxrwxrwx     1  root     rooot       7 May 22  2014  /bin/sleep -> busybox

  / # sleep 0.1
  sleep: invalid number '0.1'


Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: [PATCH] ftracetest: Replace usleep with sleep 0.000001
  2014-12-10  8:19 ` Namhyung Kim
@ 2014-12-11  5:12   ` Masami Hiramatsu
  2014-12-11 23:39     ` Michael Ellerman
  0 siblings, 1 reply; 10+ messages in thread
From: Masami Hiramatsu @ 2014-12-11  5:12 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Michael Ellerman, Steven Rostedt, linux-kernel

Hi,

(2014/12/10 17:19), Namhyung Kim wrote:
> Hi Michael,
> 
> On Wed, Dec 10, 2014 at 1:38 PM, Michael Ellerman <mpe@ellerman.id.au> wrote:
>> usleep is a Fedoraism, it's not generally available on Debian based
>> systems AFAICS.
>>
>> GNU sleep accepts a floating point argument, so use that instead.
> 
> I tested it on busybox not Debian, sorry.  But it seems busybox's
> sleep doesn't support floating point argument..
> 
>   / # ls -l `which sleep`
>   lrwxrwxrwx     1  root     rooot       7 May 22  2014  /bin/sleep -> busybox
> 
>   / # sleep 0.1
>   sleep: invalid number '0.1'

I also have same result. Basically, ftracetest should be able to run on busybox.
So, I think we'd better check whether usleep is available, and if not, fallback
to sleep like as below.

  if which usleep &> /dev/null; then
    usleep 1
  else
    sleep 0.000001
  fi

Thank you,


-- 
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: [PATCH] ftracetest: Replace usleep with sleep 0.000001
  2014-12-11  5:12   ` Masami Hiramatsu
@ 2014-12-11 23:39     ` Michael Ellerman
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Ellerman @ 2014-12-11 23:39 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: Namhyung Kim, Steven Rostedt, linux-kernel

On Thu, 2014-12-11 at 14:12 +0900, Masami Hiramatsu wrote:
> Hi,
> 
> (2014/12/10 17:19), Namhyung Kim wrote:
> > Hi Michael,
> > 
> > On Wed, Dec 10, 2014 at 1:38 PM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> >> usleep is a Fedoraism, it's not generally available on Debian based
> >> systems AFAICS.
> >>
> >> GNU sleep accepts a floating point argument, so use that instead.
> > 
> > I tested it on busybox not Debian, sorry.  But it seems busybox's
> > sleep doesn't support floating point argument..
> > 
> >   / # ls -l `which sleep`
> >   lrwxrwxrwx     1  root     rooot       7 May 22  2014  /bin/sleep -> busybox
> > 
> >   / # sleep 0.1
> >   sleep: invalid number '0.1'
> 
> I also have same result. Basically, ftracetest should be able to run on busybox.

Yeah OK.

> So, I think we'd better check whether usleep is available, and if not, fallback
> to sleep like as below.
> 
>   if which usleep &> /dev/null; then
>     usleep 1
>   else
>     sleep 0.000001
>   fi

Why do we need to call (u)sleep anyway? It's generally a bad sign when tests
use sleep as it's asking for random timing related failures to creep in.

cheers



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ftracetest: Replace usleep with sleep 0.000001
  2014-12-10  4:38 [PATCH] ftracetest: Replace usleep with sleep 0.000001 Michael Ellerman
  2014-12-10  8:19 ` Namhyung Kim
@ 2014-12-20 20:42 ` Pavel Machek
  2014-12-20 22:07   ` Steven Rostedt
  1 sibling, 1 reply; 10+ messages in thread
From: Pavel Machek @ 2014-12-20 20:42 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: rostedt, namhyung, masami.hiramatsu.pt, linux-kernel

On Wed 2014-12-10 15:38:27, Michael Ellerman wrote:
> usleep is a Fedoraism, it's not generally available on Debian based
> systems AFAICS.
> 
> GNU sleep accepts a floating point argument, so use that instead.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Could ftrace user interface be enhanced not to need random delays?

								Pavel

> ---
>  tools/testing/selftests/ftrace/test.d/event/event-enable.tc     | 6 +++---
>  tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/event/event-enable.tc b/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
> index 668616d9bb03..c5343add3407 100644
> --- a/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
> +++ b/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
> @@ -21,7 +21,7 @@ reset_tracer
>  do_reset
>  
>  echo 'sched:sched_switch' > set_event
> -usleep 1
> +sleep 0.000001
>  
>  count=`cat trace | grep sched_switch | wc -l`
>  if [ $count -eq 0 ]; then
> @@ -31,7 +31,7 @@ fi
>  do_reset
>  
>  echo 1 > events/sched/sched_switch/enable
> -usleep 1
> +sleep 0.000001
>  
>  count=`cat trace | grep sched_switch | wc -l`
>  if [ $count -eq 0 ]; then
> @@ -41,7 +41,7 @@ fi
>  do_reset
>  
>  echo 0 > events/sched/sched_switch/enable
> -usleep 1
> +sleep 0.000001
>  
>  count=`cat trace | grep sched_switch | wc -l`
>  if [ $count -ne 0 ]; then
> diff --git a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
> index 655c415b6e7f..84a2020d4e7b 100644
> --- a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
> +++ b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
> @@ -21,7 +21,7 @@ reset_tracer
>  do_reset
>  
>  echo 'sched:*' > set_event
> -usleep 1
> +sleep 0.000001
>  
>  count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
>  if [ $count -lt 3 ]; then
> @@ -31,7 +31,7 @@ fi
>  do_reset
>  
>  echo 1 > events/sched/enable
> -usleep 1
> +sleep 0.000001
>  
>  count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
>  if [ $count -lt 3 ]; then
> @@ -41,7 +41,7 @@ fi
>  do_reset
>  
>  echo 0 > events/sched/enable
> -usleep 1
> +sleep 0.000001
>  
>  count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
>  if [ $count -ne 0 ]; then

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ftracetest: Replace usleep with sleep 0.000001
  2014-12-20 20:42 ` Pavel Machek
@ 2014-12-20 22:07   ` Steven Rostedt
  2014-12-23  4:21     ` Namhyung Kim
  2014-12-25 23:17     ` Pavel Machek
  0 siblings, 2 replies; 10+ messages in thread
From: Steven Rostedt @ 2014-12-20 22:07 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Michael Ellerman, namhyung, masami.hiramatsu.pt, linux-kernel

On Sat, 20 Dec 2014 21:42:13 +0100
Pavel Machek <pavel@ucw.cz> wrote:

> On Wed 2014-12-10 15:38:27, Michael Ellerman wrote:
> > usleep is a Fedoraism, it's not generally available on Debian based
> > systems AFAICS.
> > 
> > GNU sleep accepts a floating point argument, so use that instead.
> > 
> > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> 
> Could ftrace user interface be enhanced not to need random delays?
> 

Not sure what you are talking about. These "random delays" are not for
the interface, but instead to force some events to happen and to make
sure they did.

As the subject states, this is for "ftracetest" which is the selftests
for ftrace.

The usleep is basically a "do something to trigger events", and we
don't want to wait long in doing it.

-- Steve

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ftracetest: Replace usleep with sleep 0.000001
  2014-12-20 22:07   ` Steven Rostedt
@ 2014-12-23  4:21     ` Namhyung Kim
  2014-12-23  7:08       ` Michael Ellerman
  2014-12-25 23:17     ` Pavel Machek
  1 sibling, 1 reply; 10+ messages in thread
From: Namhyung Kim @ 2014-12-23  4:21 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Pavel Machek, Michael Ellerman, masami.hiramatsu.pt, linux-kernel

On Sat, Dec 20, 2014 at 05:07:25PM -0500, Steven Rostedt wrote:
> On Sat, 20 Dec 2014 21:42:13 +0100
> Pavel Machek <pavel@ucw.cz> wrote:
> 
> > On Wed 2014-12-10 15:38:27, Michael Ellerman wrote:
> > > usleep is a Fedoraism, it's not generally available on Debian based
> > > systems AFAICS.
> > > 
> > > GNU sleep accepts a floating point argument, so use that instead.
> > > 
> > > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> > 
> > Could ftrace user interface be enhanced not to need random delays?
> > 
> 
> Not sure what you are talking about. These "random delays" are not for
> the interface, but instead to force some events to happen and to make
> sure they did.
> 
> As the subject states, this is for "ftracetest" which is the selftests
> for ftrace.
> 
> The usleep is basically a "do something to trigger events", and we
> don't want to wait long in doing it.

Right.  AFAIK what ftracetest expects is a scheduler event so it
doesn't need to be the [u]sleep.

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ftracetest: Replace usleep with sleep 0.000001
  2014-12-23  4:21     ` Namhyung Kim
@ 2014-12-23  7:08       ` Michael Ellerman
  2014-12-24  1:00         ` Masami Hiramatsu
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Ellerman @ 2014-12-23  7:08 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Steven Rostedt, Pavel Machek, masami.hiramatsu.pt, linux-kernel

On Tue, 2014-12-23 at 13:21 +0900, Namhyung Kim wrote:
> On Sat, Dec 20, 2014 at 05:07:25PM -0500, Steven Rostedt wrote:
> > On Sat, 20 Dec 2014 21:42:13 +0100
> > Pavel Machek <pavel@ucw.cz> wrote:
> > 
> > > On Wed 2014-12-10 15:38:27, Michael Ellerman wrote:
> > > > usleep is a Fedoraism, it's not generally available on Debian based
> > > > systems AFAICS.
> > > > 
> > > > GNU sleep accepts a floating point argument, so use that instead.
> > > > 
> > > > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> > > 
> > > Could ftrace user interface be enhanced not to need random delays?
> > > 
> > 
> > Not sure what you are talking about. These "random delays" are not for
> > the interface, but instead to force some events to happen and to make
> > sure they did.
> > 
> > As the subject states, this is for "ftracetest" which is the selftests
> > for ftrace.
> > 
> > The usleep is basically a "do something to trigger events", and we
> > don't want to wait long in doing it.
> 
> Right.  AFAIK what ftracetest expects is a scheduler event so it
> doesn't need to be the [u]sleep.

Would /bin/true work in that case?

cheers



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ftracetest: Replace usleep with sleep 0.000001
  2014-12-23  7:08       ` Michael Ellerman
@ 2014-12-24  1:00         ` Masami Hiramatsu
  0 siblings, 0 replies; 10+ messages in thread
From: Masami Hiramatsu @ 2014-12-24  1:00 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Namhyung Kim, Steven Rostedt, Pavel Machek, linux-kernel

(2014/12/23 16:08), Michael Ellerman wrote:
> On Tue, 2014-12-23 at 13:21 +0900, Namhyung Kim wrote:
>> On Sat, Dec 20, 2014 at 05:07:25PM -0500, Steven Rostedt wrote:
>>> On Sat, 20 Dec 2014 21:42:13 +0100
>>> Pavel Machek <pavel@ucw.cz> wrote:
>>>
>>>> On Wed 2014-12-10 15:38:27, Michael Ellerman wrote:
>>>>> usleep is a Fedoraism, it's not generally available on Debian based
>>>>> systems AFAICS.
>>>>>
>>>>> GNU sleep accepts a floating point argument, so use that instead.
>>>>>
>>>>> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>>>>
>>>> Could ftrace user interface be enhanced not to need random delays?
>>>>
>>>
>>> Not sure what you are talking about. These "random delays" are not for
>>> the interface, but instead to force some events to happen and to make
>>> sure they did.
>>>
>>> As the subject states, this is for "ftracetest" which is the selftests
>>> for ftrace.
>>>
>>> The usleep is basically a "do something to trigger events", and we
>>> don't want to wait long in doing it.
>>
>> Right.  AFAIK what ftracetest expects is a scheduler event so it
>> doesn't need to be the [u]sleep.
> 
> Would /bin/true work in that case?

As other scripts doing, just (echo "forked") would be enough. It forks
sub shell and wait for that.
Please check test.d/kprobe/kprobe_args.tc

Thanks!


-- 
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ftracetest: Replace usleep with sleep 0.000001
  2014-12-20 22:07   ` Steven Rostedt
  2014-12-23  4:21     ` Namhyung Kim
@ 2014-12-25 23:17     ` Pavel Machek
  1 sibling, 0 replies; 10+ messages in thread
From: Pavel Machek @ 2014-12-25 23:17 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Michael Ellerman, namhyung, masami.hiramatsu.pt, linux-kernel

On Sat 2014-12-20 17:07:25, Steven Rostedt wrote:
> On Sat, 20 Dec 2014 21:42:13 +0100
> Pavel Machek <pavel@ucw.cz> wrote:
> 
> > On Wed 2014-12-10 15:38:27, Michael Ellerman wrote:
> > > usleep is a Fedoraism, it's not generally available on Debian based
> > > systems AFAICS.
> > > 
> > > GNU sleep accepts a floating point argument, so use that instead.
> > > 
> > > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> > 
> > Could ftrace user interface be enhanced not to need random delays?
> > 
> 
> Not sure what you are talking about. These "random delays" are not for
> the interface, but instead to force some events to happen and to make
> sure they did.
> 
> As the subject states, this is for "ftracetest" which is the selftests
> for ftrace.
> 
> The usleep is basically a "do something to trigger events", and we
> don't want to wait long in doing it.

Yep, I misunderstood, sorry.

									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-12-25 23:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-10  4:38 [PATCH] ftracetest: Replace usleep with sleep 0.000001 Michael Ellerman
2014-12-10  8:19 ` Namhyung Kim
2014-12-11  5:12   ` Masami Hiramatsu
2014-12-11 23:39     ` Michael Ellerman
2014-12-20 20:42 ` Pavel Machek
2014-12-20 22:07   ` Steven Rostedt
2014-12-23  4:21     ` Namhyung Kim
2014-12-23  7:08       ` Michael Ellerman
2014-12-24  1:00         ` Masami Hiramatsu
2014-12-25 23:17     ` Pavel Machek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.