Browse Source

Wrap DoDecompileEvent(IMethod...)

pull/2519/head
Christoph Wille 4 years ago
parent
commit
c68bf60b1b
  1. 9
      ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs
  2. 9
      ICSharpCode.Decompiler/Instrumentation/DecompilerEventSource.cs

9
ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs

@ -1429,6 +1429,9 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1429,6 +1429,9 @@ namespace ICSharpCode.Decompiler.CSharp
EntityDeclaration DoDecompile(IMethod method, DecompileRun decompileRun, ITypeResolveContext decompilationContext)
{
Debug.Assert(decompilationContext.CurrentMember == method);
var watch = System.Diagnostics.Stopwatch.StartNew();
try
{
var typeSystemAstBuilder = CreateAstBuilder(decompileRun.Settings);
var methodDecl = typeSystemAstBuilder.ConvertEntity(method);
int lastDot = method.Name.LastIndexOf('.');
@ -1467,6 +1470,12 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1467,6 +1470,12 @@ namespace ICSharpCode.Decompiler.CSharp
}
return methodDecl;
}
finally
{
watch.Stop();
Instrumentation.DecompilerEventSource.Log.DoDecompileMethod(method.FullName, watch.ElapsedMilliseconds);
}
}
private bool IsCovariantReturnOverride(IEntity entity)
{

9
ICSharpCode.Decompiler/Instrumentation/DecompilerEventSource.cs

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
using System;
using System.Diagnostics.Tracing;
using System.Diagnostics.Tracing;
namespace ICSharpCode.Decompiler.Instrumentation
{
@ -30,6 +29,12 @@ namespace ICSharpCode.Decompiler.Instrumentation @@ -30,6 +29,12 @@ namespace ICSharpCode.Decompiler.Instrumentation
WriteEvent(4, typeDefName, elapsedMilliseconds);
}
[Event(5, Level = EventLevel.Informational)]
public void DoDecompileMethod(string methodName, long elapsedMilliseconds)
{
WriteEvent(5, methodName, elapsedMilliseconds);
}
public static DecompilerEventSource Log = new DecompilerEventSource();
}

Loading…
Cancel
Save