Class IOTracer
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.tool.iotrace.IOTracer
-
public class IOTracer extends Object
This utility class allows collecting IO traces of read accesses to segments caused by reading specific items.An instance of
Traceis used to specify a read pattern. Segment reads are recorded in CSV format:timestamp,file,segmentId,length,elapsed 1522147945084,data01415a.tar,f81378df-b3f8-4b25-0000-00000002c450,181328,171849 1522147945096,data01415a.tar,f81378df-b3f8-4b25-0000-00000002c450,181328,131272 1522147945097,data01415a.tar,f81378df-b3f8-4b25-0000-00000002c450,181328,142766 ...
Traceimplementations can specify an additional context, which is recorded with each line of the CSV output. A context is simply a list of additional fields as specified during instantiation of anIOTracer.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcollectTrace(@NotNull Trace trace)Collect a IO trace.static @NotNull IOTracernewIOTracer(@NotNull Function<IOMonitor,FileStore> fileStoreFactory, @NotNull Writer output, @Nullable String contextSpec)Create a newIOTracerinstance.voidsetContext(@NotNull List<String> context)Set thecontextto be added to each line of the IOTrace going forward.
-
-
-
Method Detail
-
newIOTracer
@NotNull public static @NotNull IOTracer newIOTracer(@NotNull @NotNull Function<IOMonitor,FileStore> fileStoreFactory, @NotNull @NotNull Writer output, @Nullable @Nullable String contextSpec)
Create a newIOTracerinstance.- Parameters:
fileStoreFactory- A factory for creating aFileStorewith the passedIOMonitorfor monitoring segment IO.output- The target for the CSV formatted IO trace.contextSpec- The specification of additional context provided by thetracesbeingrun. A trace consists of a comma separated list of values, which must match the list of values passed tosetContext(List).- Returns:
- A new
IOTracerinstance.
-
collectTrace
public void collectTrace(@NotNull @NotNull Trace trace)Collect a IO trace.- Parameters:
trace-
-
setContext
public void setContext(@NotNull @NotNull List<String> context)Set thecontextto be added to each line of the IOTrace going forward. The list of values needs to match the context specification passed tonewIOTracer(Function, Writer, String).- Parameters:
context-
-
-