数据库分析器Linq to SQL Profiler使用教程

来源:互联网 发布:淘宝店铺推荐女装 编辑:程序博客网 时间:2024/05/24 05:31

又一款新的数据库分析器产品Linq to SQL Profiler上架啦。该软件是由 OR/M 社区的高层领导人亲自开发设计,能够精准的帮助你优化App的冗余的代码。由于新产品具有一定的新鲜度,因此对于Linq to SQL Profiler的使用还比较陌生。今天就主要讲解一下Linq to SQL Profiler经常用到的几个操作:如何跳过或继续profiling、为App配置离线profiling模式以及该Profiler需要怎样的防火墙权限。

首先我们来看如何跳过或继续profiling:

在使用Linq to SQL Profiler途中,你可以指定让它跳过对App某一部分的分析,而且不对这一部分产生分析结果。要做到此效果,需要以下代码:

1
2
3
4
using (ProfilerIntegration.IgnoreAll())
{
     // Ignore all events generated from here
}

或者:

ProfilerIntegration.IgnoreAll();// Ignore all events generated from hereProfilerIntegration.ResumeProfiling();

以上两个代码,二选其一即可。

为App配置离线profiling模式:

你可以从App里生成一个快照文件,然后通过代码的方式实现对该App的离线profiling:

HibernatingRhinos.Profiler.Appender.LinqToSql.LinqToSqlProfiler.InitializeOfflineProfiling(filename);

在稍后你需要进行对App分析时,你只需要将生成的快照文件放入到分析器中即可。

》》》全文
0 0
原创粉丝点击