This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: _stp_gettimeofday_ns(void) in stp VS ktime_get_real() in Kernel
- From: "Frank Ch. Eigler" <fche at redhat dot com>
- To: æç <zengshan227 at gmail dot com>
- Cc: systemtap at sourceware dot org
- Date: Sun, 13 Dec 2009 21:35:39 -0500
- Subject: Re: _stp_gettimeofday_ns(void) in stp VS ktime_get_real() in Kernel
- References: <9f49f7820912131824p5f6589f5n85f32889577cd067@mail.gmail.com>
Hi -
> I am now using the following script to compute the executing of the
> netif_receive_skb funcion: [...]
> and the result is some thing like :
> 0 qemu-system-x86(3822):->netif_receive_skb
> 4373 qemu-system-x86(3822):<-netif_receive_skb
>
> *Question 1:
> *Can I use 4373 which is 0 subtract from 4373 to describe the executing time
> of the function netif_receive_skb?*
Yes, that is the intent.
> **Question 2:*
> since the way in which thread_indent function to get the time is through
> _stp_gettimeofday_ns(void) function and in kernel skb->tstamp is set by
> the function ktime_get_real() , my question is whether the principles of the
> two are the same? or whether they are comparable?
High-precision timing is a complicated subject. Different generations
of kernels have a variety of different time measurement widgets,
useful in only certain contexts each. The systemtap runtime has had to
have a separate get_cycles()-based estimator that it can use in atomic
contexts. They are not directly comparable.
However, you can calibrate the measurements for your own purposes,
calling a variety of time sources (get_cycles(), gettimeofday_*,
$skb->tstamp, your own embedded-c functions to fetch ktime_get_real()),
and see to what extent they all "line up".
- FChE