当前位置: 首页 > news >正文

南通快速建站公司青岛市城阳区建设局网站

南通快速建站公司,青岛市城阳区建设局网站,保定建设环境项目网站,wordpress后台登录咨询区 Daniel Sperry请问如何获取 .NET 程序当前所有线程的调用栈信息#xff1f;我知道在 java 中只需调用 java.lang.Thread.getAllStackTraces() 方法即可。回答区 Will Calderwood在 .NET 中并不容易实现#xff0c;但可以使用诊断库 ClrMD #xff0c;可以在 nuget 上… 咨询区 Daniel Sperry请问如何获取 .NET 程序当前所有线程的调用栈信息我知道在 java 中只需调用 java.lang.Thread.getAllStackTraces() 方法即可。回答区 Will Calderwood在 .NET 中并不容易实现但可以使用诊断库 ClrMD 可以在 nuget 上下载它可以获取到当前进程的所有线程栈信息的快照当然还可以获取 线程名 等各种附加信息太强大了参考如下代码using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using Microsoft.Diagnostics.Runtime;namespace CSharpUtils.wrc.utils.debugging {public static class StackTraceAnalysis{public static string GetAllStackTraces(){var result  new StringBuilder();using (var target  DataTarget.CreateSnapshotAndAttach(Process.GetCurrentProcess().Id)){var runtime  target.ClrVersions.First().CreateRuntime();// We cant get the thread name from the ClrThead objects, so well look for// Thread instances on the heap and get the names from those.    var threadNameLookup  new Dictionaryint, string();foreach (var obj in runtime.Heap.EnumerateObjects()){if (!(obj.Type is null)  obj.Type.Name  System.Threading.Thread){var threadId  obj.ReadFieldint(m_ManagedThreadId);var threadName  obj.ReadStringField(m_Name);threadNameLookup[threadId]  threadName;}}foreach (var thread in runtime.Threads){threadNameLookup.TryGetValue(thread.ManagedThreadId, out string threadName);result.AppendLine($ManagedThreadId: {thread.ManagedThreadId}, Name: {threadName}, OSThreadId: {thread.OSThreadId}, Thread: IsAlive: {thread.IsAlive}, IsBackground: {thread.IsBackground});foreach (var clrStackFrame in thread.EnumerateStackTrace())result.AppendLine(${clrStackFrame.Method});}}return result.ToString();}} }点评区 其实是这样的如何想自动化获取当前的进程中所有线程的调用栈用 ClrMD 即可如果是为了对程序进行分析诊断可以借助 windbg再使用 sos 中的 ~*e !clrstack 命令即可比如下面这样0:000 ~*e !clrstack  OS Thread Id: 0x4110 (0) Child SP       IP Call Site 0019f3e4 77a2166c [InlinedCallFrame: 0019f3e4]  0019f3e0 79b49b71 DomainNeutralILStubClass.IL_STUB_PInvoke(Microsoft.Win32.SafeHandles.SafeFileHandle, Byte*, Int32, Int32 ByRef, IntPtr) 0019f3e4 7a27b275 [InlinedCallFrame: 0019f3e4] Microsoft.Win32.Win32Native.ReadFile(Microsoft.Win32.SafeHandles.SafeFileHandle, Byte*, Int32, Int32 ByRef, IntPtr) 0019f448 7a27b275 System.IO.__ConsoleStream.ReadFileNative(Microsoft.Win32.SafeHandles.SafeFileHandle, Byte[], Int32, Int32, Boolean, Boolean, Int32 ByRef) 0019f47c 7a27b17b System.IO.__ConsoleStream.Read(Byte[], Int32, Int32) 0019f49c 79b2e6a3 System.IO.StreamReader.ReadBuffer() 0019f4ac 79b2eb5b System.IO.StreamReader.ReadLine() 0019f4c8 7a3c3786 System.IO.TextReaderSyncTextReader.ReadLine() 0019f4d8 7a221845 System.Console.ReadLine() 0019f4e0 022f0983 *** WARNING: Unable to verify checksum for D:\net5\ConsoleApp1\ConsoleApp1\bin\Debug\ConsoleApp1.exe ConsoleApp1.Program.Main(System.String[]) [D:\net5\ConsoleApp1\ConsoleApp1\Program.cs  25] 0019f67c 78e1f036 [GCFrame: 0019f67c]  OS Thread Id: 0x11ac (24) Child SP       IP Call Site 06c4f214 77a21bdc [HelperMethodFrame_1OBJ: 06c4f214] System.Threading.WaitHandle.WaitMultiple(System.Threading.WaitHandle[], Int32, Boolean, Boolean) 06c4f328 79ae8a86 System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle[], Int32, Boolean) 06c4f34c 7ace3f24 *** WARNING: Unable to verify checksum for C:\Windows\assembly\NativeImages_v4.0.30319_32\System\258d4259dd4377d917679ad4b058966e\System.ni.dll System.Net.TimerThread.ThreadProc() 06c4f3a8 79a62e01 System.Threading.ThreadHelper.ThreadStart_Context(System.Object) 06c4f3b4 79a88604 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 06c4f420 79a88537 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 06c4f434 79a884f4 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) 06c4f44c 79a62d5b System.Threading.ThreadHelper.ThreadStart() 06c4f630 78e1f036 [GCFrame: 06c4f630]  06c4f774 78e1f036 [DebuggerU2MCatchHandlerFrame: 06c4f774]  OS Thread Id: 0x2fdc (25) Child SP       IP Call Site 0700f114 755be695 [InlinedCallFrame: 0700f114]  0700f110 7ad6aa01 DomainBoundILStubClass.IL_STUB_PInvoke(System.Net.SSPIHandle ByRef, System.Net.SecurityBufferDescriptor, UInt32, UInt32*) 0700f114 7ad530f4 [InlinedCallFrame: 0700f114] System.Net.UnsafeNclNativeMethodsNativeNTSSPI.DecryptMessage(System.Net.SSPIHandle ByRef, System.Net.SecurityBufferDescriptor, UInt32, UInt32*) 0700f154 7ad530f4 System.Net.SSPISecureChannelType.DecryptMessage(System.Net.SafeDeleteContext, System.Net.SecurityBufferDescriptor, UInt32) 0700f194 7ad51a1a System.Net.SSPIWrapper.EncryptDecryptHelper(OP, System.Net.SSPIInterface, System.Net.SafeDeleteContext, System.Net.SecurityBuffer[], UInt32) 0700f1fc 7ad52fe2 System.Net.Security.SecureChannel.Decrypt(Byte[], Int32 ByRef, Int32 ByRef) 0700f21c 7ad52e07 System.Net.Security._SslStream.ProcessFrameBody(Int32, Byte[], Int32, Int32, System.Net.AsyncProtocolRequest) 0700f248 7ad52d6b System.Net.Security._SslStream.ReadFrameCallback(System.Net.AsyncProtocolRequest) 0700f274 7ad4e576 System.Net.AsyncProtocolRequest.CompleteRequest(Int32) 0700f280 7ad4e537 System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32) 0700f28c 7ad4e4c6 System.Net.FixedSizeReader.ReadCallback(System.IAsyncResult) 0700f2b4 7ad14cf6 System.Net.LazyAsyncResult.Complete(IntPtr) 0700f2e8 7ad49d15 System.Net.ContextAwareResult.CompleteCallback(System.Object) 0700f2ec 79a88604 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 0700f358 79a88537 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 0700f36c 79a884f4 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) 0700f384 7ad4856d System.Net.ContextAwareResult.Complete(IntPtr) 0700f39c 7ad14c71 System.Net.LazyAsyncResult.ProtectedInvokeCallback(System.Object, IntPtr) 0700f3c4 7ad48378 System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32, UInt32, System.Threading.NativeOverlapped*) 0700f3f8 79aea3dd System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*) 0700f4f4 78e1f036 [GCFrame: 0700f4f4]  0700f604 78e1f036 [DebuggerU2MCatchHandlerFrame: 0700f604]  OS Thread Id: 0x4214 (26) Child SP       IP Call Site GetFrameContext failed: 1 00000000 00000000 0:000 !tp CPU utilization: 13% Worker Thread: Total: 13 Running: 0 Idle: 13 MaxLimit: 2047 MinLimit: 12 Work Request in Queue: 0 -------------------------------------- Number of Timers: 1 -------------------------------------- Completion Port Thread:Total: 16 Free: 6 MaxFree: 24 CurrentLimit: 16 MaxLimit: 1000 MinLimit: 12
http://www.zqtcl.cn/news/991785/

相关文章:

  • 网站建设公众号小程序开发密云网站开发
  • 南宁网站开发制作网站数据库分离怎么做
  • 不能打开建设银行网站怎么办自己做网站要会什么软件下载
  • 微软网站怎么做的diy个性定制
  • 洛阳做网站的公司宣传品牌网站建设
  • 公司网站开发招标书电子商务网站系统
  • 哪个旅游网站做的最好营销策划方案范文免费下载
  • 德州哪家网站优化公司专业单页网站seo如何优化
  • 南昌汉邦网站建设城建局
  • 网站建设:中企动力招聘网58同城招聘发布
  • 惠州住房和建设局网站物流网站建设方案范文
  • 做网站架构需要什么步骤wordpress插件连不上
  • 网上购物网站建设规划论文国家企业网官网查询
  • 响应式网站建设推荐乐云seo2022年热点新闻事件
  • 用.net做视频网站的案例做网站需要视频衔接怎么做
  • 网站搭建规划模板wordpress博客点赞
  • 怎么在wordpress免费注册博客网站百度广告代理
  • 网站建设与管理考试怎么让网站分享有图片
  • 做渠道的网站有哪些方面广州网站建设咨询电话
  • 如何查看网站做没做竞价湘潭做网站 搜搜磐石网络
  • 郑州免费建站搭建网页平台
  • 长沙网站优化对策企业官网wordpress主题下载
  • 昆山网站设计网站建设亻金手指下拉
  • 行业数据网站建设培训网站
  • 商业设计网站推荐制作网站报价
  • 建设网站的企业邮箱红酒哪个网站做的好
  • 图片链接生成网站国外做珠宝的网站有哪些
  • 企业网站建设管理及推广手机微信网页版登录
  • 六盘水市住房和城乡建设局网站标签云wordpress
  • dedecms可以做什么网站织梦做的网站在手机上显示