CPU线程 [英] CPU by thread

查看:73
本文介绍了CPU线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有很多例子说明如何获取方法的经过时间,但是我不能找到任何关于如何测量CPU数量的例子由我的

线程在方法中消耗。多线程应用程序中的经过时间,特别是单处理器CPU上的
并不是很有用。


有没有办法测量这个?


谢谢。

Tom

解决方案

Tom,


对于这样的事情,你可以使用PerformanceCounter

类来获得你在任何特定时间点所需的值。


希望这有帮助。

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


< ne ************ ***@charter.net写信息

新闻:8n *********** @ fe06.lga ...


>

有很多例子说明如何获取方法所用的时间但是我没有找到任何关于如何测量方法的例子我的

线程在方法中消耗的CPU量。在多线程应用程序中经过的时间

特别是单个处理器CPU上的
不是很有用。


有没有办法衡量这个?


谢谢。

Tom



你好Tom,

您最好使用CPU分析器

Google for .NET profiler
http://www.google.co.uk/search?hl=en .. .er& btnG =搜索


这些擅长识别瓶颈。

唯一的问题是你需要有测试用例确切地说,用户正在做什么,以便能够使用

euivalent数据量来调用正确的方法。


通常,你可以瞄准调整10种最慢的方法和10种最常用的
经常被称为方法。

Pranshu


< blockquote>我有在这里看到它,但不记得它到底在哪里。试一试:
http://or1cedar.cps.intel.com / softwarecollege /

chanmm


< ne *************** @ charter.netwrote in message

news:8n *********** @ fe06.lga ...


>

有很多例子说明如何获取方法的经过时间但是我没有找到任何关于如何测量CPU数量的例子由我的

线程在方法中消耗。在多线程应用程序中经过的时间

特别是单个处理器CPU上的
不是很有用。


有没有办法衡量这个?


谢谢。

汤姆




There are many examples of how to get the elapsed time for a method but I
can''t find any example of how to measure the amount of CPU consumed by my
thread in a method. Elapsed time in a multithreaded application particularly
on a single processor CPU is not very useful.

Is there a way to measure this?

Thanks.
Tom

解决方案

Tom,

For something like this, you could probably use the PerformanceCounter
class to get the values that you need at any particular point in time.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ne***************@charter.netwrote in message
news:8n***********@fe06.lga...

>
There are many examples of how to get the elapsed time for a method but I
can''t find any example of how to measure the amount of CPU consumed by my
thread in a method. Elapsed time in a multithreaded application
particularly
on a single processor CPU is not very useful.

Is there a way to measure this?

Thanks.
Tom



Hello Tom,
You might be better off using a CPU profiler
Google for .NET profiler
http://www.google.co.uk/search?hl=en...er&btnG=Search

These are good at identifying the bottlenecks.
The only issue is that you need to have test cases to do exactly what
the users are doing to be able to invoke the correct methods with
euivalent amount of data.

Typically, you can aim at tuning 10 slowest methods and 10 most
frequently called methods.
Pranshu


I have seen it here but can''t remember where is it exactly. Have a try:
http://or1cedar.cps.intel.com/softwarecollege/

chanmm

<ne***************@charter.netwrote in message
news:8n***********@fe06.lga...

>
There are many examples of how to get the elapsed time for a method but I
can''t find any example of how to measure the amount of CPU consumed by my
thread in a method. Elapsed time in a multithreaded application
particularly
on a single processor CPU is not very useful.

Is there a way to measure this?

Thanks.
Tom



这篇关于CPU线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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