Hi Roger,

as I wrote in my answer you can set the “reset" parameter to true:

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

Regards,
-marc




> On 11. Jun 2023, at 06:52, Roger Hsu <[email protected]> wrote:
> 
> Hi Marc,
> Thanks for your answer, I am connecting to jacoco through port 6300 (TCP 
> mode), refer to the example of 
> https://www.jacoco.org/jacoco/trunk/doc/examples/java/ExecutionDataClient.java
>  
> <https://www.jacoco.org/jacoco/trunk/doc/examples/java/ExecutionDataClient.java>
> It provides writer.visitDumpCommand method, use for downloading data, but 
> there is no way to call IAgent.
> Not sure if I could call IAgent in remote control.
> 
> Regards,
> Roger
> 
> Marc Hoffmann <[email protected] 
> <mailto:[email protected]>> 于2023年6月11日周日 03:41写道:
> 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 <[email protected] 
>> <mailto:[email protected]>> 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 [email protected] 
>> <mailto:[email protected]>.
>> 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 a topic in the Google 
> Groups "JaCoCo and EclEmma Users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/jacoco/w4H0FidDjt4/unsubscribe 
> <https://groups.google.com/d/topic/jacoco/w4H0FidDjt4/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/4BBC44E1-2080-4747-AC17-C0FCC5C92BFE%40mountainminds.com
>  
> <https://groups.google.com/d/msgid/jacoco/4BBC44E1-2080-4747-AC17-C0FCC5C92BFE%40mountainminds.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 [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/CAKnZ7eT96ZjfYj2y_d_3YCcicKs8a11MeqnZ4fUZLJWaShZGug%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/jacoco/CAKnZ7eT96ZjfYj2y_d_3YCcicKs8a11MeqnZ4fUZLJWaShZGug%40mail.gmail.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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/A125F4AE-D9AB-48E7-81AB-658600620CBF%40mountainminds.com.

Reply via email to