Skip to content

Commit

Permalink
More logs for estimating rtt offset
Browse files Browse the repository at this point in the history
  • Loading branch information
pawsten committed Nov 22, 2024
1 parent 299663b commit d246e8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(CMAKE_CXX_EXTENSIONS FALSE)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if(DEFINED CONAN_DEPS)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
Expand Down
18 changes: 7 additions & 11 deletions libnettracer/src/offsetguess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool OffsetGuessing::makeGuessingAttempt(int status_fd) {
// which in turn are called in kretprobe tcp_v(4|6)_connect

uint64_t pid_tgid = (uint64_t)getpid() << 32 | syscall(SYS_gettid);
logger->debug("guess thread pid: {:d}", pid_tgid);
logger->trace("guess thread pid: {:d}", pid_tgid);

// prepare server ipv4 and client ipv6 on this thread
localsock = startLocalSock();
Expand Down Expand Up @@ -107,7 +107,6 @@ bool OffsetGuessing::makeGuessingAttempt(int status_fd) {

// limit how many failed attempts at communicating with the BPF side are accepted
int maxRetries = 100;

unsigned rttCurrentAttempts = 0;
unsigned rttCurrentReps = 0;

Expand Down Expand Up @@ -208,6 +207,7 @@ bool OffsetGuessing::makeGuessingAttempt(int status_fd) {
return false;
}
}
logger->debug("offsets status: {:d}", status.what);
return true;
}

Expand Down Expand Up @@ -275,17 +275,12 @@ bool OffsetGuessing::guessRTT(unsigned& currentAttempts, unsigned& currentReps,
logger->error("Couldn't restart client for RTT guessing");
return false;
}
try {
auto expectedOpt{getExpectedValues(skipIPv6)};
if (!expectedOpt) {
return false;
}
expected = *expectedOpt;
}
catch (const std::runtime_error& ex) {
logger->error(ex.what());
auto expectedOpt{getExpectedValues(skipIPv6)};
if (!expectedOpt) {
return false;
}
logger->debug("Updating expected RTT: {:d},{:d} -> {:d},{:d} ", expected.rtt, expected.rtt_var, expectedOpt->rtt, expectedOpt->rtt_var);
expected = *expectedOpt;
status.rtt = expected.rtt;
status.rtt_var = expected.rtt_var;
status.state = GUESS_STATE_CHECKING;
Expand All @@ -307,6 +302,7 @@ bool OffsetGuessing::guessRTT(unsigned& currentAttempts, unsigned& currentReps,
status.rtt = expected.rtt;
status.rtt_var = expected.rtt_var;
status.state = GUESS_STATE_CHECKING;
logger->trace("current RTT offset: {:d}", status.offset_rtt);
}
return true;
}
Expand Down

0 comments on commit d246e8f

Please sign in to comment.