Thought this was interesting. At least this info is now in the RTEMS
archives.

---------- Forwarded message ---------
From: Jim Wilson <j...@sifive.com>
Date: Thu, Aug 9, 2018, 1:26 PM
Subject: Re: gcov questions
To: daro...@o2.pl <daro...@o2.pl>, g...@gcc.gnu.org <g...@gcc.gnu.org>


On 08/09/2018 02:38 AM, daro...@o2.pl wrote:
> Hello,   I wanted to ask what model for
> branch coverage does gcov use?

There is a comment at the start of gcc/profile.c that gives some details
on how it works.  It is computing execution counts for edges in the
control flow graph.  As for which edges get instrumented, basically, you
construct a control flow graph, create a minimal spanning tree to cover
the graph, and then you only need to instrument the edges not on the
spanning tree, plus the function entry point.  You can compute the rest
of the edge counts from that.  Then there are some tricks to improve
efficiency by putting frequently executed edges on the minimal spanning
tree, so that infrequently edges get instrumented.

Gcov was originally written in 1990, based on an idea that came from
Knuth's Art of Computer Programming.  Ball & Larus wrote a nice paper in
1994 that does a good job of covering the methods used, though they may
not have been aware of gcov at the time as it hadn't been accepted into
GCC yet.  This is "Optimally Profiling and Tracing Programs" TOPLAS July
1994.  I don't know if there are free copies of that available.  There
may be better references available now, as these techniques are pretty
widely known nowadays

Jim
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to