简体   繁体   中英

Relationships between threads (tasks)

I know that there is no possibilty to distinguish any relationship between threads in the System.Thread model, but is it also not possible in the Task(Task) model?. I would like to profile a multithreaded application, the last thing I would like to do, is passing some kind of context to all my methods and threads. I would appreciate any ideas. What I would like to accomplish is similar to:

  1. ThreadMain -750ms (capture method calls)
    • Thread1 - 300ms (capture method calls)
      • Thread11 - 99ms (capture method calls)
      • Thread12 - 20ms (capture method calls)
    • Thread1 - 540ms (capture method calls)
      • Thread21 - 90ms (capture method calls)
      • Thread22 - 60ms (capture method calls)

I have an good idea of capturing the execution time using Postsharp, but I would like to find out the relationship of the parent/child threads. Any ideas?

没有这样的事情,线程是线程-它没有“父”或“子”线程的任何概念。

您可能可以按照NewThreadName.CreatedByThreadName的命名约定来命名线程,并使用System.Diagnostics.Process.Threads属性查找与该进程关联的线程。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM