Many thanks for you valuable reply! Well, I worked it out by modifing the source code of jacoco-core. The result is right compare to the normal way, but I don't really understand the design. There may be some hiddden risk. I will explain how I did it later because I'm so busy recently. Maybe you can analyze whether I worked in the right way.
在 2019年12月26日星期四,Marc Hoffmann <[email protected]> 写道: > Hi Richard, > > thanks for your detailed and interesting question! > > JaCoC processes control flow information and probes at the same time (see > InstructionsBuilder used within MethodAnalyzer). Therefore even internally > we have no re-usable data structure. > > JaCoCo and the underlying ASM library has been designed for high > performance. Our tests show that the analyzer can process about 10,000 > classes per second. Do you see a similar performance? > > Not sure whether I understand your scenario correctly, but if you need to > process the same class file multiple times with different execution data it > might be worth to keep the raw data (byte[]) in memory to avoid repeated > reads from the file system. In any case I would be interested in some > performance profiling to see the bottle neck. > > Also it might be possible to create the data structure you’re looking for > by supplying a series of probe arrays with one boolean value set to true in > every iteration. > > In case you want to discuss about a public API we would need a better > understanding of your exact use case. Maybe you can show us a example > project e.g. on Github? > > Regards, > -marc > > > On 25. Dec 2019, at 10:28, Richard <[email protected]> wrote: > > > I have a large number of classes and execution data to analyze, and the > analyzing process using become so slow. Because everytime we analyze,we > need the class file and execution data. I suppose maybe there is a way to > cache the lines affected by the probe by analyze the class file, so I can > use this information along with the probe value contained in execution data > to calculate covered lines very quickly. > > the follow json can explain what I want to get: > "class information":{ > "efd7cf2868add1ad":{ > "name":"Sample", > "affectedLines":[ > [3,4,5],[6,7,9],[12,24] > ] > } > } > > with the execution data like this: > "execution data":{ > "efd7cf2868add1ad":{ > "name":"Sample", > "probes":[0,0,1] > } > } > > we can get the covered line is line 12 and line 14. > > I have dive into the source code, and I found the class > org.jacoco.core.internal.analysis.MethodAnalyzer may contain the > information in property coveredProbes, but this property is private. > Besides, I don't really understand the whole logic, so I'm here to ask for > some help. > > Well, I'm new to the open source world and It's my first time to ask > questions in English, maybe my question and expression is not very proper, > It will be appreciated if you point it out. > > -- > 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/aa83fdea-87ac-433a-bf32-abffeae85954%40googlegroups.com > <https://groups.google.com/d/msgid/jacoco/aa83fdea-87ac-433a-bf32-abffeae85954%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 [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/jacoco/AD91D491-A7DE-419F-BB99-BC1796D0BBC2%40mountainminds.com > <https://groups.google.com/d/msgid/jacoco/AD91D491-A7DE-419F-BB99-BC1796D0BBC2%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]. To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/CANz%3DmX-pTXyo-wsFtzxJUOGHENvcZi12GKhkvu5zVnQZsiMwgg%40mail.gmail.com.
