Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
*.out
profile*.pb.gz
core
*.dSYM
9 changes: 9 additions & 0 deletions thread/Thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#if __FreeBSD__
#include <pthread_np.h>
#elif __APPLE__
#include <mach/mach.h>
#else
#include <sys/prctl.h>
#include <linux/unistd.h>
Expand All @@ -37,6 +39,11 @@ pid_t gettid()
{
return pthread_getthreadid_np();
}
#elif __APPLE__
pid_t gettid()
{
return mach_thread_self();
}
#else
#if !__GLIBC_PREREQ(2,30)
pid_t gettid()
Expand Down Expand Up @@ -96,6 +103,8 @@ struct ThreadData
#if __FreeBSD__
// setname_np() costs as much as creating a thread on FreeBSD 13.
pthread_setname_np(pthread_self(), muduo::CurrentThread::t_threadName);
#elif __APPLE__
pthread_setname_np(muduo::CurrentThread::t_threadName);
#else
::prctl(PR_SET_NAME, muduo::CurrentThread::t_threadName);
#endif
Expand Down
15 changes: 8 additions & 7 deletions tpc/bin/tcpperf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ class BandwidthReporter

struct tcp_info tcpi = getTcpInfo(fd_);

// bytes_in_flight = tcpi.tcpi_bytes_sent - tcpi.tcpi_bytes_acked;
// tcpi.tcpi_notsent_bytes;
int snd_cwnd = tcpi.tcpi_snd_cwnd;
int ssthresh = tcpi.tcpi_snd_ssthresh;
#ifdef __linux
Expand All @@ -190,22 +188,25 @@ class BandwidthReporter
int retrans = tcpi.tcpi_total_retrans;
// int ca_state = tcpi.tcpi_ca_state;
int64_t pacing = tcpi.tcpi_pacing_rate;
int64_t delivery = tcpi.tcpi_delivery_rate;
//int64_t delivery = tcpi.tcpi_delivery_rate;
int bytes_in_flight = tcpi.tcpi_bytes_sent - tcpi.tcpi_bytes_acked - tcpi.tcpi_bytes_retrans + 1; // SYN
// tcpi.tcpi_notsent_bytes;
#elif __FreeBSD__
int retrans = tcpi.tcpi_snd_rexmitpack;
// int ca_state = tcpi.__tcpi_ca_state;
int64_t pacing = 0;
int64_t delivery = 0;
//int64_t delivery = 0;
int bytes_in_flight = 0;
#endif
int retr = retrans - last_retrans_;
last_retrans_ = retrans;

printf("%6s ", formatSI(pacing).c_str());
printf("%6s ", formatSI(delivery).c_str());
printf("%6sB ", formatIEC(bytes_in_flight).c_str());
printf("%6s ", formatIEC(snd_cwnd).c_str());
printf("%6s ", formatIEC(tcpi.tcpi_snd_wnd).c_str());
printf("%6s ", formatIEC(sndbuf).c_str());
printf("%7s ", formatIEC(ssthresh).c_str());
printf("%6sB ", formatIEC(ssthresh).c_str());
// printf("%2d ", ca_state);
printf("%5d ", retr);
printf("%s/%s", formatMicrosecond(tcpi.tcpi_rtt).c_str(),
Expand Down Expand Up @@ -268,7 +269,7 @@ void runClient(const InetAddress& serverAddr, int64_t bytes_limit,
stream->getPeerAddr().toIpPort().c_str(),
tcpi.tcpi_snd_mss, cong);
}
printf("Time (s) Transfer Bitrate Pacing Delivery Cwnd Rwnd sndbuf ssthresh Retr rtt/var\n");
printf("Time (s) Transfer Bitrate Pacing InFlight Cwnd Rwnd sndbuf ssthresh Retr rtt/var\n");

const Timestamp start = Timestamp::now();
const int block_size = 64 * 1024;
Expand Down