Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
-Support setting profiler entry meta after push
Browse files Browse the repository at this point in the history
  • Loading branch information
Cassunshine committed Jan 22, 2024
1 parent 1a8f88e commit ee8aede
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Core/Util/Profiling/Profiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ public static void Pop(ProfilerKey key) {
State.Value.Pop(key, time);

Check warning on line 40 in Core/Util/Profiling/Profiler.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.
}

public static void SetCurrentMeta(string? value) {
if (!State.IsValueCreated)
throw new InvalidOperationException("Profiler state not created");

State.Value.SetCurrentMeta(value);

Check warning on line 47 in Core/Util/Profiling/Profiler.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.
}

public static void GetStateNames(List<string> target) {
target.Clear();
Expand Down Expand Up @@ -72,6 +78,11 @@ public void Push(ProfilerKey key, DateTime time, string? meta) {
entryStack.Push(entry);
}

public void SetCurrentMeta(string? meta) {
var entry = entryStack.Peek();
entry.Meta = meta;
}

public void Pop(ProfilerKey key, DateTime time) {
var top = entryStack.Pop();

Expand Down

0 comments on commit ee8aede

Please sign in to comment.