Skip to content

Commit 1b4f0e9

Browse files
committed
Merge branch 'cache-2' of https://github.com/majocha/fsharp into cache-2
2 parents c308343 + ee47601 commit 1b4f0e9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Compiler/Driver/fsc.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ let main1
571571
if tcConfig.showTimes then
572572
Caches.CacheMetrics.CaptureStatsAndWriteToConsole() |> disposables.Register
573573
Activity.Profiling.addConsoleListener () |> disposables.Register
574+
Caches.CacheMetrics.CaptureStatsAndWriteToConsole() |> disposables.Register
574575

575576
tcConfig.writeTimesToFile
576577
|> Option.iter (fun f ->

src/Compiler/Utilities/Caches.fs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@ module CacheMetrics =
143143
Console.WriteLine(StatsToString())
144144
}
145145

146+
let CaptureStatsAndWriteToConsole () =
147+
let listener = ListenToAll()
148+
149+
{ new IDisposable with
150+
member _.Dispose() =
151+
listener.Dispose()
152+
Console.WriteLine(StatsToString())
153+
}
154+
146155
// Currently the Cache emits telemetry for raw cache events: hits, misses, evictions etc.
147156
// This type observes those counters and keeps a snapshot of readings. It is used in tests and can be used to print cache stats in debug mode.
148157
type CacheMetricsListener(cacheTags: TagList) =

0 commit comments

Comments
 (0)