Hi Roger,

our APIs support resetting coverage data. Depending on how you integrate with 
JaCoCo the relevant APIs are:

Runtime API (in process) / JMX

IAgend.reset() 
<https://www.jacoco.org/jacoco/trunk/doc/api/org/jacoco/agent/rt/IAgent.html#reset()>

Also note that the dump() method in the same interface has an boolean parameter 
to control whether execution data should be reset after the dump.

Remote Protocol

RemoteControlWriter.visitDumpCommand(boolean dump, boolean reset) 
<https://www.jacoco.org/jacoco/trunk/doc/api/org/jacoco/core/runtime/RemoteControlWriter.html#visitDumpCommand(boolean,%20boolean)>

With the reset parameter set tu true this command will trigger a reset.


Regards,
-marc



> On 10. Jun 2023, at 11:42, Roger Hsu <xu.s...@gmail.com> wrote:
> 
> Hello everyone, I am a newbie to Jacoco. Currently I want to use Jacoco to 
> dynamically track all the methods and classes that are called when performing 
> some tasks.
> However, Jacoco does not provide a direct reset command, which means that the 
> output of the dump command will contain a lot of useless information, is 
> there any way to clear the coverage history directly?
> 
> I built a REST API application for this, first, it connects to Jacoco Agent, 
> when I request a certain endpoint of the REST application, it starts logging 
> all the coverage information (as it is), then, I visit another endpoint , 
> will stop logging and export coverage information.
> 
> The problem is that I can't guarantee that no code will be executed when I 
> start recording coverage information. So I need to manually remove the 
> interference.
> 
> Any suggestions?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jacoco+unsubscr...@googlegroups.com 
> <mailto:jacoco+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/72c25eb6-9067-4af1-bce6-fa4242d0a579n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jacoco/72c25eb6-9067-4af1-bce6-fa4242d0a579n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/4BBC44E1-2080-4747-AC17-C0FCC5C92BFE%40mountainminds.com.

Reply via email to