Results 1 to 4 of 4
Hello everyone , I'm a novice Linux user and would really appreciate any help on a problem I'm facing. I searched the list for something similar to the issue I'll ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 03-19-2007 #1
- Join Date
- Mar 2007
profiling TCP stack
Hello everyone ,
I'm a novice Linux user and would really appreciate any help on a problem I'm facing. I searched the list for something similar to the issue I'll mention, but couldn't find an exact remedy.
The Problem: I need to measure how much delay does the TCP stack induce in a networking application.
In more detail: consider that I have a small C program using sockets to connect to a remote machine. Now I need to measure how much time does it take for the application packets to pass through the TCP stack and to the card. This will allow me to decompose performance delay into, application delay, stack delay and on-the-wire delay.
I think one possible solution could be compiling the entire network module with gprof and then running the kernel with this stack. Using gmon.out I could perhaps get stats regarding what functions in the stack are taking how much 'relative' time .. but doing this would slow down the actual stack, because of inserted profiling statements.
Can someone please point me to a more simple solution/project that addresses this issue?
- 03-20-2007 #2
How about printing out the actual amount of jiffies with the function "times(NULL)"?
Here's an example. Needs only to be made global and spread all over your system.
jiffies_start = times(NULL);
printf("jiffies start: %lu\n", jiffies_start);
jiffies_end = times(NULL);
printf("jiffies end: %lu\n", jiffies_end);
printf("time elapsed in secs: %f\n", (float) (jiffies_end - jiffies_start) / HZ);Bus Error: Passengers dumped. Hech gap yo'q.
- 03-20-2007 #3
- Join Date
- Mar 2007
Thanks Dilbert! The thing is, jiffies being a basic packet of kernel time, maybe of resolution 10ms.. will help me profile the app. I write. How can I measure TCP stack time with this?
In detail, if my application takes 3 seconds to communicate from one to another, I need to know how much of the 3 sec, is spent in the app layer, TCP layer, Layer 2, Layer 1 and on-the-wire.
- 03-21-2007 #4
Theoretically , you could use a global jiffies variable in those network layers, too. I haven't used this jiffies timing in the kernel, but I saw at least some drivers that do so.
Surely, pratically that would be completely tedious if you first would have to find out where to place your jiffies printouts.
I've never done such a measurement, therefore only those vague hints.
Maybe you can query the output that goes to the proc file system, e.g. /proc/net/dev. But again, I have no clue if this is feasible and how to make the appropriate checking.
Maybe you try again another Web search. The only thing I can imagine is, that you could use the proc file system or you would need to recompile the kernel after enabling debug levels or specially prepared debug points within the network code. The point is to know where the relevant switches are.Bus Error: Passengers dumped. Hech gap yo'q.