All of lore.kernel.org
 help / color / mirror / Atom feed
* can we measure the traffic between user and kernel mode
@ 2011-01-27  3:42 loody
  2011-01-27  4:41 ` Alexandre Courbot
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: loody @ 2011-01-27  3:42 UTC (permalink / raw)
  To: kernelnewbies

Dear all:
Is there any directory under proc/sys or tools that can help us to
measure the traffic between user and kernel mode?
(such as ioctl, open, close, etc.)


-- 
Regards,
miloody

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

* can we measure the traffic between user and kernel mode
  2011-01-27  3:42 can we measure the traffic between user and kernel mode loody
@ 2011-01-27  4:41 ` Alexandre Courbot
  2011-01-27  5:02 ` Mulyadi Santosa
  2011-01-27  5:56 ` Michael Blizek
  2 siblings, 0 replies; 14+ messages in thread
From: Alexandre Courbot @ 2011-01-27  4:41 UTC (permalink / raw)
  To: kernelnewbies

> Is there any directory under proc/sys or tools that can help us to
> measure the traffic between user and kernel mode?
> (such as ioctl, open, close, etc.)

Not that I know of, but you can use strace in order to monitor system
calls performed by a particular application.

Alex.

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

* can we measure the traffic between user and kernel mode
  2011-01-27  3:42 can we measure the traffic between user and kernel mode loody
  2011-01-27  4:41 ` Alexandre Courbot
@ 2011-01-27  5:02 ` Mulyadi Santosa
  2011-01-27  5:56   ` loody
  2011-01-27  5:56 ` Michael Blizek
  2 siblings, 1 reply; 14+ messages in thread
From: Mulyadi Santosa @ 2011-01-27  5:02 UTC (permalink / raw)
  To: kernelnewbies

On Thu, Jan 27, 2011 at 10:42, loody <miloody@gmail.com> wrote:
> Dear all:
> Is there any directory under proc/sys or tools that can help us to
> measure the traffic between user and kernel mode?
> (such as ioctl, open, close, etc.)

By "traffic", you mean context switch latency? Perhaps you mean a tool
like lmbench?

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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

* can we measure the traffic between user and kernel mode
  2011-01-27  3:42 can we measure the traffic between user and kernel mode loody
  2011-01-27  4:41 ` Alexandre Courbot
  2011-01-27  5:02 ` Mulyadi Santosa
@ 2011-01-27  5:56 ` Michael Blizek
  2 siblings, 0 replies; 14+ messages in thread
From: Michael Blizek @ 2011-01-27  5:56 UTC (permalink / raw)
  To: kernelnewbies

Hi!

On 11:42 Thu 27 Jan     , loody wrote:
> Dear all:
> Is there any directory under proc/sys or tools that can help us to
> measure the traffic between user and kernel mode?
> (such as ioctl, open, close, etc.)

If you are interested in number of system calls per second, you can run dstat.
However I do not know a way to measure the traffic in bytes/sec.

	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com

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

* can we measure the traffic between user and kernel mode
  2011-01-27  5:02 ` Mulyadi Santosa
@ 2011-01-27  5:56   ` loody
  2011-01-27  6:20     ` Mulyadi Santosa
  0 siblings, 1 reply; 14+ messages in thread
From: loody @ 2011-01-27  5:56 UTC (permalink / raw)
  To: kernelnewbies

hi all:
thanks for your kind reply :-)

2011/1/27 Mulyadi Santosa <mulyadi.santosa@gmail.com>:
> On Thu, Jan 27, 2011 at 10:42, loody <miloody@gmail.com> wrote:
>> Dear all:
>> Is there any directory under proc/sys or tools that can help us to
>> measure the traffic between user and kernel mode?
>> (such as ioctl, open, close, etc.)
>
> By "traffic", you mean context switch latency? Perhaps you mean a tool
> like lmbench?
I got a user-mode application without symbol and source, and it keeps
console no response about 2 mins.
I just want to know whether it is busy on processing itself or do the
context switch frequently for calling kernel drivers at that time.
thanks a lot,
miloody


>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com
>



-- 
Regards,

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

* can we measure the traffic between user and kernel mode
  2011-01-27  5:56   ` loody
@ 2011-01-27  6:20     ` Mulyadi Santosa
  2011-01-27 11:56       ` Pravin Shedage
  2011-01-27 13:48       ` loody
  0 siblings, 2 replies; 14+ messages in thread
From: Mulyadi Santosa @ 2011-01-27  6:20 UTC (permalink / raw)
  To: kernelnewbies

On Thu, Jan 27, 2011 at 12:56, loody <miloody@gmail.com> wrote:
> I got a user-mode application without symbol and source, and it keeps
> console no response about 2 mins.
> I just want to know whether it is busy on processing itself or do the
> context switch frequently for calling kernel drivers at that time.

well then, strace/ltrace is probably the right tool to do the job :)
or just use /proc/<pid>/stack :)

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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

* can we measure the traffic between user and kernel mode
  2011-01-27  6:20     ` Mulyadi Santosa
@ 2011-01-27 11:56       ` Pravin Shedage
  2011-01-27 13:48       ` loody
  1 sibling, 0 replies; 14+ messages in thread
From: Pravin Shedage @ 2011-01-27 11:56 UTC (permalink / raw)
  To: kernelnewbies

Hi,

You can use *top* command to know traffic of processes in your cpu.

another if you want to debug that running application then you can also try
gdb

# gdb --pid <pid_of_application>


Thanks & Regards,
-------PraviN-------


On Thu, Jan 27, 2011 at 11:50 AM, Mulyadi Santosa <mulyadi.santosa@gmail.com
> wrote:

> On Thu, Jan 27, 2011 at 12:56, loody <miloody@gmail.com> wrote:
> > I got a user-mode application without symbol and source, and it keeps
> > console no response about 2 mins.
> > I just want to know whether it is busy on processing itself or do the
> > context switch frequently for calling kernel drivers at that time.
>
> well then, strace/ltrace is probably the right tool to do the job :)
> or just use /proc/<pid>/stack :)
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 


Thanks & Regards,
---------PraviN---------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110127/a8ce56e6/attachment.html 

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

* can we measure the traffic between user and kernel mode
  2011-01-27  6:20     ` Mulyadi Santosa
  2011-01-27 11:56       ` Pravin Shedage
@ 2011-01-27 13:48       ` loody
  2011-01-27 17:45         ` Mulyadi Santosa
  2011-01-28  1:07         ` Alexandre Courbot
  1 sibling, 2 replies; 14+ messages in thread
From: loody @ 2011-01-27 13:48 UTC (permalink / raw)
  To: kernelnewbies

hi all:

2011/1/27 Mulyadi Santosa <mulyadi.santosa@gmail.com>:
> On Thu, Jan 27, 2011 at 12:56, loody <miloody@gmail.com> wrote:
>> I got a user-mode application without symbol and source, and it keeps
>> console no response about 2 mins.
>> I just want to know whether it is busy on processing itself or do the
>> context switch frequently for calling kernel drivers at that time.
>
> well then, strace/ltrace is probably the right tool to do the job :)
> or just use /proc/<pid>/stack :)
I have tried the suggestions you gave. :)

Can I combine all the message together?
Supposedly, my console shows:
A begins
A finish
B begins
B finish
and I measure 2mins from '#A finish' to "#B begins".

I can "strace -o -tt 123 a.out" before "A begin" but how could I
combine console output with the content of strace?
such as
A begins
strace content ......
A finish
strace content ......
B begins
strace content ......
B finish

appreciate your kind help :-)
miloody

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

* can we measure the traffic between user and kernel mode
  2011-01-27 13:48       ` loody
@ 2011-01-27 17:45         ` Mulyadi Santosa
  2011-01-30  7:50           ` loody
  2011-01-28  1:07         ` Alexandre Courbot
  1 sibling, 1 reply; 14+ messages in thread
From: Mulyadi Santosa @ 2011-01-27 17:45 UTC (permalink / raw)
  To: kernelnewbies

Hi :)

On Thu, Jan 27, 2011 at 20:48, loody <miloody@gmail.com> wrote:
> I can "strace -o -tt 123 a.out" before "A begin" but how could I
> combine console output with the content of strace?
> such as
> A begins
> strace content ......
> A finish
> strace content ......
> B begins
> strace content ......
> B finish

Not sure if I understand you correctly...what are A and B here? function calls?

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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

* can we measure the traffic between user and kernel mode
  2011-01-27 13:48       ` loody
  2011-01-27 17:45         ` Mulyadi Santosa
@ 2011-01-28  1:07         ` Alexandre Courbot
  2011-01-30  8:07           ` loody
  1 sibling, 1 reply; 14+ messages in thread
From: Alexandre Courbot @ 2011-01-28  1:07 UTC (permalink / raw)
  To: kernelnewbies

> I can "strace -o -tt 123 a.out" before "A begin" but how could I
> combine console output with the content of strace?

strace does output to stderr unless you specify the -o option. So by
using something like

$ strace -tt your_program

or

$ strace -tt your_program &> log.txt

you will have both outputs intermingled. Note that the console output
of your program will appear in the middle of the corresponding write()
system call.

Alex.

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

* can we measure the traffic between user and kernel mode
  2011-01-27 17:45         ` Mulyadi Santosa
@ 2011-01-30  7:50           ` loody
  0 siblings, 0 replies; 14+ messages in thread
From: loody @ 2011-01-30  7:50 UTC (permalink / raw)
  To: kernelnewbies

hi:
2011/1/28 Mulyadi Santosa <mulyadi.santosa@gmail.com>:
> Hi :)
>
> On Thu, Jan 27, 2011 at 20:48, loody <miloody@gmail.com> wrote:
>> I can "strace -o -tt 123 a.out" before "A begin" but how could I
>> combine console output with the content of strace?
>> such as
>> A begins
>> strace content ......
>> A finish
>> strace content ......
>> B begins
>> strace content ......
>> B finish
>
> Not sure if I understand you correctly...what are A and B here? function calls?
Yes, the A and B here I mean is the function call I wrote in C, such
as the "open("/home/miloody", O_RDONLY) " etc.
Thank you ~
miloody

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

* can we measure the traffic between user and kernel mode
  2011-01-28  1:07         ` Alexandre Courbot
@ 2011-01-30  8:07           ` loody
  2011-01-31  1:38             ` Alexandre Courbot
  0 siblings, 1 reply; 14+ messages in thread
From: loody @ 2011-01-30  8:07 UTC (permalink / raw)
  To: kernelnewbies

hi:
2011/1/28 Alexandre Courbot <gnurou@gmail.com>:
>> I can "strace -o -tt 123 a.out" before "A begin" but how could I
>> combine console output with the content of strace?
>
> strace does output to stderr unless you specify the -o option. So by
> using something like
>
> $ strace -tt your_program
>
> or
>
> $ strace -tt your_program &> log.txt
>
> you will have both outputs intermingled. Note that the console output
> of your program will appear in the middle of the corresponding write()
> system call.
I have tried both ways you mentioned.
in case 1:
it did interleave the output of standard output with standard error.
in case 2:
the standard output seems will be collect for flush at later,
combine.strace.txt.
(I attach the testing result for your reference.)
theoretically, file re-direction should not be effect the content of
output, right?
appreciate your help :-)
miloody.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: strace.output.tar.bz2
Type: application/x-bzip2
Size: 1882 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110130/5b02b45e/attachment.bz2 

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

* can we measure the traffic between user and kernel mode
  2011-01-30  8:07           ` loody
@ 2011-01-31  1:38             ` Alexandre Courbot
  2011-01-31  1:40               ` Alexandre Courbot
  0 siblings, 1 reply; 14+ messages in thread
From: Alexandre Courbot @ 2011-01-31  1:38 UTC (permalink / raw)
  To: kernelnewbies

> I have tried both ways you mentioned.
> in case 1:
> it did interleave the output of standard output with standard error.
> in case 2:
> the standard output seems will be collect for flush at later,
> combine.strace.txt.
> (I attach the testing result for your reference.)
> theoretically, file re-direction should not be effect the content of
> output, right?

That's what I thought too, but it turns out the libc is smarter than
we expected. File redirection *does* affect the order of output, as
testified by your logs. See the non-redirected behavior:

15:55:35.205409 write(1, "\n", 1)       = 1
15:55:35.205517 write(1, "open fail\n", 10) = 10
15:55:35.205628 open("/home/miloody", O_RDONLY) = -1 ENOENT (No such
file or directory)
15:55:35.205745 write(1, "\n", 1)       = 1
15:55:35.205847 write(1, "open fail\n", 10) = 10
15:55:35.205957 open("/home/miloody", O_RDONLY) = -1 ENOENT (No such
file or directory)
15:55:35.206073 write(1, "\n", 1)       = 1
15:55:35.206174 write(1, "open fail\n", 10) = 10
15:55:35.206284 open("/home/miloody", O_RDONLY) = -1 ENOENT (No such
file or directory)
...

and compare it to what happens when we use redirection:

...
15:56:21.105236 open("/home/miloody", O_RDONLY) = -1 ENOENT (No such
file or directory)
15:56:21.105294 open("/home/miloody", O_RDONLY) = -1 ENOENT (No such
file or directory)
15:56:21.105353 open("/home/miloody", O_RDONLY) = -1 ENOENT (No such
file or directory)
15:56:21.105417 write(1, "\nopen fail\n\nopen fail\n\nopen fail"..., 110

Here the libc has grouped all your printfs into one single system call
because of user-space buffering. Fortunately you can prevent this
behavior using unbuffer:

http://linuxcommand.org/man_pages/unbuffer1.html

So your strace invokation would be like:

$ strace -tt stdbuf -o0 -e0 ./foo &>output

Which produces the expected output on my system.

Alex.

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

* can we measure the traffic between user and kernel mode
  2011-01-31  1:38             ` Alexandre Courbot
@ 2011-01-31  1:40               ` Alexandre Courbot
  0 siblings, 0 replies; 14+ messages in thread
From: Alexandre Courbot @ 2011-01-31  1:40 UTC (permalink / raw)
  To: kernelnewbies

> Here the libc has grouped all your printfs into one single system call
> because of user-space buffering. Fortunately you can prevent this
> behavior using unbuffer:
>
> http://linuxcommand.org/man_pages/unbuffer1.html

Sorry, that should have read stdbuf, and the correct man page is here:

http://www.pixelbeat.org/programming/stdio_buffering/stdbuf-man.html

Alex.

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

end of thread, other threads:[~2011-01-31  1:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27  3:42 can we measure the traffic between user and kernel mode loody
2011-01-27  4:41 ` Alexandre Courbot
2011-01-27  5:02 ` Mulyadi Santosa
2011-01-27  5:56   ` loody
2011-01-27  6:20     ` Mulyadi Santosa
2011-01-27 11:56       ` Pravin Shedage
2011-01-27 13:48       ` loody
2011-01-27 17:45         ` Mulyadi Santosa
2011-01-30  7:50           ` loody
2011-01-28  1:07         ` Alexandre Courbot
2011-01-30  8:07           ` loody
2011-01-31  1:38             ` Alexandre Courbot
2011-01-31  1:40               ` Alexandre Courbot
2011-01-27  5:56 ` Michael Blizek

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.