Re: effects of measurement

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

 



getrusage gives stats for the entire process, very handy, but won't work if 
you just want to time a specific function or chunk of code.



On Thursday 11 July 2002 1:42 pm, Karthik M wrote:
> hi,
>
> u may probably want to check out getrusage() command.
> This calculates the time taken for the execution of
> commands just like the command time.
>
> time is a shell command i suppose but the getrusage()
> is a funtion in the kernel.
>
> I have tried it in the past but i had some problems
> with the accuracy of the results that it produces.
> Maybe i am doing something wrong.
>
> Has anyone else tried something with getrusage() ??
>
> TIA
>
> karthik
>
> --- Tom Bradley <tbradley@jaycor.com> wrote:
> > If you are timing things inside the kernel 'time'
> > won't give you what you
> > want, this is for timing user-land processes. I
> > would use the do_gettimeofday
> > function and store the values in a variable and use
> > a /proc entry to read
> > them. This will have the least interference with the
> > timings. This will also
> > let you do some stats on it, say longest time,
> > shortest time and average
> > time.
> >
> > Tom
> >
> >
> >
> > On Thursday 11 July 2002 11:26 am, Christine Ames
> >
> > wrote:
> > > --- Jonathan Khoo <jonath-k@is.aist-nara.ac.jp>
> >
> > wrote:
> > > > Hi guys,
> > > >
> > > > I want to measure the timings between various
> >
> > operations in the
> >
> > > > kernel
> > > > and the only way I know of is to use printk to
> >
> > output the timings.
> >
> > > > However, I also realize that by adding
> >
> > unnecessary printk
> >
> > > > statements
> > > > will affect the system performance. How can I
> >
> > measure the "actual"
> >
> > > > timings?
> > >
> > > Those more experienced will (please!) correct me
> >
> > if I am wrong:
> > > ]time your-command // will time start/end of a
> >
> > command
> >
> > > E.g. to "time" the command ls -l:
> > >
> > > [root@eng-03 wordbook] time ll
> > > total 692
> > > -rwxr-xr-x    1 root     root          516 Feb 28
> >
> > 06:00
> >
> > > dictionary.lst*
> > > -rwxr-xr-x    1 root     root         1809 Feb 28
> >
> > 06:00 en_US.aff*
> >
> > > -rwxr-xr-x    1 root     root       695724 Feb 28
> >
> > 06:00 en_US.dic*
> >
> > > real    0m0.245s
> > > user    0m0.010s
> > > sys     0m0.010s
> > >
> > > Harmony,
> > >
> > > --Christine
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Sign up for SBC Yahoo! Dial - First Month Free
> > > http://sbc.yahoo.com
> >
> > --
> > Kernelnewbies: Help each other learn about the Linux
> > kernel.
> > Archive:
> > http://mail.nl.linux.org/kernelnewbies/
> > FAQ:           http://kernelnewbies.org/faq/
>
> __________________________________________________
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
--
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