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 42d6574
Show file tree
Hide file tree
Showing 2 changed files with 15 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
7 changes: 7 additions & 0 deletions src/transactions/TransactionFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "util/GlobalChecks.h"
#include "util/Logging.h"
#include "util/ProtocolVersion.h"
#include "util/XDRCereal.h"
#include "util/XDROperators.h"
#include "util/XDRStream.h"
#include "xdr/Stellar-contract.h"
Expand Down Expand Up @@ -1950,6 +1951,12 @@ TransactionFrame::apply(Application& app, AbstractLedgerTxn& ltx,

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

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

0 comments on commit 42d6574

Please sign in to comment.