Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(patch): Tighten the scope between wallclock and cpu total #249

Merged
merged 1 commit into from
May 21, 2024
Merged
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
16 changes: 8 additions & 8 deletions Sources/Benchmark/BenchmarkExecutor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ struct BenchmarkExecutor { // swiftlint:disable:this type_body_length
// NB that the order is important, as we will get leaked
// ARC measurements if initializing it before malloc etc.
benchmark.measurementPreSynchronization = {
if operatingSystemStatsRequested {
startOperatingSystemStats = operatingSystemStatsProducer.makeOperatingSystemStats()
}

if mallocStatsRequested {
startMallocStats = MallocStatsProducer.makeMallocStats()
}
Expand All @@ -154,6 +150,10 @@ struct BenchmarkExecutor { // swiftlint:disable:this type_body_length
startARCStats = ARCStatsProducer.makeARCStats()
}

if operatingSystemStatsRequested {
startOperatingSystemStats = operatingSystemStatsProducer.makeOperatingSystemStats()
}

if performanceCountersRequested {
operatingSystemStatsProducer.resetPerformanceCounters()
startPerformanceCounters = operatingSystemStatsProducer.makePerformanceCounters()
Expand All @@ -171,6 +171,10 @@ struct BenchmarkExecutor { // swiftlint:disable:this type_body_length

stopTime = BenchmarkClock.now // must be as close to first in closure as possible (perf events only before)

if operatingSystemStatsRequested {
stopOperatingSystemStats = operatingSystemStatsProducer.makeOperatingSystemStats()
}

if arcStatsRequested {
stopARCStats = ARCStatsProducer.makeARCStats()
}
Expand All @@ -179,10 +183,6 @@ struct BenchmarkExecutor { // swiftlint:disable:this type_body_length
stopMallocStats = MallocStatsProducer.makeMallocStats()
}

if operatingSystemStatsRequested {
stopOperatingSystemStats = operatingSystemStatsProducer.makeOperatingSystemStats()
}

var delta = 0
let runningTime: Duration = startTime.duration(to: stopTime)

Expand Down
Loading