Skip to content
Closed
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
162ea2a
prepare traceevent integration
vaind Apr 23, 2023
68bafaa
wip: in-memory tracelog
vaind May 4, 2023
f6657f5
in-memory tracelog support
vaind May 5, 2023
9f8727f
profiler - remove temp dir
vaind May 8, 2023
3833b5f
tracelog streaming
vaind May 8, 2023
ad5e21f
fix sample collection
vaind May 9, 2023
1510734
migrate downsampling & fix tests
vaind May 9, 2023
886a2e9
fix: SparseArray
vaind May 10, 2023
2b70a79
update benchmark & profile builder
vaind May 10, 2023
ba3b4e1
minor changes rundown issue investigation
vaind May 11, 2023
079a72c
Merge branch 'main' into feat/streaming-tracelog
vaind May 18, 2023
25592ba
separate rundown session during tracelog init
vaind May 19, 2023
aa3ff4d
fixes
vaind May 20, 2023
3f7b063
Merge branch 'main' into feat/streaming-tracelog
vaind May 22, 2023
9a780eb
update profiling benchmark results
vaind May 22, 2023
61d2718
Merge branch 'main' into feat/streaming-tracelog
vaind May 22, 2023
cc6119f
update tests
vaind May 23, 2023
9005697
Merge branch 'main' into feat/streaming-tracelog
vaind May 23, 2023
f88a20d
update tests
vaind May 23, 2023
f864e7c
fixes
vaind May 23, 2023
04d38a5
update tests to support streaming tracelog
vaind May 30, 2023
8b3691d
Merge branch 'main' into feat/streaming-tracelog
vaind May 30, 2023
9b51611
Merge branch 'main' into feat/streaming-tracelog
vaind Jun 4, 2023
d171989
Merge branch 'main' into feat/streaming-tracelog
vaind Aug 4, 2023
c7f6929
update to latest perfview
vaind Aug 4, 2023
4ffb45a
submodule perfview sentry fork
bruno-garcia Aug 14, 2023
3a7a10f
Merge branch 'main' into chore/integrate-traceevent
bitsandfoxes Aug 16, 2023
5b159e1
fix test code
vaind Aug 16, 2023
f457e3a
Merge branch 'main' into feat/streaming-tracelog
vaind Aug 16, 2023
abc81db
Merge branch 'feat/streaming-tracelog' into chore/integrate-traceevent
vaind Aug 16, 2023
b4f9485
script & project updates
vaind Aug 16, 2023
5ff8f1a
profiling in core sln
bruno-garcia Aug 19, 2023
0bbb0bd
Merge branch 'chore/integrate-traceevent' into feat/profiling-low-ove…
bruno-garcia Aug 19, 2023
aee692b
perfview sampling
bruno-garcia Aug 20, 2023
3376bea
perfview under profiling
bruno-garcia Aug 20, 2023
6e2ae7c
remove profiling from sln/slnf
bruno-garcia Aug 20, 2023
790d774
internal perfview
bruno-garcia Aug 20, 2023
b346567
ignore build files from submodule perfview
bruno-garcia Aug 20, 2023
6cb6cd1
fix structure
bruno-garcia Aug 20, 2023
19e24a2
resolve errors
bruno-garcia Aug 20, 2023
1c98746
builds!
bruno-garcia Aug 20, 2023
40b6add
in SentryCore sln
bruno-garcia Aug 20, 2023
43f78a0
gitignore on module
bruno-garcia Aug 20, 2023
53715f4
set correct platform to profile
bruno-garcia Aug 20, 2023
67ef890
log on collection failure
bruno-garcia Aug 20, 2023
915a0f2
sample
bruno-garcia Aug 20, 2023
791cdc6
fixed sln file with all but mobile
bruno-garcia Aug 20, 2023
bec4641
ignore obj
bruno-garcia Aug 20, 2023
3a05994
fix benchmarks. Package it
bruno-garcia Aug 20, 2023
f1ea1ec
fix tfm in script
bruno-garcia Aug 20, 2023
7c7404d
verify
bruno-garcia Aug 20, 2023
20286f4
new full sln file
bruno-garcia Aug 20, 2023
aa01035
pack profiling
bruno-garcia Aug 20, 2023
b5cccee
add profile category
bruno-garcia Aug 20, 2023
1a593bc
fuck this slnf mess
bruno-garcia Aug 21, 2023
eaa320b
debugging on sample
bruno-garcia Aug 21, 2023
833a319
Merge branch 'main' into feat/profiling-low-overhead
vaind Aug 21, 2023
6a1df09
timeout update
vaind Aug 21, 2023
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

Large diffs are not rendered by default.

71 changes: 30 additions & 41 deletions benchmarks/Sentry.Benchmarks/ProfilingBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,48 @@ namespace Sentry.Benchmarks;
public class ProfilingBenchmarks
{
private IHub _hub = Substitute.For<IHub>();
private ITransactionProfilerFactory _factory = new SamplingTransactionProfilerFactory(Path.GetTempPath(), new());
private SamplingTransactionProfilerFactory _factory;
private ITransactionProfiler _profiler;

[GlobalSetup(Targets = new string[] { nameof(Transaction), nameof(DoHardWorkWhileProfiling) })]
public void StartProfiler()
{
_factory = SamplingTransactionProfilerFactory.Create(new());
}

[GlobalCleanup(Targets = new string[] { nameof(Transaction), nameof(DoHardWorkWhileProfiling) })]
public void StopProfiler()
{
_profiler?.Finish();
_profiler?.CollectAsync(new Transaction("", "")).Wait();
_profiler = null;
_factory.Dispose();
_factory = null;
}

#region full transaction profiling
public IEnumerable<object[]> ProfilerArguments()
public IEnumerable<object[]> TransactionBenchmarkArguments()
{
foreach (var runtimeMs in new[] { 25, 100, 1000, 10000 })
{
foreach (var processing in new[] { true, false })
foreach (var collect in new[] { true, false })
{
yield return new object[] { runtimeMs, processing };
yield return new object[] { runtimeMs, collect };
}
}
}

// Run a profiled transaction. Profiler starts and stops for each transaction separately.
[Benchmark]
[ArgumentsSource(nameof(ProfilerArguments))]
public long Transaction(int runtimeMs, bool processing)
[ArgumentsSource(nameof(TransactionBenchmarkArguments))]
public long Transaction(int runtimeMs, bool collect)
{
var tt = new TransactionTracer(_hub, "test", "");
tt.TransactionProfiler = _factory.Start(tt, CancellationToken.None);
var result = RunForMs(runtimeMs);
tt.TransactionProfiler?.Finish();
tt.TransactionProfiler.Finish();
var transaction = new Transaction(tt);
if (processing)
if (collect)
{
var collectTask = tt.TransactionProfiler.CollectAsync(transaction);
collectTask.Wait();
Expand Down Expand Up @@ -97,11 +114,7 @@ public DiagnosticsClient DiagnosticsClientNew()
[Benchmark]
public void DiagnosticsSessionStartStop()
{
var session = DiagnosticsClientNew().StartEventPipeSession(
SampleProfilerSession.Providers,
SampleProfilerSession.RequestRundown,
SampleProfilerSession.CircularBufferMB
);
var session = DiagnosticsClientNew().StartEventPipeSession(SampleProfilerSession.Providers, true, SampleProfilerSession.CircularBufferMB);
session.EventStream.Dispose();
session.Dispose();
}
Expand Down Expand Up @@ -139,19 +152,10 @@ public void DiagnosticsSessionStartCopyStop(bool rundown, string provider)
session.Dispose();
}

// Same as DiagnosticsSessionStartCopyStop(rundown: true, provider: 'all')
[Benchmark]
public void SampleProfilerSessionStartStopFinishWait()
{
var session = SampleProfilerSession.StartNew(CancellationToken.None);
session.Stop();
session.FinishAsync().Wait();
}

[Benchmark]
public void SampleProfilerSessionStartStop()
{
var session = SampleProfilerSession.StartNew(CancellationToken.None);
using var session = SampleProfilerSession.StartNew();
session.Stop();
}
#endregion
Expand All @@ -163,30 +167,15 @@ public void SampleProfilerSessionStartStop()
[ArgumentsSource(nameof(OverheadRunArguments))]
public long DoHardWork(int n)
{
return ProfilingBenchmarks.FindPrimeNumber(n);
return FindPrimeNumber(n);
}

[BenchmarkCategory("overhead"), Benchmark]
[ArgumentsSource(nameof(OverheadRunArguments))]
public long DoHardWorkWhileProfiling(int n)
{
return ProfilingBenchmarks.FindPrimeNumber(n);
}

private ITransactionProfiler _profiler;

[GlobalSetup(Target = nameof(DoHardWorkWhileProfiling))]
public void StartProfiler()
{
_profiler = _factory.Start(new TransactionTracer(_hub, "", ""), CancellationToken.None);
}

[GlobalCleanup(Target = nameof(DoHardWorkWhileProfiling))]
public void StopProfiler()
{
_profiler?.Finish();
_profiler?.CollectAsync(new Transaction("", "")).Wait();
_profiler = null;
_profiler ??= _factory.Start(new TransactionTracer(_hub, "", ""), CancellationToken.None);
return FindPrimeNumber(n);
}
#endregion
}
2 changes: 1 addition & 1 deletion modules/perfview
Submodule perfview updated 246 files
Loading