Coverage Measurement and Profiling

“It is easier to optimize correct code, than correct optimized code.”—Yves Deville
KProf—A KDE GUI for gprof

KProf provides a KDE-based GUI for viewing gprof results. It is available from kprof.sourceforge.net and can be built with the standard ./configure; make; make install process.

After launching KProf, go to Filerarr;Open to open either an executable for which profiling measurements have been taken or a text file that contains a gprof report. If you open an executable, KProf assumes that the profiling data is contained in the current directory in gmon.out.

Figure 4 shows a view of KProf displaying the results from the fib example. The circular arrow by the Fibonacci results indicate the function is called recursively.

Figure 4. KProf Display

Zach Frey (zach@zfrey.com) works as an application engineer at New Eagle, a division of Mototron, in Ann Arbor, Michigan. He has more experience with software tests than he cares to admit, but he still finds improving software quality to be an interesting topic.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Is there any coverage tool

Neeraj's picture

Is there any coverage tool available that only works on source files and not on executables. I mean I dont want to compile the source files even once still I want to find out the coverage in the code.
Is it possible?

Please help. I'll really appreciate your effort if you get me any information regarding the matter.

Thanks!

help needed in installing ggcov

savita's picture

We have tried installing ggcov

we had followed following steps.

./configure (it satisfies our pc configuration)

make
make install

It is not getting installed properly...
How can we check it is properly installed or not....?
Is there any other steps to covered...

please kindly help

Regards
savita

hai, i understood your

Raja's picture

hai,
i understood your problem.....
me also struck with that problem but what i did was,
i just installed ggcov-06 instead of ggcov-08.....
in ggcov ,it is asking someother file which we could not get fro internet...
so better to go to install ggcov-06
thanks and regards,
Rajasekhar...

ggcov

Anonymous's picture

when i try to run ggcov in SUSE LINUX 10.1 using the command line ggcov ,i do not get any error message.but the results are not displayed.
the installation had no problems.
If anybody who is familiar with ggcov can give me a detailed idea about how to use this tool,please reply.

ggcov

Anonymous's picture

anybody kindly post a reply regarding how to implement ggcov

I could run ggcov successfully on the command prompt but I can't view any GUI.So please tell me the syntax/procedures of using ggcov.My linux version is SUSE 9.0

error on running kprof

lalitha's picture

when i try to make the kprof i am getting this errors..
Kindly help me to correct and run the application

parseprofile_pose.h:30: error: expected `)' before â&â token
parseprofile_pose.cpp:29: error: prototype for âCParseProfile_pose::CParseProfile_pose(QTextStream&, QPtrVector&)â does not match any in class âCParseProfile_poseâ
parseprofile_pose.h:28: error: candidates are: CParseProfile_pose::CParseProfile_pose(const CParseProfile_pose&)
parseprofile_pose.h:36: error: CParseProfile_pose::CParseProfile_pose()

need help for GCOV

Anonymous's picture

I have a problem:
I'm not able to gcc -fprofile-arcs -ftest-coverage file.c
Could you let me know how I can set environemt CFLAGS variable?
I have problem when I gcc on glib files i.e garray.c

please hel--

valgrind coverage

John Pye's picture

I thought I'd add a comment to say that some people are using Valgrind to do coverage testing using the 'cachegrind' tool.

Great article, a nice clear introduction to the topic.

Thanks

Anonymous's picture

Thanks very much for this informative example. I was surprised that 50% is about average for code coverage!

Re: Coverage Measurement and Profiling

Anonymous's picture

Very nice article, I enjoyed it and learned new (for me) methods

thanks a lot
b.

Don't forget lcov!

Anonymous's picture

lcov is a nice addition to gcof; like ggcov, it shows summaries
for multiple files. It goes beyond ggcov, I think, in that it
handles entire directory hierarchies. It can handle the Linux
kernel and Wine, for instance. It outputs HTML rather than
presenting a GUI, but that's kind of a plus in my book.
It's at ltp.sf.net/coverage/lcov.php

Re: Don't forget lcov!

ZachFrey's picture

Lcov does look very nice. My intent wasn't to do a comprehensive survey of tools, but to introduce the basics of gcov and gprof and give an example of a representative "add-on" for each.

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix