Skip to content

Commit 15d0a15

Browse files
authored
fix(patch): [sc-13510] Remove dependency on latency timer. (#93)
* fix(patch): [sc-13510] Remove dependency on latency timer. * Remove dependency.
1 parent 0cb3838 commit 15d0a15

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

Benchmarks/DistributedSystem/DistributedSystemBenchmarks.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Dispatch
33
import Distributed
44
import DistributedSystem
55
import class Foundation.ProcessInfo
6-
import LatencyTimer
76
import Logging
87
import TestMessages
98

Benchmarks/DistributedSystem/ServerAndClient.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Benchmark
22
import DistributedSystem
3-
import LatencyTimer
43
import Logging
54
import TestMessages
65
internal import struct NIOConcurrencyHelpers.NIOLock

Package.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ let externalDependencies: [String: Range<Version>] = [
1717
let internalDependencies: [String: Range<Version>] = [
1818
"package-benchmark": .upToNextMajor(from: "1.0.0"),
1919
"package-consul": .upToNextMajor(from: "7.0.0"),
20-
"package-latency-tools": .upToNextMajor(from: "1.0.0")
2120
]
2221

2322
#if swift(>=6.0)
@@ -119,7 +118,6 @@ let package = Package(
119118
"TestMessages",
120119
.product(name: "ArgumentParser", package: "swift-argument-parser"),
121120
.product(name: "Lifecycle", package: "swift-service-lifecycle_1.0"),
122-
.product(name: "LatencyTimer", package: "package-latency-tools")
123121
],
124122
path: "Sources/ForTesting/TestClient",
125123
swiftSettings: [
@@ -133,7 +131,6 @@ let package = Package(
133131
"TestMessages",
134132
.product(name: "Benchmark", package: "package-benchmark"),
135133
.product(name: "BenchmarkPlugin", package: "package-benchmark"),
136-
.product(name: "LatencyTimer", package: "package-latency-tools")
137134
],
138135
path: "Benchmarks/DistributedSystem",
139136
swiftSettings: [

Sources/ForTesting/TestClient/TestClient.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Dispatch
33
import Distributed
44
import DistributedSystem
55
import class Foundation.ProcessInfo
6-
import LatencyTimer
76
import Lifecycle
87
import Logging
98
import TestMessages
@@ -40,7 +39,7 @@ public struct ClientStarter: AsyncParsableCommand {
4039
public class TestClient: TestableClient, @unchecked Sendable {
4140
private let actorSystem: DistributedSystem
4241

43-
private var start: UInt64 = 0
42+
private var start: ContinuousClock.Instant?
4443
private var received = 0
4544
private var expected = 0
4645

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

6261
public func snapshotDone(for _: Stream) async {
63-
let finish = LatencyTimer.getTimestamp()
62+
let finish = ContinuousClock.now
6463
if received != expected {
6564
logger.error("MISBEHAVIOR: received \(received) monsters, but expected \(expected)")
6665
}
67-
let timePassed = finish - start
68-
logger.info("Stream snapshot done in \(timePassed) usec, received \(received) monsters")
66+
if let start {
67+
let duration = start.duration(to: finish)
68+
logger.info("Stream snapshot done in \(duration), received \(received) monsters")
69+
}
6970
}
7071

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

8788
let openRequest = _OpenRequestStruct(requestIdentifier: 1)
88-
start = LatencyTimer.getTimestamp()
89+
start = ContinuousClock.now
8990

9091
try await serverEndpoint.openStream(byRequest: OpenRequest(openRequest))
9192
} catch {

0 commit comments

Comments
 (0)