-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
More "bench" log for Dash specific parts #2884
Conversation
@@ -68,6 +77,10 @@ bool CheckCbTxMerkleRoots(const CBlock& block, const CBlockIndex* pindex, CValid | |||
if (calculatedMerkleRoot != cbTx.merkleRootMNList) { | |||
return state.DoS(100, false, REJECT_INVALID, "bad-cbtx-mnmerkleroot"); | |||
} | |||
|
|||
int64_t nTime3 = GetTimeMicros(); nTimeMerkleMNL += nTime3 - nTime2; |
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.
It is not really important, but may be it is better to use the moment of time measured after previous LogPrint
instead of nTime2
to exclude the time needed to write previous record in log file?
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.
I've thought about it one more time, and now I think you are right: LogPrint
is a part of the investigated code and there is no real reason to exclude it.
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.
Well, technically your suggestion would be more precise :) But LogPrint
's overhead is pretty minimal (well, for heavy parts, but these are the actual parts we are interested in really).
int64_t nTime2 = GetTimeMicros(); nTimeDMN += nTime2 - nTime1;
LogPrint("bench", " - BuildNewListFromBlock: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimeDMN * 0.000001);
int64_t nTime2_1 = GetTimeMicros();
CSimplifiedMNList sml(tmpMNList);
int64_t nTime3 = GetTimeMicros(); nTimeSMNL += nTime3 - nTime2_1;
LogPrint("bench", " - CSimplifiedMNList: %.2fms [%.2fs] -- log overhead: %fms\n", 0.001 * (nTime3 - nTime2_1), nTimeSMNL * 0.000001, 0.001 * (nTime2_1 - nTime2));
int64_t nTime3_1 = GetTimeMicros();
...
int64_t nTime4 = GetTimeMicros(); nTimeMerkle += nTime4 - nTime3_1;
LogPrint("bench", " - CalcMerkleRoot: %.2fms [%.2fs] -- log overhead: %fms\n", 0.001 * (nTime4 - nTime3_1), nTimeMerkle * 0.000001, 0.001 * (nTime3_1 - nTime3));
testnet
CSimplifiedMNList: 0.42ms [0.04s] -- log overhead: 0.087000ms
CalcMerkleRoot: 1.56ms [0.01s] -- log overhead: 0.090000ms
mainnet
CSimplifiedMNList: 3.09ms [0.00s] -- log overhead: 0.049000ms
CalcMerkleRoot: 15.72ms [0.02s] -- log overhead: 0.061000ms
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.
utACK
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.
utACK...but I strongly suggest to give cxxtimer::Timer
a try next time. IMHO it makes the timing code much easier to understand.
No description provided.