-
Notifications
You must be signed in to change notification settings - Fork 147
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
[Profiler] Use chrono types instead of integer type #6288
[Profiler] Use chrono types instead of integer type #6288
Conversation
a16e088
to
2a7c290
Compare
Datadog ReportBranch report: ✅ 0 Failed, 455235 Passed, 3209 Skipped, 21h 6m 40.08s Total Time |
7b57237
to
f50ff96
Compare
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing the following branches/commits: Execution-time benchmarks measure the whole time it takes to execute a program. And are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are shown in red. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6288) - mean (70ms) : 67, 73
. : milestone, 70,
master - mean (69ms) : 67, 71
. : milestone, 69,
section CallTarget+Inlining+NGEN
This PR (6288) - mean (982ms) : 959, 1005
. : milestone, 982,
master - mean (978ms) : 954, 1002
. : milestone, 978,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6288) - mean (108ms) : 105, 110
. : milestone, 108,
master - mean (107ms) : 105, 110
. : milestone, 107,
section CallTarget+Inlining+NGEN
This PR (6288) - mean (681ms) : 668, 695
. : milestone, 681,
master - mean (678ms) : 659, 697
. : milestone, 678,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6288) - mean (92ms) : 88, 95
. : milestone, 92,
master - mean (91ms) : 88, 93
. : milestone, 91,
section CallTarget+Inlining+NGEN
This PR (6288) - mean (631ms) : 614, 649
. : milestone, 631,
master - mean (632ms) : 616, 648
. : milestone, 632,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6288) - mean (190ms) : 186, 194
. : milestone, 190,
master - mean (190ms) : 187, 194
. : milestone, 190,
section CallTarget+Inlining+NGEN
This PR (6288) - mean (1,094ms) : 1067, 1122
. : milestone, 1094,
master - mean (1,102ms) : 1067, 1136
. : milestone, 1102,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6288) - mean (276ms) : 270, 282
. : milestone, 276,
master - mean (276ms) : 271, 280
. : milestone, 276,
section CallTarget+Inlining+NGEN
This PR (6288) - mean (871ms) : 846, 897
. : milestone, 871,
master - mean (875ms) : 839, 911
. : milestone, 875,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6288) - mean (267ms) : 262, 272
. : milestone, 267,
master - mean (265ms) : 261, 269
. : milestone, 265,
section CallTarget+Inlining+NGEN
This PR (6288) - mean (849ms) : 820, 878
. : milestone, 849,
master - mean (851ms) : 816, 887
. : milestone, 851,
|
7faabb5
to
fbf9825
Compare
fbf9825
to
f6bd75e
Compare
Throughput/Crank Report ⚡Throughput results for AspNetCoreSimpleController comparing the following branches/commits: Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red. Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards! gantt
title Throughput Linux x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6288) (11.105M) : 0, 11105126
master (10.987M) : 0, 10986728
benchmarks/2.9.0 (11.033M) : 0, 11032866
section Automatic
This PR (6288) (7.109M) : 0, 7108506
master (7.175M) : 0, 7174684
benchmarks/2.9.0 (7.786M) : 0, 7785853
section Trace stats
master (7.577M) : 0, 7577344
section Manual
master (11.201M) : 0, 11201309
section Manual + Automatic
This PR (6288) (6.595M) : 0, 6595189
master (6.769M) : 0, 6769214
section DD_TRACE_ENABLED=0
master (10.257M) : 0, 10257268
gantt
title Throughput Linux arm64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6288) (9.446M) : 0, 9446361
master (9.557M) : 0, 9557319
benchmarks/2.9.0 (9.495M) : 0, 9494821
section Automatic
This PR (6288) (6.378M) : 0, 6377552
master (6.368M) : 0, 6367805
section Trace stats
master (6.673M) : 0, 6672869
section Manual
master (9.631M) : 0, 9630961
section Manual + Automatic
This PR (6288) (5.808M) : 0, 5808036
master (5.951M) : 0, 5951439
section DD_TRACE_ENABLED=0
master (8.900M) : 0, 8899929
gantt
title Throughput Windows x64 (Total requests)
dateFormat X
axisFormat %s
section Baseline
This PR (6288) (10.233M) : 0, 10233293
master (9.199M) : 0, 9198633
benchmarks/2.9.0 (10.020M) : 0, 10019592
section Automatic
This PR (6288) (6.704M) : 0, 6704437
master (6.083M) : 0, 6082614
benchmarks/2.9.0 (7.255M) : 0, 7255257
section Trace stats
master (6.603M) : 0, 6602631
section Manual
master (9.506M) : 0, 9505886
section Manual + Automatic
This PR (6288) (6.194M) : 0, 6193982
master (5.789M) : 0, 5788592
section DD_TRACE_ENABLED=0
master (8.972M) : 0, 8971897
|
f6bd75e
to
50de8e6
Compare
Benchmarks Report for tracer 🐌Benchmarks for #6288 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net6.0 | 1.169 | 1,399.23 | 1,197.09 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | CallElasticsearch |
net6.0 | 1.18μs | 0.683ns | 2.56ns | 0.0136 | 0 | 0 | 976 B |
master | CallElasticsearch |
netcoreapp3.1 | 1.47μs | 0.638ns | 2.39ns | 0.0127 | 0 | 0 | 976 B |
master | CallElasticsearch |
net472 | 2.5μs | 1.38ns | 5.14ns | 0.158 | 0 | 0 | 995 B |
master | CallElasticsearchAsync |
net6.0 | 1.41μs | 4.89ns | 19ns | 0.0135 | 0 | 0 | 952 B |
master | CallElasticsearchAsync |
netcoreapp3.1 | 1.75μs | 0.81ns | 2.92ns | 0.014 | 0 | 0 | 1.02 KB |
master | CallElasticsearchAsync |
net472 | 2.7μs | 1.69ns | 6.32ns | 0.167 | 0 | 0 | 1.05 KB |
#6288 | CallElasticsearch |
net6.0 | 1.19μs | 0.744ns | 2.78ns | 0.0137 | 0 | 0 | 976 B |
#6288 | CallElasticsearch |
netcoreapp3.1 | 1.54μs | 1.17ns | 4.54ns | 0.0132 | 0 | 0 | 976 B |
#6288 | CallElasticsearch |
net472 | 2.54μs | 1.81ns | 7.02ns | 0.157 | 0 | 0 | 995 B |
#6288 | CallElasticsearchAsync |
net6.0 | 1.2μs | 0.514ns | 1.99ns | 0.0131 | 0 | 0 | 952 B |
#6288 | CallElasticsearchAsync |
netcoreapp3.1 | 1.69μs | 0.941ns | 3.52ns | 0.0143 | 0 | 0 | 1.02 KB |
#6288 | CallElasticsearchAsync |
net472 | 2.64μs | 1.77ns | 6.86ns | 0.167 | 0 | 0 | 1.05 KB |
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | ExecuteAsync |
net6.0 | 1.28μs | 0.408ns | 1.53ns | 0.0135 | 0 | 0 | 952 B |
master | ExecuteAsync |
netcoreapp3.1 | 1.6μs | 0.646ns | 2.5ns | 0.0127 | 0 | 0 | 952 B |
master | ExecuteAsync |
net472 | 1.86μs | 1.25ns | 4.84ns | 0.144 | 0 | 0 | 915 B |
#6288 | ExecuteAsync |
net6.0 | 1.3μs | 0.807ns | 3.13ns | 0.013 | 0 | 0 | 952 B |
#6288 | ExecuteAsync |
netcoreapp3.1 | 1.6μs | 0.602ns | 2.17ns | 0.0128 | 0 | 0 | 952 B |
#6288 | ExecuteAsync |
net472 | 1.78μs | 0.561ns | 2.17ns | 0.145 | 0 | 0 | 915 B |
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | SendAsync |
net6.0 | 4.35μs | 2.07ns | 8.01ns | 0.0327 | 0 | 0 | 2.31 KB |
master | SendAsync |
netcoreapp3.1 | 5.38μs | 3.19ns | 11.9ns | 0.0375 | 0 | 0 | 2.85 KB |
master | SendAsync |
net472 | 7.33μs | 1.78ns | 6.9ns | 0.494 | 0 | 0 | 3.12 KB |
#6288 | SendAsync |
net6.0 | 4.55μs | 2.05ns | 7.93ns | 0.0317 | 0 | 0 | 2.31 KB |
#6288 | SendAsync |
netcoreapp3.1 | 5.31μs | 2.22ns | 8.29ns | 0.0396 | 0 | 0 | 2.85 KB |
#6288 | SendAsync |
net472 | 7.28μs | 1.43ns | 5.55ns | 0.495 | 0 | 0 | 3.12 KB |
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 1.57μs | 0.551ns | 1.99ns | 0.0228 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
netcoreapp3.1 | 2.31μs | 1.37ns | 4.94ns | 0.0216 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
net472 | 2.56μs | 1.45ns | 5.62ns | 0.249 | 0 | 0 | 1.57 KB |
#6288 | EnrichedLog |
net6.0 | 1.44μs | 1.64ns | 6.34ns | 0.0233 | 0 | 0 | 1.64 KB |
#6288 | EnrichedLog |
netcoreapp3.1 | 2.29μs | 0.582ns | 2.25ns | 0.0223 | 0 | 0 | 1.64 KB |
#6288 | EnrichedLog |
net472 | 2.48μs | 0.696ns | 2.7ns | 0.249 | 0 | 0 | 1.57 KB |
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 120μs | 114ns | 440ns | 0.0602 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
netcoreapp3.1 | 122μs | 156ns | 584ns | 0 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
net472 | 151μs | 267ns | 1.03μs | 0.673 | 0.224 | 0 | 4.46 KB |
#6288 | EnrichedLog |
net6.0 | 120μs | 118ns | 457ns | 0 | 0 | 0 | 4.28 KB |
#6288 | EnrichedLog |
netcoreapp3.1 | 125μs | 134ns | 519ns | 0 | 0 | 0 | 4.28 KB |
#6288 | EnrichedLog |
net472 | 153μs | 221ns | 854ns | 0.684 | 0.228 | 0 | 4.46 KB |
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 3.12μs | 0.905ns | 3.5ns | 0.0311 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
netcoreapp3.1 | 4.38μs | 1.46ns | 5.45ns | 0.0306 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
net472 | 4.88μs | 1.47ns | 5.69ns | 0.319 | 0 | 0 | 2.02 KB |
#6288 | EnrichedLog |
net6.0 | 3.07μs | 1.52ns | 5.9ns | 0.0307 | 0 | 0 | 2.2 KB |
#6288 | EnrichedLog |
netcoreapp3.1 | 4.08μs | 1.26ns | 4.87ns | 0.0286 | 0 | 0 | 2.2 KB |
#6288 | EnrichedLog |
net472 | 4.86μs | 2.13ns | 8.23ns | 0.319 | 0 | 0 | 2.02 KB |
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | SendReceive |
net6.0 | 1.35μs | 0.558ns | 2.16ns | 0.0162 | 0 | 0 | 1.14 KB |
master | SendReceive |
netcoreapp3.1 | 1.72μs | 0.984ns | 3.81ns | 0.0147 | 0 | 0 | 1.14 KB |
master | SendReceive |
net472 | 2.1μs | 1.87ns | 7.25ns | 0.183 | 0 | 0 | 1.16 KB |
#6288 | SendReceive |
net6.0 | 1.32μs | 0.933ns | 3.61ns | 0.016 | 0 | 0 | 1.14 KB |
#6288 | SendReceive |
netcoreapp3.1 | 1.77μs | 0.746ns | 2.89ns | 0.015 | 0 | 0 | 1.14 KB |
#6288 | SendReceive |
net472 | 1.98μs | 1.61ns | 6.22ns | 0.183 | 0 | 0 | 1.16 KB |
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 2.79μs | 0.924ns | 3.58ns | 0.0224 | 0 | 0 | 1.6 KB |
master | EnrichedLog |
netcoreapp3.1 | 3.87μs | 1.35ns | 5.21ns | 0.0213 | 0 | 0 | 1.65 KB |
master | EnrichedLog |
net472 | 4.36μs | 1.97ns | 7.38ns | 0.323 | 0 | 0 | 2.04 KB |
#6288 | EnrichedLog |
net6.0 | 2.8μs | 1.1ns | 4.25ns | 0.0224 | 0 | 0 | 1.6 KB |
#6288 | EnrichedLog |
netcoreapp3.1 | 3.89μs | 3.43ns | 13.3ns | 0.0215 | 0 | 0 | 1.65 KB |
#6288 | EnrichedLog |
net472 | 4.38μs | 2.14ns | 7.7ns | 0.323 | 0 | 0 | 2.04 KB |
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #6288
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0
1.293
475.52
614.75
Faster 🎉 in #6288
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0
1.123
448.68
399.48
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net6.0 | 1.293 | 475.52 | 614.75 |
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 | 1.123 | 448.68 | 399.48 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 447ns | 0.985ns | 3.81ns | 0.00811 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 581ns | 1.33ns | 4.98ns | 0.00753 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 585ns | 0.801ns | 3.1ns | 0.0917 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 476ns | 0.665ns | 2.58ns | 0.00966 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 729ns | 1.21ns | 4.38ns | 0.00953 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 860ns | 2.31ns | 8.94ns | 0.104 | 0 | 0 | 658 B |
#6288 | StartFinishSpan |
net6.0 | 399ns | 0.296ns | 1.15ns | 0.00809 | 0 | 0 | 576 B |
#6288 | StartFinishSpan |
netcoreapp3.1 | 561ns | 0.627ns | 2.43ns | 0.00783 | 0 | 0 | 576 B |
#6288 | StartFinishSpan |
net472 | 650ns | 3.57ns | 20.5ns | 0.0916 | 0 | 0 | 578 B |
#6288 | StartFinishScope |
net6.0 | 614ns | 0.81ns | 3.14ns | 0.00981 | 0 | 0 | 696 B |
#6288 | StartFinishScope |
netcoreapp3.1 | 670ns | 0.817ns | 3.16ns | 0.00933 | 0 | 0 | 696 B |
#6288 | StartFinishScope |
net472 | 868ns | 1.42ns | 5.33ns | 0.104 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #6288
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0
1.184
599.36
709.75
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin‑net6.0 | 1.184 | 599.36 | 709.75 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunOnMethodBegin |
net6.0 | 602ns | 1.3ns | 5.03ns | 0.00969 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 895ns | 2.22ns | 8.32ns | 0.00956 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.13μs | 2.37ns | 9.18ns | 0.104 | 0 | 0 | 658 B |
#6288 | RunOnMethodBegin |
net6.0 | 708ns | 0.92ns | 3.56ns | 0.0096 | 0 | 0 | 696 B |
#6288 | RunOnMethodBegin |
netcoreapp3.1 | 970ns | 1.78ns | 6.65ns | 0.00939 | 0 | 0 | 696 B |
#6288 | RunOnMethodBegin |
net472 | 1.13μs | 2.19ns | 8.48ns | 0.104 | 0 | 0 | 658 B |
bd67898
to
37e2b83
Compare
9d7cb59
to
41ca1e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
profiler/src/ProfilerEngine/Datadog.Profiler.Native/ContentionProvider.h
Outdated
Show resolved
Hide resolved
profiler/src/ProfilerEngine/Datadog.Profiler.Native/IContentionListener.h
Outdated
Show resolved
Hide resolved
profiler/test/Datadog.Profiler.Native.Tests/ClrEventsParserTest.cpp
Outdated
Show resolved
Hide resolved
profiler/test/Datadog.Profiler.Native.Tests/ClrEventsParserTest.cpp
Outdated
Show resolved
Hide resolved
profiler/test/Datadog.Profiler.Native.Tests/EtwEventsManagerTest.cpp
Outdated
Show resolved
Hide resolved
profiler/test/Datadog.Profiler.Native.Tests/EtwEventsManagerTest.cpp
Outdated
Show resolved
Hide resolved
Co-authored-by: chrisnas <chrisnas@users.noreply.github.com>
1606b6f
to
84436dd
Compare
Summary of changes
Use time types (`std::chrono::nanoseconds, std::chrono::milliseconds...) instead of integer type.
Reason for change
Make the code more readable and give more semantic to variable and functions.
We faced a few times situations where we were asking ourselves
is it nanoseconds ? is it milliseconds ? does need to be converted ?...
Implementation details
Replace wherever it makes sense integer types by time type.
For etw, introduce a
etw_timestamp
.Test coverage
Other details