线程 - CPU使用率 [英] Thread - CPU usage
问题描述
你好,
我有一个C#服务器,它有4个工作线程一直在运行。
当我让服务器运行几个小时时,由于某些原因,应用程序的CPU使用率将达到100%并保持在那里。
我想知道哪个线程是源代码
问题。
您对如何解决这个问题有什么想法吗?
谢谢,
Michael
-
Michael
----
< a rel =nofollowhref =http://michael.moreno.free.fr/target =_ blank> http://michael.moreno.free.fr/
http://port.cogolin.free.fr/
Hello,
I have a C# server which has 4 worker threads running all the time.
When I let the server runs for several hours, for some reasons the CPU
usage of the application will shoot to 100% and remain there.
I would like to find out which thread(s) is/are the source of the
problem.
Would you have any idea on how to tackle the problem please?
Thanks,
Michael
--
Michael
----
http://michael.moreno.free.fr/
http://port.cogolin.free.fr/
推荐答案
Hello Michael,
使用性能计数器,线程组。你可以跟踪线程的行为
MM>您好,
MM>
MM>我有一个C#服务器,它有4个工作线程一直在运行。
MM>当我让服务器运行几个小时时,由于某些原因,
MM> CPU
MM>该应用程序的使用率将达到100%并保持在那里。
MM>我想知道哪个线程是
MM>的来源。问题。
MM>您对如何解决这个问题有什么想法吗?
MM>
MM>谢谢,
MM>迈克尔
---
WBR,
Michael Nemtsev ::博客: http://spaces.msn.com/laflour
有时一个人仍忠于一个原因只是因为它的对手不会因为b b不再平淡无味。 (c)Friedrich Nietzsche
Hello Michael,
Use Performance Counter, Thread Group. And u can track the threads behaviour
MM> Hello,
MM>
MM> I have a C# server which has 4 worker threads running all the time.
MM> When I let the server runs for several hours, for some reasons the
MM> CPU
MM> usage of the application will shoot to 100% and remain there.
MM> I would like to find out which thread(s) is/are the source of the
MM> problem.
MM> Would you have any idea on how to tackle the problem please?
MM>
MM> Thanks,
MM> Michael
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
2006年4月15日星期六11:17:32 +0100,Michael Moreno
< mi *** ******************@free.fr>写在
< mn *********************** @ free.fr>:
On Sat, 15 Apr 2006 11:17:32 +0100, Michael Moreno
<mi*********************@free.fr> wrote in
<mn***********************@free.fr>:
我有一个C#服务器,它有4个工作线程一直在运行。
当我让服务器运行几个小时时,由于某些原因,CPU应用程序的使用率将达到100 %并保留在那里。
我想知道哪个线程是问题的根源。
你对如何解决这个问题有所了解吗?请问?
I have a C# server which has 4 worker threads running all the time.
When I let the server runs for several hours, for some reasons the CPU
usage of the application will shoot to 100% and remain there.
I would like to find out which thread(s) is/are the source of the
problem.
Would you have any idea on how to tackle the problem please?
我首先将每个线程的线程ID记录到一些
排序的调试日志中,然后使用TaskInfo< ; HTTP://www.iarsn.com/taskinfo.html>看看每个线程的CPU使用率是多少
并确定
的罪魁祸首。
-
Charles Calvert |软件设计/开发
Celtic Wolf,Inc。|项目管理
http://www.celticwolf.com/ |技术写作
(703)580-0210 |研究
I would first log the thread ID of each thread to a debug log of some
sort, then use TaskInfo <http://www.iarsn.com/taskinfo.html> to look
at the individual CPU usage of each of my threads and identify the
culprit.
--
Charles Calvert | Software Design/Development
Celtic Wolf, Inc. | Project Management
http://www.celticwolf.com/ | Technical Writing
(703) 580-0210 | Research
谢谢,
我尝试过使用perfmon和Process Explorer这个路径。但是我
找不到获取线程的Windows ID的方法。
以下值Thread.CurrentThread.GetHashCode()是,我相信,
.Net运行时的ID。
您是否知道如何在不查询
的情况下获取Windows线程ID Windows API直接?我想尽可能不使用PInvoke
。
非常感谢,
MM
-
------------------------------ ----------------
http://michael.moreno.free.fr/
Hi thanks,
I have tried going this path using perfmon and "Process Explorer" but I
could not find a way to get the Windows ID of the thread.
The following value Thread.CurrentThread.GetHashCode() is, I believe,
an ID for the .Net runtime.
Would you know how to get the Windows thread ID without querying the
Windows API directly? I am trying to not use PInvoke as much as
possible.
Many thanks,
MM
--
----------------------------------------------
http://michael.moreno.free.fr/
这篇关于线程 - CPU使用率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!