Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ AMD Ryzen 7 5700G with Radeon Graphics 3.80GHz, 1 CPU, 16 logical and 8 physical
.NET SDK 10.0.103
[Host] : .NET 9.0.13 (9.0.13, 9.0.1326.6317), X64 RyuJIT x86-64-v3
DefaultJob : .NET 9.0.13 (9.0.13, 9.0.1326.6317), X64 RyuJIT x86-64-v3

| Method | Iterations | ParallelLimit | IsExporter | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
|----------------- |----------- |-------------- |----------- |------------:|-----------:|-----------:|----------:|--------:|------------:|
| ActivitySource | 1000 | 4 | False | 43.92 us | 0.876 us | 1.580 us | 0.3052 | - | 2.48 KB |
| TraceActivityRef | 1000 | 4 | False | 15.80 us | 0.295 us | 0.276 us | 0.3052 | - | 2.47 KB |
| ActivitySource | 1000 | 4 | True | 795.88 us | 15.775 us | 24.090 us | 588.8672 | 9.7656 | 4752.54 KB |
| TraceActivityRef | 1000 | 4 | True | 344.26 us | 4.812 us | 4.501 us | - | - | 2.49 KB |
| ActivitySource | 10000 | 4 | False | 388.56 us | 7.729 us | 13.333 us | - | - | 2.5 KB |
| TraceActivityRef | 10000 | 4 | False | 138.12 us | 2.759 us | 3.388 us | 0.2441 | - | 2.49 KB |
| ActivitySource | 10000 | 4 | True | 7,750.68 us | 153.829 us | 307.214 us | 5882.8125 | 46.8750 | 47502.54 KB |
| TraceActivityRef | 10000 | 4 | True | 3,394.63 us | 65.616 us | 67.382 us | - | - | 2.52 KB |


| Method | Iterations | ParallelLimit | IsExporter | Mean | Error | StdDev | Median | Gen0 | Gen1 | Allocated |
|------------------- |----------- |-------------- |----------- |-------------:|-----------:|-----------:|-------------:|----------:|--------:|------------:|
| ActivitySource | 1000 | 4 | False | 45.394 us | 0.9058 us | 2.3054 us | 45.285 us | 0.2441 | - | 2.46 KB |
| TraceActivityScope | 1000 | 4 | False | 5.169 us | 0.0343 us | 0.0320 us | 5.181 us | 0.3052 | - | 2.5 KB |
| ActivitySource | 1000 | 4 | True | 698.665 us | 6.8543 us | 6.4115 us | 698.552 us | 588.8672 | 8.7891 | 4752.48 KB |
| TraceActivityScope | 1000 | 4 | True | 349.706 us | 6.9106 us | 15.8783 us | 341.561 us | - | - | 2.46 KB |
| ActivitySource | 10000 | 4 | False | 377.078 us | 7.3748 us | 9.8451 us | 374.799 us | - | - | 2.46 KB |
| TraceActivityScope | 10000 | 4 | False | 25.074 us | 0.4772 us | 0.4230 us | 25.096 us | 0.2747 | - | 2.45 KB |
| ActivitySource | 10000 | 4 | True | 7,855.249 us | 74.1372 us | 69.3480 us | 7,867.755 us | 5882.8125 | 46.8750 | 47502.54 KB |
| TraceActivityScope | 10000 | 4 | True | 3,491.807 us | 18.0259 us | 16.8614 us | 3,494.504 us | - | - | 2.52 KB |
```

## 💡 Usage
Expand All @@ -39,7 +40,7 @@ var source = new TraceActivitySourceBuilder()
.AddExporter(new MyExport())
.Build("MySource");

using (var activityRef = source.Start())
using (var scope = source.Start())
{
// your section for measurement.
}
Expand Down
8 changes: 4 additions & 4 deletions docs/idea.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* **Status:** Done
* **Date:** 20.05.2026

## 1. Motivation
## Motivation

The motivation for writing this project was the problems with the load on the garbage collector.

Expand All @@ -12,7 +12,7 @@ In high-load APIs with tens and hundreds of thousands of microrequests per secon
constantly occurring. This activity generates a huge flow of short-lived data.
This triggers partial garbage collections in Gen 0, unnecessarily consumes CPU resources, and distorts metric results.

## 3. Solution
## Solution

To reduce the load on the GC, it's necessary to reuse trace objects.
However,
Expand All @@ -26,11 +26,11 @@ to the standard Activity and doesn't provide an API for regional custom alternat
1. Write an alternative activity that stores it in a pool;
2. Write exporters for activity (Jaeger, etc.).

## 4. Alternatives
## Alternatives

There are no other alternatives on the .NET platform.

## 5. Risks and Limitations
## Risks and Limitations

- **Time and Budget:** Developing, debugging, and maintaining your own solution requires significant resources.
- **Lag:** Ready-made solutions are updated by developers (adding new standards, fixing bugs). Your own solution will
Expand Down
2 changes: 1 addition & 1 deletion src/EasyTrace.Benchmarks/MemoryBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public ulong ActivitySource()
}

[Benchmark]
public ulong TraceActivityRef()
public ulong TraceActivityScope()
{
_activityCounter = 0;

Expand Down
Loading