Re: jiffies doesn't increase while doing mdelay() ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

--- James Yu <cyu021@xxxxxxxxx> escreveu:

> Dear all,
> 
> I am doing the following in a kernel thread :
> 
> ===== code segment=====
> prink("before mdelay:%d, ", jiffies);
> mdelay(300); // delay 300ms
> printk("after mdelay:%d\n", jiffies);
> ===== code segment=====
> 
> However, jiffies before and after doing mdelay are the same!!!
> Can someone please explain why jiffies doesn't change ?

Probably between these 2 printks, no tick happened, so the jiffies
value was not incremented. Jiffies is incremented when a tick happens.
Perhaps you can check how is defined the HZ (depends on the arch) in
your kernel and figure out the frequency of tick rate.

I had this same problem when I tried to measure some stuffs in the
schedule. Jiffies did not change in some situations. So I used
sched_clock() that provide the time in nanoseconds.

BR,

Mauricio Lin.

> Cheers,
> --
> James
> cyu021@xxxxxxxxx
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 



	
	
		
____________________________________________________


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux