How Trace Are Generated and Stored - llmhyy/microbat GitHub Wiki

Trace Generation

An execution can result in at least one trace. Note that, we can have multiple traces for a concurrent execution. As mentioned in the section of instrumentation , we use Java instrumentation technique to keep the trace. However, the trace can be very long, thus we shall have external algorithm to store the partial trace on the fly.

//TODO details of external algorithm to store the partial trace on the fly:

Trace Storage

Now, we have two modes to store the traces, i.e., file storage and database storage.

File Storage

We use Java serialization technique to store a set of traces into the file.

Relevant classes: microbat.instrumentation.output.TraceOutputReader

Relevant classes: microbat.instrumentation.output.TraceOutputWriter

Note that the order to write a field is strictly defined in the code. If the user would like to modify the file storage, the order of writing a field (e.g., the isMain field in aTrace object) should be the same as the order of reading the corresponding field. For example, if we write the trace object with the following order:

writeString(projectName);
writeString(projectVersion);
writeString(launchClass);

Then, we should read the fields with exactly the same order.

readString(); // read projectName
readString(); // read projectVersion
readString(); // read launchClass

Database Storage

//TODOs