Skip to content

Commit 0e2c781

Browse files
committed
[CAS] Adjust the caching report text to not mention 'miss'
The text now reads "2 hits / 4 cacheable tasks (50%)". The intention of the change is to avoid "miss" which can have negative associations.
1 parent bd5f673 commit 0e2c781

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Sources/SWBBuildSystem/BuildOperation.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,8 @@ package final class BuildOperation: BuildSystemOperation {
681681
adaptor.withActivity(ruleInfo: "CompilationCacheMetrics", executionDescription: "Report compilation cache metrics", signature: signature, target: nil, parentActivity: nil) { activity in
682682
func getSummary(hits: Int, misses: Int) -> String {
683683
let hitPercent = Int((Double(hits) / Double(hits + misses) * 100).rounded())
684-
return "\(hits) hit\(hits == 1 ? "" : "s") (\(hitPercent)%), \(misses) miss\(misses == 1 ? "" : "es")"
684+
let total = hits + misses
685+
return "\(hits) hit\(hits == 1 ? "" : "s") / \(total) cacheable task\(total == 1 ? "" : "s") (\(hitPercent)%)"
685686
}
686687
delegate.emit(diagnostic: Diagnostic(behavior: .note, location: .unknown, data: DiagnosticData(getSummary(hits: cacheHits, misses: cacheMisses))), for: activity, signature: signature)
687688
return .succeeded

Tests/SWBBuildSystemTests/ClangCompilationCachingTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
234234
// Make sure scanning happens before compilation...
235235
results.check(event: .taskHadEvent(scanTask, event: .completed), precedes: .taskHadEvent(compileTask, event: .started))
236236

237-
results.checkNote("0 hits (0%), 1 miss")
237+
results.checkNote("0 hits / 1 cacheable task (0%)")
238238
results.checkCompileCacheMiss(compileTask)
239239
results.checkNoDiagnostics()
240240
}
@@ -262,7 +262,7 @@ fileprivate struct ClangCompilationCachingTests: CoreBasedTests {
262262
// Make sure scanning happens before compilation.
263263
results.check(event: .taskHadEvent(scanTask, event: .completed), precedes: .taskHadEvent(compileTask, event: .started))
264264

265-
results.checkNote("1 hit (100%), 0 misses")
265+
results.checkNote("1 hit / 1 cacheable task (100%)")
266266
results.checkCompileCacheHit(compileTask)
267267
}
268268
results.checkNoDiagnostics()

Tests/SWBBuildSystemTests/SwiftCompilationCachingTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fileprivate struct SwiftCompilationCachingTests: CoreBasedTests {
110110
numCompile += tasks.count
111111
}
112112

113-
results.checkNote("0 hits (0%), 4 misses")
113+
results.checkNote("0 hits / 4 cacheable tasks (0%)")
114114

115115
results.checkNoTask()
116116
}
@@ -126,7 +126,7 @@ fileprivate struct SwiftCompilationCachingTests: CoreBasedTests {
126126
results.checkKeyQueryCacheHit(task)
127127
}
128128

129-
results.checkNote("4 hits (100%), 0 misses")
129+
results.checkNote("4 hits / 4 cacheable tasks (100%)")
130130
}
131131
#expect(try readMetrics("two").contains("\"swiftCacheHits\":\(numCompile),\"swiftCacheMisses\":0"))
132132
}

0 commit comments

Comments
 (0)