Hi,

First of all, many thanks for your amazing work on JaCoCo. :)

I'm trying to build a tool on the top of JaCoCo, and one of the features
requested is coverage per *unit* test case (and not the aggregated 
coverage).
What I've so far: I've created my own TestListener, and every time an
*atomic* test finishes I execute

byte[] b = RT.getAgent().getExecutionData(true);

and then (as suggested here 
<http://eclemma.org/jacoco/trunk/doc/examples/java/ExecDump.java>) I create 
a *dump* function that performs
the coverage analysis. something like:

final ByteArrayInputStream in = new ByteArrayInputStream(cov); // cov is 
the byte array from agent.dump()
final ExecutionDataReader reader = new ExecutionDataReader(in);

reader.setSessionInfoVisitor(new ISessionInfoVisitor() {
  public void visitSessionInfo(final SessionInfo info) {

    ExecFileLoader execFileLoader = new ExecFileLoader();
    execFileLoader.load(new ByteArrayInputStream(cov));

    final CoverageBuilder coverageBuilder = new CoverageBuilder();
    final Analyzer analyzer = new 
Analyzer(execFileLoader.getExecutionDataStore(), coverageBuilder);

    analyzer.analyzeAll(new File("__classes_directory__"));

    for (final IClassCoverage cc : coverageBuilder.getClasses()) {

      // perfom my coverage analysis

    }
  }
});
reader.setExecutionDataVisitor(new IExecutionDataVisitor() {
  public void visitClassExecution(final ExecutionData data) {
    // empty
  }
});

however, and because I'm calling my *dump* function thousands of times,
my coverage analysis is taking ages to finish. I've measured the CPU time
and, 45% is org.jacoco.core.internal.flow.MethodProbesAdapter.visitLabel(),
13% is org.jacoco.core.internal.analysis.SourceNodeImpl.incrementLine.


is there any better way of doing this? am I not using the right API 
functions?
in your opinion, how can I improve the performance of my coverage analysis?


--
Cheers,
Jose

-- 
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/762ac31f-641b-46ed-9d66-61956778e2b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to