This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git clone https://github.com/dotnet/diagnostics | |
| cd diagnostics | |
| git checkout -b PR_dotnet-dump_pstacks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > help dcq | |
| ------------------------------------------------------------------------------- | |
| DumpConcurrentQueue | |
| Lists all items in the given concurrent queue. | |
| For simple types such as numbers, boolean and string, values are shown. | |
| > dcq 00000202a79320e8 | |
| System.Collections.Concurrent.ConcurrentQueue<System.Int32> | |
| 1 - 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > help tks | |
| ------------------------------------------------------------------------------- | |
| TaskState [hexa address] [-v <decimal state value>] | |
| TaskState translates a Task m_stateFlags field value into human readable format. | |
| It supports hexadecimal address corresponding to a task instance or -v <decimal state value>. | |
| > tks 000001db16cf98f0 | |
| Running | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > tpq | |
| global work item queue________________________________ | |
| 0x000002AC3C1DDBB0 Work | (ASP.global_asax)System.Web.HttpApplication.ResumeStepsWaitCallback | |
| ... | |
| 0x000002AABEC19148 Task | System.Threading.Tasks.Dataflow.Internal.TargetCore<System.Action>.<ProcessAsyncIfNecessary_Slow>b__3 | |
| local per thread work items_____________________________________ | |
| 0x000002AE79D80A00 System.Threading.Tasks.ContinuationTaskFromTask | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > ti | |
| (S) 0x00007F7D84529CD0 @ 1000 ms every 1000 ms | 0000000000000000 () -> Kafka.Batching.AccumulatorByTopic<Kafka.Routing.FetchMessage>.Tick | |
| ... | |
| (L) 0x00007F7D844FA7A0 @ 1000 ms every 1000 ms | 0000000000000000 () -> Kafka.Batching.AccumulatorByTopic<Kafka.Routing.OffsetMessage>.Tick | |
| ... | |
| (L) 0x00007F7D842042F8 @ 999 ms every 1000 ms | 0000000000000000 () -> Criteo.DevKit.TimeStamp+<>c.cctor>b__35_0 | |
| ... | |
| (L) 0x00007F7D846314C8 @ 999 ms every 1000 ms | 00007F7D8462ED70 (Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.Heartbeat) -> | |
| ... | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ~~~~ 9c6c,4020 | |
| 2 System.Threading.Monitor.Wait(Object, Int32, Boolean) | |
| 4 System.Threading.Tasks.Task+c.cctor>b__278_1(Object) | |
| ... | |
| 4 System.Threading.Tasks.Task.ExecuteEntryUnsafe() | |
| 4 System.Threading.Tasks.Task.ExecuteWorkItem() | |
| 7 System.Threading.ThreadPoolWorkQueue.Dispatch() | |
| 7 System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private string GetNativeMethodName(ulong address) | |
| { | |
| var symbol = new NativeDbgHelp.SYMBOL_INFO(); | |
| symbol.MaxNameLen = 1024; | |
| symbol.SizeOfStruct = (uint)Marshal.SizeOf(symbol) - 1024; // char buffer is not counted | |
| // the ANSI version of SymFromAddr is called so each character is 1 byte long | |
| if (NativeDbgHelp.SymFromAddr(_hProcess, address, out var displacement, ref symbol)) | |
| { | |
| var buffer = new StringBuilder(symbol.Name.Length); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void SetupListeners(ETWTraceEventSource source) | |
| { | |
| ... | |
| // get notified when a module is load to map the corresponding symbols | |
| source.Kernel.ImageLoad += OnImageLoad; | |
| } | |
| const int ERROR_SUCCESS = 0; | |
| private void OnImageLoad(ImageLoadTraceData data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| session.EnableKernelProvider( | |
| KernelTraceEventParser.Keywords.ImageLoad | | |
| KernelTraceEventParser.Keywords.Process, | |
| KernelTraceEventParser.Keywords.None | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void Dispose() | |
| { | |
| if (_hProcess == IntPtr.Zero) | |
| return; | |
| _hProcess = IntPtr.Zero; | |
| _process.Dispose(); | |
| } |