Networking Forums

Networking Forums > Computer Networking > Linux Networking > Obtaining timestamps

Reply
Thread Tools Display Modes

Obtaining timestamps

 
 
ajcppmod@gmail.com
Guest
Posts: n/a

 
      06-02-2008, 07:36 PM
Hi

I'm trying to obtain timestamp information for packets arriving at a
socket. I understand that this information will not be very accurate
due to issue such as interrupt latency, software clocks and the
packets not being timestamped by the NIC.

My code is sitting on a select(), when data arrives at the socket it
is read, processed then added to a database before returning to the
select call. If any packets arrive after the socket's read but before
returning to the select then they will not be serviced immediately. I
would like to be able to measure this latency by reading the timestamp
of the oldest packet sitting in the socket buffer before reading from
the socket.

I have attempted to write code which sets the SO_TIMESTAMP option and
then calls recvmsg, but despite the return time from the recvmsg call
indicating there were messages the cmsg_level, cmsg_type and cmsg_len
are all zero. I'm attempting to do this on a SOCK_STREAM descriptor
and I've read that the SO_TIMESTAMP option is only supported for DGRAM
sockets, is this true?

Can anyone give me a clue how to achieve this goal, pls. Is it
possible using ioctl and SIOCGSTAMP or calls to libpcap?

Any help much appreciated

AJ
 
Reply With Quote
 
 
 
 
ajcppmod@gmail.com
Guest
Posts: n/a

 
      06-03-2008, 04:08 PM
On Jun 2, 8:36 pm, ajcpp...@gmail.com wrote:
> Hi
>
> I'm trying to obtain timestamp information for packets arriving at a
> socket. I understand that this information will not be very accurate
> due to issue such as interrupt latency, software clocks and the
> packets not being timestamped by the NIC.
>
> My code is sitting on a select(), when data arrives at the socket it
> is read, processed then added to a database before returning to the
> select call. If any packets arrive after the socket's read but before
> returning to the select then they will not be serviced immediately. I
> would like to be able to measure this latency by reading the timestamp
> of the oldest packet sitting in the socket buffer before reading from
> the socket.
>
> I have attempted to write code which sets the SO_TIMESTAMP option and
> then calls recvmsg, but despite the return time from the recvmsg call
> indicating there were messages the cmsg_level, cmsg_type and cmsg_len
> are all zero. I'm attempting to do this on a SOCK_STREAM descriptor
> and I've read that the SO_TIMESTAMP option is only supported for DGRAM
> sockets, is this true?
>
> Can anyone give me a clue how to achieve this goal, pls. Is it
> possible using ioctl and SIOCGSTAMP or calls to libpcap?
>
> Any help much appreciated
>
> AJ


Alternatively, Is it possible to access a sk_buff from userspace? What
system calls
must I make in order to achieve this?

I would specifically like to obtain timestamp information for the
packets arriving at a socket and examine the current sk_buff len (i.e.
skb_queue_len).

I'm using a TCP socket so cannot use SO_TIMESTAMP option. I'm aware of
the SIOCGSTAMP option on ioctl() but I'm really after the timestamp of
the packet at the head of the queue not the tail (i.e. most recently
received).

please help,

AJ
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
obtaining a mac code ned Broadband 8 08-05-2008 06:14 PM
CLOCK_MONOTONIC datagram timestamps by the kernel Spoon Linux Networking 0 02-24-2007 05:06 PM
Netgear Router logs emails - wrong timestamps Dave_T Home Networking 2 07-17-2006 04:06 PM
Samba timestamps wrong! RobO Linux Networking 6 08-10-2005 09:23 PM
obtaining MS Client Rich Windows Networking 2 11-10-2003 01:56 AM



1 2 3 4 5 6 7 8 9 10 11