Can Jacoco get real-time coverage instead getting it from .exec generated when the program exits?

372 views
Skip to first unread message

Tool Ply

unread,
Jan 19, 2018, 5:08:52 AM1/19/18
to JaCoCo and EclEmma Users
Thanks again Evgeny Mandrikov. Previously I raised the question Can Jacoco offline instrument .class file without source code? and your answer was indeed helpful so that I successfully figure out it. 

There is a new trouble. 

For now, we have instrumented .classs files offline and successfully got the coverage info from jacoco.exec generated after running directly or tcp. However, jacoco.exec was generated when the target program exit. It seems that we can not get the real-time coverage information with the program running.

Is there any way to achieve it?

Evgeny Mandrikov

unread,
Jan 19, 2018, 12:35:50 PM1/19/18
to JaCoCo and EclEmma Users

On Friday, January 19, 2018 at 11:08:52 AM UTC+1, Tool Ply wrote:
 It seems that we can not get the real-time coverage information with the program running.

No - you can.
 
Is there any way to achieve it?

Yes - there are plenty of ways, please see https://stackoverflow.com/a/48187961/244993 "Dump execution data at run time".

Evgeny Mandrikov

unread,
Jan 19, 2018, 12:39:00 PM1/19/18
to JaCoCo and EclEmma Users
An addition:
"In offline mode the JaCoCo runtime can be configured with the same set of properties which are available for the agent" 
and so which includes output=tcpserver, output=tcpclient, jmx=true as for agent, as well as direct runtime access to org.jacoco.agent.rt.RT

Tool Ply

unread,
Jan 21, 2018, 9:33:49 PM1/21/18
to jac...@googlegroups.com
Thanks

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/3c40a625-5fd7-4113-9515-0a012dd65809%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Tool Ply

unread,
Jan 23, 2018, 1:01:38 AM1/23/18
to jac...@googlegroups.com
both 'output=tcpserver' and 'output=tcpclient' are successful. 

When I tried to use 'jmx=true', The MBeanClient.java arise 'javax.naming.ServiceUnavailableException'. 
According to Jacoco jmx dump, Connection reset error,  I add some arguments for JVM to solve it. And in this way, MBeanClient works well on 'on the fly' mode and failed in 'offline' because the additional config '-Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false' was for JVM so that in offline mode, it cannot be config in 'jacoco_agent.properties'

How to fix it?

2018-01-20 1:38 GMT+08:00 Evgeny Mandrikov <mand...@gmail.com>:

Evgeny Mandrikov

unread,
Jan 23, 2018, 2:52:15 AM1/23/18
to JaCoCo and EclEmma Users


On Tuesday, January 23, 2018 at 7:01:38 AM UTC+1, Tool Ply wrote:
 '-Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false' was for JVM so that in offline mode, it cannot be config in 'jacoco_agent.properties'
  
Of course they can't since they are not JaCoCo properties, but JVM, thus set them as such: java -D...

Tool Ply

unread,
Jan 23, 2018, 6:26:13 AM1/23/18
to jac...@googlegroups.com
emmmm.... in fact, I want to find a way to config these JVM arguments without setting them in command line every time. It because that if I transform the instrumented jar to dex and repackage it to an apk, I will have no chance to set JVM argument in the Android system in order to get real-time coverage.

I have figure out it partly. In linux, I can config these arguments globally in  $JRE_PATH/lib/management/management.propertities. 

Any way, thanks a lot. I am still looking for the solution for Android.😶

--
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+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages