-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
now you can see also how much time takes each method
- Loading branch information
1 parent
cdecea8
commit dc6ace7
Showing
9 changed files
with
97 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Collections.Concurrent; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace AOPStatistics | ||
{ | ||
public struct Data | ||
{ | ||
public Method m; | ||
public int NumberHits; | ||
public long TotalDuration; | ||
} | ||
|
||
public class GatherStatistics | ||
{ | ||
public static ConcurrentDictionary<Method, List<long>> timingMethod; | ||
static GatherStatistics() | ||
{ | ||
timingMethod = new ConcurrentDictionary<Method, List<long>>(); | ||
} | ||
|
||
public static void PushMethod(Method m, long timeExecuting) | ||
{ | ||
var data = new List<long>(); | ||
data.Add(timeExecuting); | ||
timingMethod.AddOrUpdate(m,data ,(newValue, oldValue) => | ||
{ | ||
oldValue.Add(timeExecuting); | ||
return oldValue; | ||
} | ||
); | ||
} | ||
public static Data[] DataGathered() | ||
{ | ||
return GatherStatistics.timingMethod.Select(it => | ||
new Data() | ||
{ | ||
m = it.Key, | ||
NumberHits = it.Value.Count, | ||
TotalDuration = it.Value.Sum(), | ||
|
||
}).ToArray(); | ||
|
||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace AOPStatistics | ||
{ | ||
public struct Method | ||
{ | ||
public string className; | ||
public string methodName; | ||
public int line; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters