Jacoco Coverage Collection Details

45 views
Skip to first unread message

way...@uw.edu

unread,
Feb 26, 2018, 11:47:54 PM2/26/18
to JaCoCo and EclEmma Users
Hi, I am currently using Jacoco to measure branch coverage and would like to understand a couple implementation details that aren't addressed at http://www.jacoco.org/jacoco/trunk/doc/implementation.html.

Specifically, how does Jacoco record coverage information and in what manner is this information organized? Is this data stored on disk and is it permanent so that I can access it after the runtime exits?

For instance, does Jacoco write to a log that is on-disk when recording changes in coverage as a program is running? If there is a log, is this log sequential in that it records accesses to branches. Or alternatively, is there a data structure that's being represented on a file on disk that maps from each method to its branch coverage information? Or finally, is all "logging" done with data structures in memory?

If there are resources addressing these topics, I would be interested in them as well. Thank you!

Marc Hoffmann

unread,
Feb 27, 2018, 12:13:39 AM2/27/18
to jac...@googlegroups.com
Hi,

> Specifically, how does Jacoco record coverage information and in what
> manner is this information organized?

JaCoCo records coverage by instrumenting the classes and inserting
probes. How probes are inserted and how coverage information is derived
from it is described here:

http://www.jacoco.org/jacoco/trunk/doc/flow.html

> Is this data stored on disk and is it permanent so that I can access it
> after the runtime exits?

By default the JaCoCo agent stores it as a "exec" file on disk.

> For instance, does Jacoco write to a log that is on-disk when recording
> changes in coverage as a program is running?

Probe execution data is only written when the JVM terminates (or on user
request).

> is there a data structure that's being represented on a file on disk
> that maps from each method to its branch coverage information?

Not in the exec file. Exec files basically contain a boolean array of
probe execution status. All coverage counters (including branch
coverage) are calculated at analysis time using the strategy described
in the link above.

Regards,
-marc

sophia0...@gmail.com

unread,
Nov 22, 2018, 2:52:17 AM11/22/18
to JaCoCo and EclEmma Users
在 2018年2月27日星期二 UTC+8下午1:13:39,Marc R. Hoffmann写道:
hi,i just want to get jacoco execution data ---java.exec file only,without report and hope all the java classes in the project can be covered. do you know how to do it? beside, i use ant, and just can make configuration in the build.xml.

Regards,
Sophia

Marc Hoffmann

unread,
Nov 22, 2018, 4:59:52 AM11/22/18
to jac...@googlegroups.com
Hi Sophia,

> do you know how to do it?

Yes I know how to do it. That's why I wrote dcumentation:
https://www.jacoco.org/jacoco/trunk/doc/ant.html

Simply don't use the report task if the plain *.exec file is enough for
you.

Regards,
-marc
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages