如何通过在 Mono 中花费的时间来构建方法直方图?
How to build historgram of methods by time spent inside with Mono?
我试过以下方法:
mono --profile=log myprog.exe
收集探查器数据。然后解释我调用的那些:
> mprof-report output.mlpd
Mono log profiler data
Profiler version: 2.0
Data version: 14
Arguments: log
Architecture: x86-64
Operating system: linux
Mean timer overhead: 51 nanoseconds
Program startup: Fri Jul 20 00:11:12 2018
Program ID: 19840
Server listening on: 59374
JIT summary
Compiled methods: 8349
Generated code size: 2621631
JIT helpers: 0
JIT helpers code size: 0
GC summary
GC resizes: 0
Max heap size: 0
Object moves: 0
Metadata summary
Loaded images: 16
Loaded assemblies: 16
Exception summary
Throws: 0
Thread summary
Thread: 0x7fb49c50a700, name: ""
Thread: 0x7fb49d27b700, name: "Threadpool worker"
Thread: 0x7fb49d07a700, name: "Threadpool worker"
Thread: 0x7fb49ce79700, name: "Threadpool worker"
Thread: 0x7fb49cc78700, name: "Threadpool worker"
Thread: 0x7fb49d6b9700, name: ""
Thread: 0x7fb4bbff1700, name: "Finalizer"
Thread: 0x7fb4bfe3f740, name: "Main"
Domain summary
Domain: (nil), friendly name: "myprog.exe"
Domain: 0x1d037f0, friendly name: "(null)"
Context summary
Context: (nil), domain: (nil)
但是,没有关于哪些方法被经常调用并且需要很长时间才能完成的信息,这是我期望从分析中得到的唯一一件事。
如何使用 Mono 分析来收集和输出有关方法调用总 运行 时间的信息?像 hprof
和 cpu=times
一样会生成。
Mono 文档 "slightly" 错误,因为默认情况下不跟踪方法 calls
。此选项会创建大量配置文件日志输出并大大减慢 "total" 执行时间,并且当与 alloc
等其他选项结合使用时,会影响方法的执行时间,从而影响正在收集的任何时间。
我个人建议使用 calls
分析,将 calldepth
调整到对您的分析重要的水平。即您是否需要分析框架调用?此外,较小的调用深度也会大大减小生成的日志的大小。
示例:
mono --profile=log:calls,calldepth=10 Console_Ling.exe
产生:
Method call summary
Total(ms) Self(ms) Calls Method name
53358 0 1 (wrapper runtime-invoke) <Module>:runtime_invoke_void_object (object,intptr,intptr,intptr)
53358 2 1 Console_Ling.MainClass:Main (string[])
53340 2 1 Console_Ling.MainClass:Stuff ()
53337 0 3 System.Linq.Enumerable:ToList<int> (System.Collections.Generic.IEnumerable`1<int>)
53194 13347 1 System.Linq.Enumerable/WhereListIterator`1<int>:ToList ()
33110 13181 20000000 Console_Ling.MainClass/<>c__DisplayClass0_0:<Stuff>b__0 (int)
19928 13243 20000000 System.Collections.Generic.List`1<int>:Contains (int)
6685 6685 20000000 System.Collections.Generic.GenericEqualityComparer`1<int>:Equals (int,int)
~~~~
回复:http://www.mono-project.com/docs/debug+profile/profile/profiler/#profiler-option-documentation
我试过以下方法:
mono --profile=log myprog.exe
收集探查器数据。然后解释我调用的那些:
> mprof-report output.mlpd
Mono log profiler data
Profiler version: 2.0
Data version: 14
Arguments: log
Architecture: x86-64
Operating system: linux
Mean timer overhead: 51 nanoseconds
Program startup: Fri Jul 20 00:11:12 2018
Program ID: 19840
Server listening on: 59374
JIT summary
Compiled methods: 8349
Generated code size: 2621631
JIT helpers: 0
JIT helpers code size: 0
GC summary
GC resizes: 0
Max heap size: 0
Object moves: 0
Metadata summary
Loaded images: 16
Loaded assemblies: 16
Exception summary
Throws: 0
Thread summary
Thread: 0x7fb49c50a700, name: ""
Thread: 0x7fb49d27b700, name: "Threadpool worker"
Thread: 0x7fb49d07a700, name: "Threadpool worker"
Thread: 0x7fb49ce79700, name: "Threadpool worker"
Thread: 0x7fb49cc78700, name: "Threadpool worker"
Thread: 0x7fb49d6b9700, name: ""
Thread: 0x7fb4bbff1700, name: "Finalizer"
Thread: 0x7fb4bfe3f740, name: "Main"
Domain summary
Domain: (nil), friendly name: "myprog.exe"
Domain: 0x1d037f0, friendly name: "(null)"
Context summary
Context: (nil), domain: (nil)
但是,没有关于哪些方法被经常调用并且需要很长时间才能完成的信息,这是我期望从分析中得到的唯一一件事。
如何使用 Mono 分析来收集和输出有关方法调用总 运行 时间的信息?像 hprof
和 cpu=times
一样会生成。
Mono 文档 "slightly" 错误,因为默认情况下不跟踪方法 calls
。此选项会创建大量配置文件日志输出并大大减慢 "total" 执行时间,并且当与 alloc
等其他选项结合使用时,会影响方法的执行时间,从而影响正在收集的任何时间。
我个人建议使用 calls
分析,将 calldepth
调整到对您的分析重要的水平。即您是否需要分析框架调用?此外,较小的调用深度也会大大减小生成的日志的大小。
示例:
mono --profile=log:calls,calldepth=10 Console_Ling.exe
产生:
Method call summary
Total(ms) Self(ms) Calls Method name
53358 0 1 (wrapper runtime-invoke) <Module>:runtime_invoke_void_object (object,intptr,intptr,intptr)
53358 2 1 Console_Ling.MainClass:Main (string[])
53340 2 1 Console_Ling.MainClass:Stuff ()
53337 0 3 System.Linq.Enumerable:ToList<int> (System.Collections.Generic.IEnumerable`1<int>)
53194 13347 1 System.Linq.Enumerable/WhereListIterator`1<int>:ToList ()
33110 13181 20000000 Console_Ling.MainClass/<>c__DisplayClass0_0:<Stuff>b__0 (int)
19928 13243 20000000 System.Collections.Generic.List`1<int>:Contains (int)
6685 6685 20000000 System.Collections.Generic.GenericEqualityComparer`1<int>:Equals (int,int)
~~~~
回复:http://www.mono-project.com/docs/debug+profile/profile/profiler/#profiler-option-documentation