|
|
|
RE: How to measure performance inside Kernel? | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
> -----Original Message-----
> From: kernelnewbies-bounces@xxxxxxxxxxxxxxxxx [mailto:kernelnewbies-
> bounces@xxxxxxxxxxxxxxxxx] On Behalf Of Peter Senna Tschudin
> Sent: Friday, February 10, 2012 1:48 PM
> To: kernelnewbies@xxxxxxxxxxxxxxxxx
> Subject: Re: How to measure performance inside Kernel?
>
> Dear list,
>
> As Michi suggested, I did some testing with ktime.h, but I found a
> simpler solution with time.h.
>
> I'm not sure if it is correct, and I would like to have some help...
:-)
>
> The code that I'm using for execution time measurement is:
>
> #include <linux/time.h>
>
> getnstimeofday (ts_start); /*stopwatch start*/
>
> for (i = 0; i < q->num_buffers; ++i)
> q->bufs[i]->state = VB2_BUF_STATE_DEQUEUED;
>
> getnstimeofday (ts_end); /*stopwatch stop*/
>
> diff = timespec_sub(end, begin);
>
> printk ("%lu,", diff.tv_nsec );
>
> Am I doing anything wrong? Can mysterious stuff like out of order
> execution engine, brake the stopwatch?
>
> The full module code is at: http://goo.gl/cCMIa
>
> Thank you!
>
> Peter
If you didn't disable interrupts before executing the above, the timing
of the above loop would include any time spent servicing interrupts.
Likewise if there were context switches or soft IRQs running. All would
inflate the perceived time to execute your loop.
Jeff Haran
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
[Newbies FAQ] [Linux Kernel Development] [IETF Annouce] [Git] [Networking] [Security] [Bugtraq] [Photo] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux Networking] [Linux RAID] [Linux SCSI] [Linux ACPI]
![]() |
![]() |