sanjay kumar
2006-Apr-09 15:19 UTC
[Xen-devel] reading time value in dom0 and domU kernels
Hi Folks, I want to calculate latency in transferring a buffer from domU kernel to dom0 kernel and vice versa. for that I need a time ''flavour'' (cycle counter time?) which reads the same in dom0 and domU. Could someone please let me know if cycle counter time is the right time to use? if not then which one (system time or wall clock time)? Also could someone please tell me how to read to read this timer value. if I use rdtsc() in both dom0 and domU, will it give me the same time value? Thanks, Sanjay -- ---------------------- PhD Student, Georgia Tech http://www.cc.gatech.edu/~ksanjay/ _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Apr-09 15:56 UTC
Re: [Xen-devel] reading time value in dom0 and domU kernels
On 9 Apr 2006, at 16:19, sanjay kumar wrote:> Hi Folks, > I want to calculate latency in transferring a buffer from domU kernel > to dom0 kernel and vice versa. for that I need a time ''flavour'' (cycle > counter time?) which reads the same in dom0 and domU. Could someone > please let me know if cycle counter time is the right time to use? if > not then which one (system time or wall clock time)? Also could > someone please tell me how to read to read this timer value. > > if I use rdtsc() in both dom0 and domU, will it give me the same time > value?It should be close enough as Xen attempts to synchronise the TSCs of all CPUs during boot and on most x86 platforms the TSCs will not diverge. If you''re measuring in the kernel then something like ''sched_clock()'' will get you system time in nanoseconds. That would be slightly preferable as system time is actively synchronised across all domains. With TSC you are winging it a tiny bit (although it''s usually an okay strategy on x86). -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
sanjay kumar
2006-Apr-15 04:21 UTC
Re: [Xen-devel] reading time value in dom0 and domU kernels
Hi Keir/All, If I want to measure time at the application level, is there any API available? can gettimeofday in domU give me real time value? Thanks, Sanjay On 4/9/06, Keir Fraser <Keir.Fraser@cl.cam.ac.uk> wrote:> > > On 9 Apr 2006, at 16:19, sanjay kumar wrote: > > > Hi Folks, > > I want to calculate latency in transferring a buffer from domU kernel > > to dom0 kernel and vice versa. for that I need a time ''flavour'' (cycle > > counter time?) which reads the same in dom0 and domU. Could someone > > please let me know if cycle counter time is the right time to use? if > > not then which one (system time or wall clock time)? Also could > > someone please tell me how to read to read this timer value. > > > > if I use rdtsc() in both dom0 and domU, will it give me the same time > > value? > > It should be close enough as Xen attempts to synchronise the TSCs of > all CPUs during boot and on most x86 platforms the TSCs will not > diverge. > > If you''re measuring in the kernel then something like ''sched_clock()'' > will get you system time in nanoseconds. That would be slightly > preferable as system time is actively synchronised across all domains. > With TSC you are winging it a tiny bit (although it''s usually an okay > strategy on x86). > > -- Keir > >-- ---------------------- PhD Student, Georgia Tech http://www.cc.gatech.edu/~ksanjay/ _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Pratt
2006-Apr-15 12:10 UTC
RE: [Xen-devel] reading time value in dom0 and domU kernels
> Hi Keir/All, > If I want to measure time at the application level, is there > any API available? can gettimeofday in domU give me real time value?On xen linux, gettimeofday will return an accurate ''wall clock'' time value Ian> On 4/9/06, Keir Fraser <Keir.Fraser@cl.cam.ac.uk> wrote: > > > On 9 Apr 2006, at 16:19, sanjay kumar wrote: > > > Hi Folks, > > I want to calculate latency in transferring a buffer > from domU kernel > > to dom0 kernel and vice versa. for that I need a time > ''flavour'' (cycle > > counter time?) which reads the same in dom0 and domU. > Could someone > > please let me know if cycle counter time is the right > time to use? if > > not then which one (system time or wall clock time)? > Also could > > someone please tell me how to read to read this timer value. > > > > if I use rdtsc() in both dom0 and domU, will it give > me the same time > > value? > > It should be close enough as Xen attempts to > synchronise the TSCs of > all CPUs during boot and on most x86 platforms the TSCs will not > diverge. > > If you''re measuring in the kernel then something like > ''sched_clock()'' > will get you system time in nanoseconds. That would be slightly > preferable as system time is actively synchronised > across all domains. > With TSC you are winging it a tiny bit (although it''s > usually an okay > strategy on x86). > > -- Keir > > > > > > > -- > ---------------------- > PhD Student, Georgia Tech > http://www.cc.gatech.edu/~ksanjay/ > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Seemingly Similar Threads
- [RESEND PATCH 1/3] x86/vmware: Use tsc_khz value for calibrate_cpu()
- [RESEND PATCH 1/3] x86/vmware: Use tsc_khz value for calibrate_cpu()
- [PATCH v3 0/3] x86/vmware guest improvements
- [PATCH v3 0/3] x86/vmware guest improvements
- [PATCH] [HVM] Fix virtual apic irq distribution