can we measure the traffic between user and kernel mode

14 messages, 5 authors, 2011-01-31 · open the first message on its own page

can we measure the traffic between user and kernel mode

From: loody <hidden>
Date: 2011-01-27 03:42:53

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

can we measure the traffic between user and kernel mode

From: Alexandre Courbot <hidden>
Date: 2011-01-27 04:41:02

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.

can we measure the traffic between user and kernel mode

From: Mulyadi Santosa <hidden>
Date: 2011-01-27 05:02:56

On Thu, Jan 27, 2011 at 10:42, loody [off-list ref] 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

can we measure the traffic between user and kernel mode

From: Michael Blizek <hidden>
Date: 2011-01-27 05:56:10

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

can we measure the traffic between user and kernel mode

From: loody <hidden>
Date: 2011-01-27 05:56:56

hi all:
thanks for your kind reply :-)

2011/1/27 Mulyadi Santosa [off-list ref]:
On Thu, Jan 27, 2011 at 10:42, loody [off-list ref] wrote:
quoted
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,

can we measure the traffic between user and kernel mode

From: Mulyadi Santosa <hidden>
Date: 2011-01-27 06:20:45

On Thu, Jan 27, 2011 at 12:56, loody [off-list ref] 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

can we measure the traffic between user and kernel mode

From: Pravin Shedage <hidden>
Date: 2011-01-27 11:56:29

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 [off-list ref] wrote:
quoted
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 

can we measure the traffic between user and kernel mode

From: loody <hidden>
Date: 2011-01-27 13:48:53

hi all:

2011/1/27 Mulyadi Santosa [off-list ref]:
On Thu, Jan 27, 2011 at 12:56, loody [off-list ref] wrote:
quoted
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

can we measure the traffic between user and kernel mode

From: Mulyadi Santosa <hidden>
Date: 2011-01-27 17:45:44

Hi :)

On Thu, Jan 27, 2011 at 20:48, loody [off-list ref] 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

can we measure the traffic between user and kernel mode

From: Alexandre Courbot <hidden>
Date: 2011-01-28 01:07:15

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.

can we measure the traffic between user and kernel mode

From: loody <hidden>
Date: 2011-01-30 07:50:36

hi:
2011/1/28 Mulyadi Santosa [off-list ref]:
Hi :)

On Thu, Jan 27, 2011 at 20:48, loody [off-list ref] wrote:
quoted
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

can we measure the traffic between user and kernel mode

From: loody <hidden>
Date: 2011-01-30 08:07:35

hi:
2011/1/28 Alexandre Courbot [off-list ref]:
quoted
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 

can we measure the traffic between user and kernel mode

From: Alexandre Courbot <hidden>
Date: 2011-01-31 01:38:23

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.

can we measure the traffic between user and kernel mode

From: Alexandre Courbot <hidden>
Date: 2011-01-31 01:40:54

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help