Skip to content

Commit

Permalink
Merge pull request #3473 from OnedgeLee/fix/account-metrics
Browse files Browse the repository at this point in the history
Fix `AccountMetrics` to initialize
  • Loading branch information
OnedgeLee authored Nov 1, 2023
2 parents d4826df + 324184e commit 7aa59f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Libplanet.Action/AccountMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ public static class AccountMetrics
{
public static readonly AsyncLocal<Stopwatch> GetStateTimer = new AsyncLocal<Stopwatch>();
public static readonly AsyncLocal<int> GetStateCount = new AsyncLocal<int>();

public static void Initialize()
{
GetStateTimer.Value = new Stopwatch();
GetStateCount.Value = 0;
}
}
}
1 change: 1 addition & 0 deletions Libplanet.Action/ActionEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ IActionContext CreateActionContext(IWorld newPrevState)
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
AccountMetrics.Initialize();
state = feeCollector.Mortgage(state);
context = CreateActionContext(state);
feeCollector = feeCollector.Next(context);
Expand Down

0 comments on commit 7aa59f7

Please sign in to comment.