Re: OT: recommended way of timing two pieces of code in C

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

 



On Fri, 2016-02-26 at 12:40 -0600, Ranjan Maitra wrote:
> > I don't claim to be an expert but at first glance I wonder if
> you've
> > defined what you mean by efficiency. Execution time? Program size?
> > Memory locality (affects virtual memory performance) etc.
> 
> I responded to this on another thread, but I am interested in the
> amount of time taken by a program in executing a set of instructions.
> If that includes memory allocation, etc, then fine. 

Sorry, still not clear. Memory allocation is done by a combination of
library functions and system calls. You need to know what you're trying
to measure if your measurements are going to mean anything. The numbers
you get can be change a lot between a first run and subsequent runs of
the same program (because of cache effects), so you need to decide how
much that matters.

> > You might want to read some of the extensive literature on
> > benchmarking.
> 
> I have found the literature extremely confusing and unclear.

Perhaps if you asked specific questions about what you find confusing,
people could help you understand.

> OK, is there a way to calculate the FLOP instructions in C?

What do you mean "calculate the FLOP instructions"? Are you trying to
evaluate an algorithm or benchmark an implementation? These are two
different things. You can compare algorithms theoretically or by
measurement, but only measurement will work for implementations. You
can count each floating point instruction generated by the compiler by
looking at the binary code, but maybe you want to count every
instruction during execution, or see which instructions take longer, or
just measure the total execution time of the algorithm on a given set
of input. All of these things are different and need different
techniques to measure them. The degree of accuracy you need will also
have an effect.

poc
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux