Re: GetTimeOfDay Question

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

 



The better way yo find the difference of jiffies.

do the following:

unsigned long time, time_in_sec;
time = jiffies;
data_transfer();
time = jiffies - time;
time_in_sec = time / HZ;



- Gaurav


On Tue, 22 Mar 2005 06:35:40 -0800, Suneel Kandru
<suneel.kandru@xxxxxxxxxxxxxxxxxxx> wrote:
>  
> I want to find the data transfer time 
>   
> I have code like this  
>   
>  
> 
>   timeRetVal = gettimeofday(&tp,&tz);
>   if(timeRetVal != -1)
>         lStartTime = tp.tv_usec; 
> 
> Transferdata(); 
> 
>   timeRetVal = gettimeofday(&tp,&tz);
>   if(timeRetVal != -1)
>   {
>        lEndTime = tp.tv_usec;
>        } 
> 
> lTime = lEndTime - lStartTime; 
> 
>   
> 
> How come some times lEndTime value is less than lStartTime value is there
> any other function to get the tick count. 
>  
> 
> Thanks
>       
>   
>   
>   
>   
> 
>   
>

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