What does the reset=true do in the dump ant task?

579 views
Skip to first unread message

Spike

unread,
Apr 16, 2014, 2:16:38 AM4/16/14
to jac...@googlegroups.com
I have the following java agent options:

-javaagent:C:/JaCoCo/lib/jacocoagent.jar=output=tcpserver

I have the following ant task:

<jacoco:dump reset="true" destfile="jacoco.exec"/>

I run the dump task and a jacoco.exec file is created and I can then generate a report.

If I run the dump task again, the jacoco.exec file doubles in size.

If I run the dump task a third time, the jacoco.exec file trebles in size.

I realize the jacoco.exec file is being appended to, but I'm not sure if there is a duplication of execution data.

If I change the reset to false, I get exactly the same behaviour with the file size.

<jacoco:dump reset="false" destfile="jacoco.exec"/>

Could someone confirm that the reset="true" clears all execution data after dumping and that this same execution data isn't returned on a subsequent dump?

If that's not the case, what does reset do?

How do I get the java agent to clear the execution data?

Thanks.

Marc Hoffmann

unread,
Apr 16, 2014, 3:16:04 AM4/16/14
to jac...@googlegroups.com
Hi,

the 'reset' attribute controls whether execution data in the target JVM
is reset, i.e. all classes are marked as not executed after the dump.
The reset attribute has no influence on the written exec file.

There is another attribute 'append' which controls whether the retrieves
data is appended to an existing exec file or the exec file is
overwritten.

Please see documentatioon for details:
http://www.eclemma.org/jacoco/trunk/doc/ant.html#dump

Best regards,
-marc

gav...@gmail.com

unread,
Apr 16, 2014, 4:43:54 AM4/16/14
to jac...@googlegroups.com
Thanks Marc. I understand how the append attribute works but the reset doesn't seem to tally with what I see.

Just to make sure I understand, suppose there are execution data at the target JVM for the execution of MyClass.MyMethod. If I then do a dump with reset=true and retrieve these execution records and, assuming MyClass.MyMethod has not executed again, if I do another dump then there will be no execution data retrieved for MyClass.MyMethod.

Is that correct?

What I would like to achieve is to retrieve execution data periodically and append it to a file. In doing this, I don't want to retrieve execution data that I've already retrieved.

Thanks.

Marc Hoffmann

unread,
Apr 16, 2014, 12:21:22 PM4/16/14
to jac...@googlegroups.com
Hi,

there is a subtile difference: In the scenario you describe you will
still retrieve execution data, but the data says that your method has
not been executed.

It is not possible to actually not retrieve execution data for methods
that have not been executed. You always get execution data for all
classes which has been loaded into the JVM.

Cheers,
-marc

Spike

unread,
Apr 16, 2014, 4:42:30 PM4/16/14
to jac...@googlegroups.com
Ah, I see. That explains the file size. Ok, thanks a lot for the clarification.

On Thursday, April 17, 2014 2:21:22 AM UTC+10, Marc R. Hoffmann wrote:
> Hi,
>
>
>

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