C#中的Perflib V2开发 [英] Perflib V2 development in C#

查看:68
本文介绍了C#中的Perflib V2开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2008 C#中的PerflibV2方法开发自定义计数器和.Net Framework 3.51 SP1。



症状:


- .res文件正确构建(ctrpp和rc)和出现在项目中


- lodctr接受.xml架构


- 但是Counterset(perf对象)名称不会显示在Perfmon列表中


- 而是显示GUID并且


- "无法加载计数器"显示在Perfmon中的添加(+)


- 单个和多个实例CounterSet存在



计数器具有属性"reference"设置。



应用程序在没有任何异常的情况下运行添加计数器并添加计数器并更新计数器数据时,将添加计数器集。只是没有通过Perfmon。



AC#sample使用CMG(2007)演示文稿中的代码片段和.xml构建显示相同的行为。 AC版本使用相同的.xml架构加载,计数器在Perfmon中可见。



来自SDK的C / C ++示例(我认为)正确加载并显示其Countersets,并且可以将计数器添加(+)到集合集。



这似乎是与C#相关的问题。我认为安装或注册C#.exe(可能在运行lodctr之前)需要做一些事情,因为Vis Studio 2008开发环境与目标Server 2008系统位于不同的系统上。

在搜索MSDN时,我找到了另一个我将要使用的C#示例,但很少有人使用PerflibV2方法进行自定义性能计数器开发。



我缺少哪些信息缓存?有没有人遇到过这个问题?




有没有更好的论坛我应该把这篇文章移到哪里?

提前感谢任何答案。



< span style ="font-size:small; font-family:Calibri"> Wstetson

解决方案

Wstetson,
<确认.res文件实际上已链接到您的二进制文件。 .csproj文件中应该有如下所示的行:

< Win32Resource> [yourfile] .res< / Win32Resource>

在目标上部署二进制文件时,确保运行lodctr /m:[yourmanifest].man。

确保"applicationIdentity"清单中的属性指向二进制文件。

如果您的二进制文件具有关联的.mui文件,请确保将其部署在文件夹中相应语言目录(例如en-us)下的目标上二进制文件所在的位置。

另外,在进入PerfMon之前,请检查typeperf / qx"你的反诉名称"。返回所有的计数器实例名称。

sanket。

左:PS:你可以期待在样品实现的Win7 RTM SDK中的一个有效的CSharp样本(当它出来时) \\PerfCounters\Basic\CSharp。

I am developing custom counters using the PerflibV2 methods in Visual Studio 2008 C# and .Net Framework 3.51 SP1. 

 

Symptoms:

- .res file is built correctly (ctrpp and rc) and present in the project

- the .xml schema is accepted by lodctr

- but the Counterset (perf object) names do not display in Perfmon's list

- instead the GUIDs are displayed and

- "can't load counters" is displayed at an add (+)attempt in Perfmon 

- both single and multiple instance CounterSets are present

 

Counters have the attribute "reference" set.

 

The application runs without any exceptions when the CounterSets are added, when counters are added and instances are created and counter data is updated.  Just not getting through to Perfmon.

 

A C# sample built using a code snippet and .xml from a CMG (2007) presentation shows the same behavior.  A C version using the same .xml schema loads and the counters are visible in Perfmon.

 

A sample in C/C++ from the SDK (I think) loads and displays its Countersets correctly and counters can be added (+) to the collection set.

 

This seems to be a lodctr problem related to C#.  I think there is something I need to do to install or register the C# .exe (maybe prior to running lodctr), as the Vis Studio 2008 development environment is on a different system than my target Server 2008 system. 

In searching MSDN I have found another C# example I'm going to work with, but very little of anyone doing custom performance counter development using PerflibV2 methods.

 

Is there a cache of information somewhere I'm missing?  Has anyone encountered this problem?

 

Is there a better forum I should move this post to?

Thanks in advance for any answers.

 

Wstetson

解决方案

Wstetson,

Verify that the .res file is actually getting linked to your binary. There should be a line like below in your .csproj file:

    <Win32Resource>[yourfile].res</Win32Resource>

When you deploy your binary on the target, make sure to run lodctr /m:[yourmanifest].man.

Make sure that the "applicationIdentity" attribute in your manifest points to your binary.

If your binary has an associated .mui file, make sure that you deploy it on the target under the appropriate language directory (e.g. en-us) in the folder where the binary resides.

Also, before going to PerfMon, check that typeperf /qx "your counterset name" returns all your counter instance names.

sanket.

PS: you can expect a working CSharp sample in Win7 RTM SDK (when it comes out) under Samples\WinBase\PerfCounters\Basic\CSharp.


这篇关于C#中的Perflib V2开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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