Skip to content
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

Feature Request: Add ability to automatically hide metric columns if value is not set #2629

Open
filzrev opened this issue Aug 31, 2024 · 1 comment · May be fixed by #2633 or #2658
Open

Feature Request: Add ability to automatically hide metric columns if value is not set #2629

filzrev opened this issue Aug 31, 2024 · 1 comment · May be fixed by #2633 or #2658

Comments

@filzrev
Copy link

filzrev commented Aug 31, 2024

When using ThreadingDiagnoser/ExceptionDiagnoser.
Following metric columns are displayed always .

  • Exceptions
  • Completed Work Items
  • Lock Contentions

Is it able to automatically hide these columns if all metric values are 0 ?.

It seems to be able to change behaviors by modifying following code.

Excample benchmark code

 [ShortRunJob]
 [ThreadingDiagnoser]
 // [HideColumns(Column.CompletedWorkItems, Column.LockContentions, Column.Exceptions)]
 public class Benchmarks
 {
     [Benchmark]
     public void Benchmark()
     {
         Thread.Sleep(1);
     }
 }

Console Output

| Method    | Mean     | Error    | StdDev   | Exceptions | Completed Work Items | Lock Contentions |
|---------- |---------:|---------:|---------:|-----------:|---------------------:|-----------------:|
| Benchmark | 15.57 ms | 0.364 ms | 0.020 ms |          - |                    - |                - |
@timcassell
Copy link
Collaborator

It should be fairly easy to implement that behavior by changing the implementation of GetIsAvailable for those metric descriptors, similar to MemoryDiagnoser.

public bool GetIsAvailable(Metric metric) => metric.Value > 0;

public bool GetIsAvailable(Metric metric) => true;

public bool GetIsAvailable(Metric metric) => true;

public bool GetIsAvailable(Metric metric) => true;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment