Skip to content

Commit

Permalink
Print time
Browse files Browse the repository at this point in the history
  • Loading branch information
eolivelli committed May 16, 2024
1 parent 1887c44 commit 98a3d25
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3289,6 +3289,7 @@ private static ByteBuf toByteBuf(LightMLDataFormats.PositionInfo pi) {
}

void persistPositionToLedger(final LedgerHandle lh, MarkDeleteEntry mdEntry, final VoidCallback callback) {
long now = System.nanoTime();
PositionImpl position = mdEntry.newPosition;

LightMLDataFormats.PositionInfo pi = piThreadLocal.get();
Expand All @@ -3307,10 +3308,13 @@ void persistPositionToLedger(final LedgerHandle lh, MarkDeleteEntry mdEntry, fin

requireNonNull(lh);
ByteBuf rawData = toByteBuf(pi);
long endSer = System.nanoTime();

// rawData is released by compressDataIfNeeded if needed
ByteBuf data = compressDataIfNeeded(rawData, lh);

long endCompress = System.nanoTime();

int maxSize = 1024 * 1024;
int offset = 0;
final int len = data.readableBytes();
Expand All @@ -3321,6 +3325,12 @@ void persistPositionToLedger(final LedgerHandle lh, MarkDeleteEntry mdEntry, fin
ledger.getName(), name, lh.getId(),
position, len, numParts);
}
log.info("[{}] Cursor {} Appending to ledger={} position={} data size {} bytes, "
+ "numParts {}, serializeTime {} ms"
+ " compressTime {} ms, total {} ms", ledger.getName(), name, lh.getId(),
position, len, numParts,
(endSer - now) / 1000000,
(endCompress - endSer) / 1000000, (endCompress - now) / 1000000);

if (numParts == 1) {
// no need for chunking
Expand All @@ -3335,7 +3345,7 @@ void persistPositionToLedger(final LedgerHandle lh, MarkDeleteEntry mdEntry, fin
boolean isLast = part == numParts - 1;

if (log.isDebugEnabled()) {
log.info("[{}] Cursor {} Appending to ledger={} position={} data size {} bytes, numParts {} "
log.debug("[{}] Cursor {} Appending to ledger={} position={} data size {} bytes, numParts {} "
+ "part {} offset {} len {}",
ledger.getName(), name, lh.getId(),
position, len, numParts, part, offset, currentLen);
Expand Down

0 comments on commit 98a3d25

Please sign in to comment.