Class IOTracer
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.tool.iotrace.IOTracer
-
public class IOTracer extends java.lang.Object
This utility class allows collecting IO traces of read accesses to segments caused by reading specific items.An instance of
Trace
is 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 ...
Trace
implementations 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 void
collectTrace(@NotNull Trace trace)
Collect a IO trace.static @NotNull IOTracer
newIOTracer(@NotNull java.util.function.Function<IOMonitor,FileStore> fileStoreFactory, @NotNull java.io.Writer output, @Nullable java.lang.String contextSpec)
Create a newIOTracer
instance.void
setContext(@NotNull java.util.List<java.lang.String> context)
Set thecontext
to be added to each line of the IOTrace going forward.
-
-
-
Method Detail
-
newIOTracer
@NotNull public static @NotNull IOTracer newIOTracer(@NotNull @NotNull java.util.function.Function<IOMonitor,FileStore> fileStoreFactory, @NotNull @NotNull java.io.Writer output, @Nullable @Nullable java.lang.String contextSpec)
Create a newIOTracer
instance.- Parameters:
fileStoreFactory
- A factory for creating aFileStore
with the passedIOMonitor
for monitoring segment IO.output
- The target for the CSV formatted IO trace.contextSpec
- The specification of additional context provided by thetraces
beingrun
. A trace consists of a comma separated list of values, which must match the list of values passed tosetContext(List)
.- Returns:
- A new
IOTracer
instance.
-
collectTrace
public void collectTrace(@NotNull @NotNull Trace trace)
Collect a IO trace.- Parameters:
trace
-
-
setContext
public void setContext(@NotNull @NotNull java.util.List<java.lang.String> context)
Set thecontext
to 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
-
-
-