-
Notifications
You must be signed in to change notification settings - Fork 970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some trace logging for Soroban #4305
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, minor nitpicks
if (isSoroban()) | ||
{ | ||
CLOG_TRACE(Tx, "Soroban transaction meta: {}", | ||
xdr::xdr_to_string(meta.getXDR(), "meta")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: use xdrToCerealString
CLOG_TRACE(Tx, "(excl VM) invokeTimeNsecs: {}, cpuInsn: {}, ratio: {}", | ||
metrics.mInvokeTimeNsecsExclVm, metrics.mCpuInsnExclVm, | ||
(float)metrics.mInvokeTimeNsecsExclVm / | ||
(float)metrics.mCpuInsnExclVm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: C++ Style cast. We also only need to cast one of the numerator or denominator. Finally since this is just logs, why not use double for extra precision?
CLOG_TRACE(Tx, "(excl VM) invokeTimeNsecs: {}, cpuInsn: {}, ratio: {}", | ||
metrics.mInvokeTimeNsecsExclVm, metrics.mCpuInsnExclVm, | ||
(float)metrics.mInvokeTimeNsecsExclVm / | ||
(float)metrics.mCpuInsnExclVm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to protect against divide by zero here? Something like
metrics.mCpuInsnExclVm ? metrics.mInvokeTimeNsecsExclVm / (float)metrics.mCpuInsnExclVm : 0f
Description
Some useful trace logging improvements when I was troubleshooting spikes in the Soroban (time cpu ratio) metrics.
Checklist
clang-format
v8.0.0 (viamake format
or the Visual Studio extension)