use of org.apache.hyracks.control.common.job.profiling.om.PartitionProfile in project asterixdb by apache.
the class ProfilingPartitionWriterFactory method createFrameWriter.
@Override
public IFrameWriter createFrameWriter(final int receiverIndex) throws HyracksDataException {
final IFrameWriter writer = new ConnectorSenderProfilingFrameWriter(ctx, delegate.createFrameWriter(receiverIndex), cd.getConnectorId(), senderIndex, receiverIndex);
return new IFrameWriter() {
private long openTime;
private long closeTime;
MultiResolutionEventProfiler mrep = new MultiResolutionEventProfiler(N_SAMPLES);
@Override
public void open() throws HyracksDataException {
openTime = System.currentTimeMillis();
writer.open();
}
@Override
public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
mrep.reportEvent();
writer.nextFrame(buffer);
}
@Override
public void fail() throws HyracksDataException {
writer.fail();
}
@Override
public void close() throws HyracksDataException {
closeTime = System.currentTimeMillis();
try {
((Task) ctx).setPartitionSendProfile(new PartitionProfile(new PartitionId(ctx.getJobletContext().getJobId(), cd.getConnectorId(), senderIndex, receiverIndex), openTime, closeTime, mrep));
} finally {
writer.close();
}
}
@Override
public void flush() throws HyracksDataException {
writer.flush();
}
};
}
Aggregations