Closed Pusnow closed 1 year ago
Can one of the admins verify this patch?
bot:retest
Hi,I've updated the codes.
Done!
@Pusnow There is compilation failure when enabling extra api.
Compilation error:
src/sockperf.cpp: In function ‘bool is_unspec_addr(const sockaddr_store_t&)’:
src/sockperf.cpp:3068:18: error: ‘const struct sockaddr_store_t’ has no member named ‘ss_family’
switch (addr.ss_family) {
^~~~~
make[2]: [Makefile:688: src/sockperf.o] Error 1
make[2]: Waiting for unfinished jobs....
Note:
configure --prefix=$PWD/install --enable-extra-api CPPFLAGS=-I
I fixed the compilation error. Would you verify the patch?
Thanks, could you combine commit 5 with 2 and commit 4 with 3 to have following list of changes as [Change version file's name to sockperf-version] [Ported to macOS] [Ported to macOS (misc parts)]
Sure, I've merged the commits.
Hi,
I ported sockperf to macOS. To do so, I changed the followings.
Resolves #83
1. Change the
version
file tosockperf-version
.In my machine (macOS 13.1, Apple M1 (arm64), AppleClang 14.0.0), when I tried to build sockperf, the
version
file conflicted with C++20's version header (https://en.cppreference.com/w/cpp/header/version). The version header is used in the macOS's C++ std library, and an error occurs when the library tries to include the version header. So I changed theversion
's filename tosockperf-version
.2. Change
struct sockaddr_store_t
'sss_family
toaddr
.In macOS, the first member of
sockaddr_*
structures is notsa_family_t
(https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/netinet/in.h#L397-L403). So to accessss_family
correctly in a portable way, I changed the memberss_family
tosockaddr addr
and all codes accessing it.3. Add macOS-specific a thread affinity implementation
Unlike other parts of
os_abstract
, the thread affinity codes are not compatible with macOS, so I implement macOS-specific thread affinity functions. However, macOS's thread affinity API has a different behavior from the other OSes. In macOS, it is impossible to "pin" threads to specific cores, and rather application gives a tag (or hint) to the OS scheduler, and threads with the same affinity tag will be scheduled to share an L2 cache if possible. In this implementation, if a user gives thread affinity information, sockperf only gives a tag (only the last core id) to threads.See https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/osfmk/mach/thread_policy.h#L186-L202 for more detail.
4. Some misc changes
I also changed argument parsing and
vma_xlio
parts to port sockperf to macOS.