Has anyone attempted to use Benchmark to profile Swift NIO, Vapor and related APIs yet? I'm attempting to bind a server, but when running via swift package benchmark
, I'm getting the following error: failed with bind(descriptor:ptr:bytes:): Operation not permitted (errno: 1)
.
My only hunch is macOS sandboxing is getting in the way, blocking incoming connections, but I could very much be wrong here.
Note that I am able to run the executable directly, but the log output is not nearly as comprehensible, so I'm hoping there is an easy workaround here:
2024-07-19T03:38:42-0700 notice codes.vapor.application : [Vapor] Server started on http://127.0.0.1:56121
2024-07-19T03:38:42-0700 info codes.vapor.application : request-id=000DB1C5-2EB4-4702-AD52-483510088632 [Vapor] GET /resource
0% [ ] ETA: 00:00:00 | :SingleRequest_AsyncHTTPClient_TCP_Loopback_TCP_HTTP_Vapor_Memory_1GB_Random
2024-07-19T03:38:48-0700 notice codes.vapor.application : [Vapor] Server started on http://127.0.0.1:56152
100% [------------------------------------------------------------] ETA: 00:00:00 | :SingleRequest_AsyncHTTPClient_TCP_Loopback_TCP_HTTP_Vapor_Memory_1GB_Random
Debug results for SingleRequest_AsyncHTTPClient_TCP_Loopback_TCP_HTTP_Vapor_Memory_1GB_Random:
Time (wall clock):
Value Percentile TotalCount 1/(1-Percentile)
4680843263.000 0.000000000000 1 1.00
4680843263.000 1.000000000000 1
#[Mean = 4678746112.000, StdDeviation = 0.000]
#[Max = 4680843263.000, Total count = 1]
#[Buckets = 23, SubBuckets = 2048]
Time (total CPU):
Value Percentile TotalCount 1/(1-Percentile)
5599395839.000 0.000000000000 1 1.00
5599395839.000 1.000000000000 1
#[Mean = 5597298688.000, StdDeviation = 0.000]
#[Max = 5599395839.000, Total count = 1]
#[Buckets = 23, SubBuckets = 2048]
Memory (resident peak):
Value Percentile TotalCount 1/(1-Percentile)
3800039423.000 0.000000000000 1 1.00
3800039423.000 1.000000000000 1
#[Mean = 3798990848.000, StdDeviation = 0.000]
#[Max = 3800039423.000, Total count = 1]
#[Buckets = 22, SubBuckets = 2048]
Malloc (total):
Value Percentile TotalCount 1/(1-Percentile)
3934207.000 0.000000000000 1 1.00
3934207.000 1.000000000000 1
#[Mean = 3933184.000, StdDeviation = 0.000]
#[Max = 3934207.000, Total count = 1]
#[Buckets = 20, SubBuckets = 2048]
Instructions:
Value Percentile TotalCount 1/(1-Percentile)
28185722879.000 0.000000000000 1 1.00
28185722879.000 1.000000000000 1
#[Mean = 28177334272.000, StdDeviation = 0.000]
#[Max = 28185722879.000, Total count = 1]
#[Buckets = 25, SubBuckets = 2048]
Sample code is available here: GitHub - mochidev/swift-server-benchmarks