45fan.com - 路饭网

搜索: 您的位置主页 > 网络频道 > 阅读资讯:在Mono上监视你的程序性能的方法

在Mono上监视你的程序性能的方法

2016-09-04 17:36:01 来源:www.45fan.com 【

在Mono上监视你的程序性能的方法

Mono --profile 参数可以帮助我们监视应用程序的运行性能

很方便的一个功能

使用也很简单:

Example:

Mono --profile app.exe > app.txt

生成的 app.txt 就是 app.exe 的运行记录。

文档中会有如下记录:

Total time spent compiling 1466 methods (sec): 0.3906

Slowest method to compile (sec): 0.0625: .Test::Main(string[])

Time(ms) Count P/call(ms) Method name

########################

656.250 1 656.250 .Test::Main(string[])

Callers (with count) that contribute at least for 1%:

1 100 % System.Object::runtime_invoke_void_string[](object,intptr,intptr,intptr)

########################

656.250 1 656.250 System.Object::runtime_invoke_void_string[](object,intptr,intptr,intptr)

Callers (with count) that contribute at least for 1%:

########################

...................(省略)

其中包含整个app.exe中含有的方法总数.编译所发费的时间.

最慢的方法(通常可以看看这里有什么优化的地方没)

Time(ms):The time taken in milliseconds to execute the code(总花费的时间)

Count:The number of times the code has been executed(执行次数)

P/call(ms):Average time spent each time this code is called(平均执行时间)

Method name:The name of the method being called(方法名称)

好了,如果你有时间可以用上面的方法测试下下面两段代码到底谁性能更好一些

Code 1:

static void Main(string[] args)

{

Console.Out.WriteLine(@"Hello World!");

}

Code 2:

static void Main(string[] args)

{

Console.Out.WriteLine("Hello World!");

}

 

本文地址:http://www.45fan.com/a/question/72310.html
Tags: 你的 监视 Mono
编辑:路饭网
关于我们 | 联系我们 | 友情链接 | 网站地图 | Sitemap | App | 返回顶部