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

Remove outputDebugString, replace getComputerName #2414

Closed
wants to merge 1 commit into from
Closed

Remove outputDebugString, replace getComputerName #2414

wants to merge 1 commit into from

Conversation

mellery451
Copy link
Contributor

No description provided.

@ripplelabs-jenkins
Copy link
Collaborator

ripplelabs-jenkins commented Mar 1, 2018

Jenkins Build Summary

Built from this commit

Built at 20180315 - 19:42:11

Test Results

Build Type Log Result Status
docs logfile 1 cases, 0 failed, t: 2s PASS ✅
clang.debug.unity logfile 1003 cases, 0 failed, t: 244s PASS ✅
coverage logfile 1003 cases, 0 failed, t: 599s PASS ✅
clang.debug.unity,
PARALLEL_TESTS=false
logfile 1003 cases, 0 failed, t: 470s PASS ✅
clang.debug.nounity logfile 1001 cases, 0 failed, t: 264s PASS ✅
gcc.debug.unity logfile 1003 cases, 0 failed, t: 236s PASS ✅
gcc.debug.nounity logfile 1001 cases, 0 failed, t: 173s PASS ✅
clang.release.unity logfile 1002 cases, 0 failed, t: 326s PASS ✅
gcc.release.unity logfile 1002 cases, 0 failed, t: 342s PASS ✅
gcc.debug.unity
-Dstatic=true
logfile 1003 cases, 0 failed, t: 236s PASS ✅
msvc.debug logfile 999 cases, 0 failed, t: 550s PASS ✅
msvc.debug,
PROJECT_NAME=rippled_classic
logfile 999 cases, 0 failed, t: 1122s PASS ✅
msvc.release logfile 998 cases, 0 failed, t: 494s PASS ✅

Copy link
Collaborator

@bachase bachase left a comment

Choose a reason for hiding this comment

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

One question but 👍

@@ -377,9 +375,7 @@ class StatsDCollectorImp
assert (! s.empty ());
if (! buffers.empty () && (size + length) > max_packet_size)
{
#if BEAST_STATSDCOLLECTOR_TRACING_ENABLED
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was removing the BEAST_STATSDCOLLECTOR_TRACING_ENABLED here intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

intentional -- my reasoning is that log() is already a no-op unless this is defined, so I didn't see the point if the two-level macro check. Feel free to suggest otherwise if you think the check should remain however.

@scottschurr
Copy link
Collaborator

I think one of the two travis failures was caused by the vcxproj files being out of date. If that's correct, please run scons vcxproj and commit the results. Thanks.

@mellery451
Copy link
Contributor Author

@scottschurr thanks for noticing that...that was actually a failure to git push properly on my part. That said, I'm not certain the failure(s) are entirely due to the vs project, so let's see what one more build does. Also, travis will be a bit happier with the next develop branch (pending).

Copy link
Collaborator

@scottschurr scottschurr left a comment

Choose a reason for hiding this comment

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

This looks great.

Just for a bit of feature creep, I'll suggest removing getStackBacktrace() from SystemStats.h. Then you can nuke the entire file. I had to prove to myself it would be okay, so here's a commit if you'd like to cherry-pick: scottschurr@6ca3d27

//==============================================================================
/** Returns the host-name of the computer. */
std::string getComputerName();

//==============================================================================
/** Returns a backtrace of the current call-stack.
The usefulness of the result will depend on the level of debug symbols
Copy link
Collaborator

Choose a reason for hiding this comment

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

How would you feel about removing getStackBacktrace(), below, and removing this entire file. A grep suggests that getStackBacktrace() is unused and untested.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

slightly confusing, but getStackBacktrace() was already removed here: #2376 ...which is soon to be merged. There's probably a case to be made for merging to two PRs, but what I can do is just rebase and remove at that point.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There's definitely a case for merging the two Prs so we can actually delete SystemStats.h. Otherwise a rebase has the potential for leaving the file hanging around and empty.

}
//m_journal.trace << std::endl << ss.str ();
outputDebugString (ss.str ());
std::cerr << std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not a point I care deeply about, but there is a minor behavioral change here. Separate writes to cerr (vs accumulating in a stringstream and dumping the whole stringstream at once) will somewhat increases the likelihood of garbled output if there are multiple threads writing to cerr.

Personally, I think this change is fine. C++11 only guarantees that cerr won't be corrupted. The individual characters from the threads can still end up interleaved (see discussion here: https://stackoverflow.com/questions/6374264/is-cout-synchronized-thread-safe).

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for pointing this out - certainly very subtle, and could cause some head-scratching.

In the absence of a guarantee that something like std::cerr << "a single string"; won't interleave, I don't think it's a huge issue; as you said, it's all about probabilities, and I'm not sure we can quantify how much more or less probable the garbling would be.

Copy link
Contributor

Choose a reason for hiding this comment

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

std::cerr << std::endl; translates to std::cerr << '\n'; std::cerr.flush(); std::cerr.flush();. Prefer std::cerr << '\n';. You get the flush() implicitly with std::cerr.

@codecov-io
Copy link

codecov-io commented Mar 3, 2018

Codecov Report

Merging #2414 into develop will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2414      +/-   ##
===========================================
- Coverage    70.32%   70.31%   -0.01%     
===========================================
  Files          702      701       -1     
  Lines        53429    53426       -3     
===========================================
- Hits         37573    37566       -7     
- Misses       15856    15860       +4
Impacted Files Coverage Δ
src/ripple/beast/insight/impl/StatsDCollector.cpp 0.38% <ø> (-0.01%) ⬇️
src/ripple/beast/utility/src/beast_Debug.cpp 20% <ø> (ø) ⬆️
src/ripple/beast/core/CurrentThreadName.cpp 100% <ø> (ø) ⬆️
src/ripple/app/misc/NetworkOPs.cpp 63.7% <100%> (+0.02%) ⬆️
src/ripple/basics/DecayingSample.h 77.77% <0%> (-8.34%) ⬇️
src/ripple/protocol/impl/Serializer.cpp 70.06% <0%> (-0.35%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8648440...60ef793. Read the comment docs.

@@ -628,7 +628,7 @@ std::string
NetworkOPsImp::getHostId (bool forAdmin)
{
if (forAdmin)
return beast::getComputerName ();
return boost::asio::ip::host_name();
Copy link
Contributor

@nbougalis nbougalis Mar 7, 2018

Choose a reason for hiding this comment

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

Micro-optimization (although mostly aimed at ensuring the hostname doesn't change mid-execution), but should we do:

static std::string const hostname = boost::asio::ip::host_name();

if (forAdmin)
    return hostname;

@mellery451 mellery451 added the Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required. label Mar 15, 2018
@seelabs
Copy link
Collaborator

seelabs commented Mar 15, 2018

In 1.0.0-b2

@seelabs seelabs closed this Mar 15, 2018
@mellery451 mellery451 deleted the mellery-ods-remove branch March 15, 2018 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants