Skip to content

Commit a7b743e

Browse files
RUM-8454 Apply CR suggestions
1 parent f9826a6 commit a7b743e

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

BenchmarkTests/Runner/Scenarios/Trace/UI/TraceContentView.swift

+8-14
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@ struct TraceContentView: View {
2020
var tracer: OTTracer { Tracer.shared() }
2121

2222
private let queue1 = DispatchQueue(label: "com.datadoghq.benchmark-tracing1")
23-
private let queue2 = DispatchQueue(label: "com.datadoghq.benchmark-tracing2")
2423

2524
init() {
2625
operationName = "iOS Benchmark span operation"
2726
resourceName = "iOS Benchmark span resource"
2827
isError = false
2928
depth = 1
3029
childrenCount = 0
31-
childDelay = 1
30+
childDelay = 100
3231
traceCount = 0
3332
isSending = false
3433
}
@@ -67,13 +66,13 @@ struct TraceContentView: View {
6766
}
6867

6968
HStack {
70-
Text("Child delay:")
69+
Text("Child delay (ms):")
7170
Spacer()
7271
TextField("Child delay:", value: $childDelay, formatter: NumberFormatter())
7372
.textFieldStyle(RoundedBorderTextFieldStyle())
7473
.frame(width: 80)
7574
.keyboardType(.numberPad)
76-
Stepper("", value: $childDelay, in: 1 ... 100, step: 1)
75+
Stepper("", value: $childDelay, in: 50 ... 10_000, step: 50)
7776
.frame(width: 80)
7877
}
7978
}
@@ -128,13 +127,11 @@ struct TraceContentView: View {
128127
)
129128
}
130129

131-
wait(seconds: 0.5)
130+
Thread.sleep(forTimeInterval: childDelay / 1_000)
132131

133-
queue2.sync {
134-
sendSpanTree(parent: rootSpan, currentLevel: 0, maxDepth: depth)
135-
}
132+
sendSpanTree(parent: rootSpan, currentLevel: 0, maxDepth: depth)
136133

137-
wait(seconds: 0.5)
134+
Thread.sleep(forTimeInterval: 0.5)
138135
rootSpan.finish()
139136

140137
DispatchQueue.main.async {
@@ -156,16 +153,13 @@ struct TraceContentView: View {
156153
for i in 1 ... childrenCount {
157154
let childOperation = "\(operationName) - Child \(i) at level \(currentLevel + 1)"
158155
let childSpan = tracer.startSpan(operationName: childOperation, childOf: parent.context)
159-
wait(seconds: childDelay)
156+
157+
Thread.sleep(forTimeInterval: childDelay / 1_000)
160158

161159
sendSpanTree(parent: childSpan, currentLevel: currentLevel + 1, maxDepth: maxDepth)
162160
childSpan.finish()
163161
}
164162
}
165-
166-
private func wait(seconds: TimeInterval) {
167-
Thread.sleep(forTimeInterval: seconds)
168-
}
169163
}
170164

171165
#Preview {

0 commit comments

Comments
 (0)