Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Benchmark

Check failure on line 1 in Benchmarks/DistributedSystem/DistributedSystemBenchmarks.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

File Name Violation: File name should match a type or extension declared in the file (if any) (file_name)
import Dispatch
import Distributed
import DistributedSystem
import class Foundation.ProcessInfo
import LatencyTimer
import Logging
import TestMessages

Expand Down Expand Up @@ -138,7 +137,7 @@
sharedData = nil
}

func runBenchmark(_ benchmark: Benchmark,

Check failure on line 140 in Benchmarks/DistributedSystem/DistributedSystemBenchmarks.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Function Parameter Count Violation: Function should have 5 parameters or less: it currently has 6 (function_parameter_count)
_ serviceSystem: DistributedSystem,
_ service: Service, _ serviceEndpoint: TestServiceEndpoint,
_ client: Client, _ clientEndpoint: TestClientEndpoint) async throws {
Expand Down Expand Up @@ -265,7 +264,7 @@
}

let endpoints = sharedData.localEndpoints
try await runBenchmark(benchmark, sharedData.serviceSystem, sharedData.service, endpoints.service, sharedData.client, endpoints.client)

Check failure on line 267 in Benchmarks/DistributedSystem/DistributedSystemBenchmarks.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 140 characters or less; currently it has 143 characters (line_length)
}

Benchmark("Send Monster #4.1 - facade: distributed actor, remote (network) calls",
Expand Down Expand Up @@ -438,4 +437,4 @@
})
benchmark.stopMeasurement()
}
}

Check failure on line 440 in Benchmarks/DistributedSystem/DistributedSystemBenchmarks.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

File Length Violation: File should contain 400 lines or less: currently contains 440 (file_length)
1 change: 0 additions & 1 deletion Benchmarks/DistributedSystem/ServerAndClient.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Benchmark

Check failure on line 1 in Benchmarks/DistributedSystem/ServerAndClient.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

File Name Violation: File name should match a type or extension declared in the file (if any) (file_name)
import DistributedSystem
import LatencyTimer
import Logging
import TestMessages
internal import struct NIOConcurrencyHelpers.NIOLock
Expand Down Expand Up @@ -167,7 +166,7 @@
}
}

public func getMonster() -> Monster {

Check failure on line 169 in Benchmarks/DistributedSystem/ServerAndClient.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Unavailable Function Violation: Unimplemented functions should be marked as unavailable (unavailable_function)
fatalError("Should not be called")
}

Expand All @@ -179,7 +178,7 @@
monstersCount += monsters.count
}

public func handleMonsters(_ monsters: [String: Monster]) async {

Check failure on line 181 in Benchmarks/DistributedSystem/ServerAndClient.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Unavailable Function Violation: Unimplemented functions should be marked as unavailable (unavailable_function)
fatalError("Should not be called")
}

Expand Down
3 changes: 0 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ let externalDependencies: [String: Range<Version>] = [
let internalDependencies: [String: Range<Version>] = [
"package-benchmark": .upToNextMajor(from: "1.0.0"),
"package-consul": .upToNextMajor(from: "7.0.0"),
"package-latency-tools": .upToNextMajor(from: "1.0.0")
]

#if swift(>=6.0)
Expand Down Expand Up @@ -119,7 +118,6 @@ let package = Package(
"TestMessages",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "Lifecycle", package: "swift-service-lifecycle_1.0"),
.product(name: "LatencyTimer", package: "package-latency-tools")
],
path: "Sources/ForTesting/TestClient",
swiftSettings: [
Expand All @@ -133,7 +131,6 @@ let package = Package(
"TestMessages",
.product(name: "Benchmark", package: "package-benchmark"),
.product(name: "BenchmarkPlugin", package: "package-benchmark"),
.product(name: "LatencyTimer", package: "package-latency-tools")
],
path: "Benchmarks/DistributedSystem",
swiftSettings: [
Expand Down
13 changes: 7 additions & 6 deletions Sources/ForTesting/TestClient/TestClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Dispatch
import Distributed
import DistributedSystem
import class Foundation.ProcessInfo
import LatencyTimer
import Lifecycle
import Logging
import TestMessages
Expand Down Expand Up @@ -40,7 +39,7 @@ public struct ClientStarter: AsyncParsableCommand {
public class TestClient: TestableClient, @unchecked Sendable {
private let actorSystem: DistributedSystem

private var start: UInt64 = 0
private var start: ContinuousClock.Instant?
private var received = 0
private var expected = 0

Expand All @@ -60,12 +59,14 @@ public class TestClient: TestableClient, @unchecked Sendable {
}

public func snapshotDone(for _: Stream) async {
let finish = LatencyTimer.getTimestamp()
let finish = ContinuousClock.now
if received != expected {
logger.error("MISBEHAVIOR: received \(received) monsters, but expected \(expected)")
}
let timePassed = finish - start
logger.info("Stream snapshot done in \(timePassed) usec, received \(received) monsters")
if let start {
let duration = start.duration(to: finish)
logger.info("Stream snapshot done in \(duration), received \(received) monsters")
}
}

public func handleConnectionState(_ state: ConnectionState) async {
Expand All @@ -85,7 +86,7 @@ public class TestClient: TestableClient, @unchecked Sendable {
)

let openRequest = _OpenRequestStruct(requestIdentifier: 1)
start = LatencyTimer.getTimestamp()
start = ContinuousClock.now

try await serverEndpoint.openStream(byRequest: OpenRequest(openRequest))
} catch {
Expand Down
Loading