Skip to content

Commit 07e72b3

Browse files
authored
Document dotnet magic denominator (#255)
1 parent e4b854e commit 07e72b3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pkg/agent/dotnetspy/session.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,20 @@ func (s *session) start() error {
8787
// The session is closed by us (on flush or stop call),
8888
// or the target process has exited.
8989
for k, v := range p.Samples() {
90+
// dotnet profiler reports total time v per call stack k.
91+
// Meanwhile, pyroscope agent expects number of samples is
92+
// reported. Every sample is a time fraction of second
93+
// according to sample rate: 1000ms/100 = 10ms by default.
94+
// To represent reported time v as a number of samples,
95+
// we divide it by sample duration.
96+
//
97+
// Taking into account that under the hood dotnet spy uses
98+
// Microsoft-DotNETCore-SampleProfiler, which captures a
99+
// snapshot of each thread's managed callstack every 10 ms,
100+
// we cannot manage sample rate from outside.
90101
s.ch <- line{
91102
name: []byte(k),
92-
val: int(v.Milliseconds()),
103+
val: int(v.Milliseconds()) / 10,
93104
}
94105
}
95106
}

0 commit comments

Comments
 (0)