Skip to content
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

Merged
merged 1 commit into from
Apr 30, 2019
Merged

Conversation

UdjinM6
Copy link

@UdjinM6 UdjinM6 commented Apr 26, 2019

No description provided.

@UdjinM6 UdjinM6 added this to the 14.0 milestone Apr 26, 2019
@@ -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;
Copy link

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?

Copy link

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.

Copy link
Author

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

Copy link

@gladcow gladcow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Copy link

@codablock codablock left a 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.

@UdjinM6 UdjinM6 merged commit dd39775 into dashpay:develop Apr 30, 2019
@UdjinM6 UdjinM6 deleted the morebench branch November 26, 2020 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants