Skip to content

Commit

Permalink
Add some trace logging for soroban tx
Browse files Browse the repository at this point in the history
  • Loading branch information
jayz22 committed May 7, 2024
1 parent a8b2734 commit 905fb74
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/transactions/InvokeHostFunctionOpFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,14 @@ InvokeHostFunctionOpFrame::doApply(Application& app, AbstractLedgerTxn& ltx,
metrics.mCpuInsnExclVm = out.cpu_insns_excluding_vm_instantiation;
metrics.mInvokeTimeNsecsExclVm =
out.time_nsecs_excluding_vm_instantiation;

CLOG_TRACE(Tx, "invokeTimeNsecs: {}, cpuInsn: {}, ratio: {}",
metrics.mInvokeTimeNsecs, metrics.mCpuInsn,
(float)metrics.mInvokeTimeNsecs / (float)metrics.mCpuInsn);
CLOG_TRACE(Tx, "(excl VM) invokeTimeNsecs: {}, cpuInsn: {}, ratio: {}",
metrics.mInvokeTimeNsecsExclVm, metrics.mCpuInsnExclVm,
(float)metrics.mInvokeTimeNsecsExclVm /
(float)metrics.mCpuInsnExclVm);
if (!out.success)
{
maybePopulateDiagnosticEvents(appConfig, out, metrics);
Expand Down
6 changes: 6 additions & 0 deletions src/transactions/TransactionFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1950,6 +1950,12 @@ TransactionFrame::apply(Application& app, AbstractLedgerTxn& ltx,

ok = applyOperations(signatureChecker, app, ltx, meta,
sorobanBasePrngSeed);

if (isSoroban())
{
CLOG_TRACE(Tx, "Soroban transaction meta: {}",
xdr::xdr_to_string(meta.getXDR(), "meta"));
}
}
return ok;
}
Expand Down

0 comments on commit 905fb74

Please sign in to comment.