diff --git a/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs b/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs index 1cffa39ea..d7e06ab89 100644 --- a/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs +++ b/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs @@ -1209,6 +1209,7 @@ namespace ICSharpCode.Decompiler.CSharp EntityDeclaration DoDecompile(ITypeDefinition typeDef, DecompileRun decompileRun, ITypeResolveContext decompilationContext) { Debug.Assert(decompilationContext.CurrentTypeDefinition == typeDef); + var watch = System.Diagnostics.Stopwatch.StartNew(); try { var typeSystemAstBuilder = CreateAstBuilder(decompileRun.Settings); @@ -1337,6 +1338,11 @@ namespace ICSharpCode.Decompiler.CSharp { throw new DecompilerException(module, typeDef, innerException); } + finally + { + watch.Stop(); + Instrumentation.DecompilerEventSource.Log.DoDecompileTypeDefinition(typeDef.FullName, watch.ElapsedMilliseconds); + } } enum EnumValueDisplayMode @@ -1660,6 +1666,7 @@ namespace ICSharpCode.Decompiler.CSharp EntityDeclaration DoDecompile(IField field, DecompileRun decompileRun, ITypeResolveContext decompilationContext) { Debug.Assert(decompilationContext.CurrentMember == field); + var watch = System.Diagnostics.Stopwatch.StartNew(); try { var typeSystemAstBuilder = CreateAstBuilder(decompileRun.Settings); @@ -1722,6 +1729,11 @@ namespace ICSharpCode.Decompiler.CSharp { throw new DecompilerException(module, field, innerException); } + finally + { + watch.Stop(); + Instrumentation.DecompilerEventSource.Log.DoDecompileField(field.FullName, watch.ElapsedMilliseconds); + } } internal static bool IsFixedField(IField field, out IType type, out int elementCount) @@ -1802,7 +1814,7 @@ namespace ICSharpCode.Decompiler.CSharp finally { watch.Stop(); - Instrumentation.DecompilerEventSource.Log.DoDecompileProperty(property.Name, watch.ElapsedMilliseconds); + Instrumentation.DecompilerEventSource.Log.DoDecompileProperty(property.FullName, watch.ElapsedMilliseconds); } } @@ -1848,7 +1860,7 @@ namespace ICSharpCode.Decompiler.CSharp finally { watch.Stop(); - Instrumentation.DecompilerEventSource.Log.DoDecompileEvent(ev.Name, watch.ElapsedMilliseconds); + Instrumentation.DecompilerEventSource.Log.DoDecompileEvent(ev.FullName, watch.ElapsedMilliseconds); } } diff --git a/ICSharpCode.Decompiler/Instrumentation/DecompilerEventSource.cs b/ICSharpCode.Decompiler/Instrumentation/DecompilerEventSource.cs index 902dcc4d0..97b775033 100644 --- a/ICSharpCode.Decompiler/Instrumentation/DecompilerEventSource.cs +++ b/ICSharpCode.Decompiler/Instrumentation/DecompilerEventSource.cs @@ -18,6 +18,18 @@ namespace ICSharpCode.Decompiler.Instrumentation WriteEvent(2, propertyName, elapsedMilliseconds); } + [Event(3, Level = EventLevel.Informational)] + public void DoDecompileField(string fieldName, long elapsedMilliseconds) + { + WriteEvent(3, fieldName, elapsedMilliseconds); + } + + [Event(4, Level = EventLevel.Informational)] + public void DoDecompileTypeDefinition(string typeDefName, long elapsedMilliseconds) + { + WriteEvent(4, typeDefName, elapsedMilliseconds); + } + public static DecompilerEventSource Log = new DecompilerEventSource(); }