Hello:
I wanted to know the format of the "raw" file generated by emmarun, which is, by default coverage.es.
Is there any standard structure that is followed in writing this file? I know "emma report" opens this and decodes to generate HTML or TEXT report, but to make our own code to decode this I need to know the format/structure of this data.
Thanks!
Isaac
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The *.ec, *.es and *.em files are serialized EMMA Java objects. To load them start with the following API:
com.vladium.emma.data.DataFactory
The meta data files and the corresponding APIs (com.vladium.emma.data.IMetaData) describe the mapping between basic blocks ad line numbers. To explore EMMA APIs I recommend fetching the sources from the CVS repository.
Best regards,
-marc
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have dug around com.vladium.instr.InstrVisitor.java. What I could understand is that it instruments the class file and also keeps track of leader for every block. Basically for branch coverage I need to take care of opcodes corresponding to ifXXX. Can you suggest me a way to achieve this? As in how the instrumentation could be done? And is there a way of determining the number of cases in a switch from the corresponding opcode?
Thanks and Regards
Arnav
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
actually I'm currently doing research on exactly this topic for the JaCoCo project. EMMA implements basic block coverage by inserting a probe at the end of every basic block. For example in case of ifXXX the probe is inserted right before this opcode. For branch coverage we would need a probe for each possible outcome of ifXXX, i.e. one probe after the opcode and one probe at the jump target (making sure that the same jump target is not addressed from some other branches too).
The same holds true for switch opcodes: You need a probe at every target defined by the switch instruction.
-marc
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had a look at JaCoCo project. Looks like it is exactly what Emma should be doing. I am still struggling to decipher the bytecode instrumentation that Emma performs. Currently I am only able to find out the branches present in the code. I am not sure how RT class traces the control flow using a method called r(), a call to which is injected in the beginning of each block. Anyway I will dig some more and try to figure out the mechanism. Will need your help in future.
Thanks and regards,
Arnav
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The purpose of the RT.r() method is to register a boolean instance with the runtime. Each instrumented class creates this structure to store visited blocks by setting the corresponding entry to true. The runtime itself does not trace the control flow, it simply holds references to these data structures and writes them as the vm exits.
-marc
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well now I understand how it works to some extent. But the problem I am facing is this - more than one branches may have the same leader as their target. So how do I differentiate, execution of exactly which branch caused the control flow to reach that particular target.
Thanks and regards,
Arnav
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You won't get branch coverage with the date provided by EMMA. As you already stated you would need to collect additional or different probe data: EMMA sets a single probe at the end of every block. For branch coverage you would need a separate probe for each possible outcome of a block.
-marc
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello:
I wanted to know the format of the "raw" file generated by emmarun, which is, by default coverage.es.
Is there any standard structure that is followed in writing this file? I know "emma report" opens this and decodes to generate HTML or TEXT report, but to make our own code to decode this I need to know the format/structure of this data.
Thanks!
Isaac
Hi all,
Same problem here and some more. I want to understand how Emma maps line number to blocks. I want to add branch coverage reporting in Emma.
Thanks,
Arnav
The *.ec, *.es and *.em files are serialized EMMA Java objects. To load them start with the following API:
com.vladium.emma.data.DataFactory
The meta data files and the corresponding APIs (com.vladium.emma.data.IMetaData) describe the mapping between basic blocks ad line numbers. To explore EMMA APIs I recommend fetching the sources from the CVS repository.
Best regards,
-marc
Hi Marc,
Thanks a lot for the response. I have already downloaded the source and I am exploring the API. Will get back with more questions later.
Regards,
Arnav
Thanks Marc for the help and information.
I will play with those APIs and will post how it worked.
Regards,
Isaac
Hi Marc,
I have dug around com.vladium.instr.InstrVisitor.java. What I could understand is that it instruments the class file and also keeps track of leader for every block. Basically for branch coverage I need to take care of opcodes corresponding to ifXXX. Can you suggest me a way to achieve this? As in how the instrumentation could be done? And is there a way of determining the number of cases in a switch from the corresponding opcode?
Thanks and Regards
Arnav
Hi Arnav,
actually I'm currently doing research on exactly this topic for the JaCoCo project. EMMA implements basic block coverage by inserting a probe at the end of every basic block. For example in case of ifXXX the probe is inserted right before this opcode. For branch coverage we would need a probe for each possible outcome of ifXXX, i.e. one probe after the opcode and one probe at the jump target (making sure that the same jump target is not addressed from some other branches too).
The same holds true for switch opcodes: You need a probe at every target defined by the switch instruction.
-marc
Hi Marc,
I had a look at JaCoCo project. Looks like it is exactly what Emma should be doing. I am still struggling to decipher the bytecode instrumentation that Emma performs. Currently I am only able to find out the branches present in the code. I am not sure how RT class traces the control flow using a method called r(), a call to which is injected in the beginning of each block. Anyway I will dig some more and try to figure out the mechanism. Will need your help in future.
Thanks and regards,
Arnav
The purpose of the RT.r() method is to register a boolean instance with the runtime. Each instrumented class creates this structure to store visited blocks by setting the corresponding entry to true. The runtime itself does not trace the control flow, it simply holds references to these data structures and writes them as the vm exits.
-marc
Hi Marc,
Well now I understand how it works to some extent. But the problem I am facing is this - more than one branches may have the same leader as their target. So how do I differentiate, execution of exactly which branch caused the control flow to reach that particular target.
Thanks and regards,
Arnav
You won't get branch coverage with the date provided by EMMA. As you already stated you would need to collect additional or different probe data: EMMA sets a single probe at the end of every block. For branch coverage you would need a separate probe for each possible outcome of a block.
-marc