是否有任何C#的框架或$​​ C $ C解析* BLG性能比较计数器日志文件? [英] Is there any C# framework or code to parse *blg Perfomance Counter log files?

查看:369
本文介绍了是否有任何C#的框架或$​​ C $ C解析* BLG性能比较计数器日志文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的任务不是收集性能计数器数据在我的.NET应用程序,但已经打开的prepared二进制日志文件(*的.blg)?

The task is not to gather Performance counters data in my .NET app, but open already prepared binary log files (*.blg)?

我知道,MS SQL事件探查器(.NET应用程序)可以分析二进制日志。

I know that MS SQL Profiler (.NET app) can parse binary logs.

推荐答案

从我可以找到它似乎的.blg文件格式是专有的,规格是不公开发表。话虽如此,我不认为你将能够找到一个框架或库,做这种格式的原始解析。编写一个库来解析这种格式不规范也不是没有风险的,因为假设可能将不得不作出...即使你扭转工程师的二进制格式始终有你想念某些规则在你的解析器的实现造成的机会潜在问题的道路。

From what I can find it seems that the .blg file format is proprietary and the spec is not openly published. That said I don't think you will be able to find a framework or library that does raw parsing of this format. Writing a library to parse this format without the spec is not without risk since assumptions will likely have to be made... even if you were to reverse engineer the binary format there is always the chance that you miss certain rules in your parser implementation causing potential problems down the road.

这是说,我能想到的2其他选项在.NET应用程序解析二进制日志文件以供使用。

That said, I can think of 2 other options for parsing binary log files for use within a .NET application.

  1. PowerShell中的导入柜台的cmdlet的可用于导入从计数器数据BLG文件造成的源代码中的每个计数器样本的对象。所得到的输出可以以多种方式使用。我能想到的最简单的例子是将源转换为CSV格式进行进一步的处理:

  1. PowerShell's Import-Counter cmdlet could be used to import counter data from a blg file resulting in objects for each counter sample in the source. The resulting output can be used in a number of ways. The simplest example I can think of would be to convert your source to CSV format for further processing:

C:\ PS> $数据=进口柜台。\ exampledata.blg
C:\ PS> $数据|出口计数器-path \ output.csv -FileFormat CSV

C:\PS> $data = import-counter .\exampledata.blg
C:\PS> $data | export-counter -path .\output.csv -FileFormat csv

重新记录是另一种选择。这是一个命令行工具附带大多数主要的Windows操作系统版本。同样,这里所述的方法是将BLG文件转换成CSV格式转换为容易解析。例如:

relog is another option. This is a command line utility that ships with most major versions of the Windows OS. Again, the approach here would be to convert the blg file into CSV format for easy parsing. Example:

重新记录-f CSV inputfile.blg -o outputFile.csv

鉴于上述选项,你应该能够从那里走。这将是使用C#程序<一个很容易运行PowerShell的或重新记录href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx">Process.Start()

Given the options above you should be able to go from there. It would be quite easy run powershell or relog from a C# program using Process.Start()

这篇关于是否有任何C#的框架或$​​ C $ C解析* BLG性能比较计数器日志文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆