Re: measure boot time

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

 



Hi Keppler ...

> Hi all ,
>    I created a simple module to measure boot time,that is loaded on last
> run level of my machine. Any comment about the code or a better way?
> thanks  ;)

Interesting experiment....let's see what I can suggest...

>         jiffiesinit=INITIAL_JIFFIES;
>         freq=HZ;
>         len += sprintf (buf+len, "timestamp-cpu freq (HZ) = %lu \n",freq);
>         len += sprintf (buf+len, "timestamp-jiffies init= %lu
> \n",jiffiesinit);
>         len += sprintf( buf+len, "timestamp-jiffies end = %lu \n",
> jiffiesend );
>         len += sprintf( buf+len, "timestamp-jiffies diff= %lu \n",
> (jiffiesend-jiffiesinit) );
>         len += sprintf (buf+len, "timestamp-boot time in sec  = %lu
> \n",((jiffiesend-jiffiesinit)/freq) );

from include/linux/jiffies.h:
#define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))

means that is 64 bit long type. So, instead of using:
         jiffiesend=jiffies;

IMHO you should use:
jiffiesend =  get_jiffies_64();

which will grab the 64 bit value of jiffies64 atomically on 32 bit CPU. On 64 
bit CPU, it will simply retrieve the jiffies64 value without using seqlock.

Other than that, I didn't find anything weird. Feel free to write further 
comments.

regards,

Mulyadi


--
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