0

I am new to multi-threading and C++11 threads, and I am trying to see how threads behave at an architectural level. Now it can be possible that different threads have their own independent control flow. How can I get the basic block information and the control flow graph for different threads on the same run? Can it be done through g++ or do I need some other tools?

  • What do basic blocks and CFGs have to do with learning multithreading? – user253751 Sep 07 '15 at 00:47
  • Changed question to be more specific. I am interested at the architecture level about how much time each thread takes to execute a basic block, and so forth. –  Sep 07 '15 at 00:52
  • you can use gcov and gprof for dump information about basicblock execution and callgraph if you decide, but i don't know if multi-threading information is dump – Jordy Baylac Sep 07 '15 at 00:56
  • But does gprof give information such as which all basic blocks has a thread gone through, and how many times has the thread gone through a particular basic block? –  Sep 07 '15 at 00:59
  • @AbhishekDas , review the man page of gprof and gcov, i have never dealt multi-threading with gcov or gprof. – Jordy Baylac Sep 07 '15 at 01:06
  • AFAIK, this is off-topic for stack overflow. Thread scheduling is system dependent and had little to do with C++ or any programming language. Different threads in the same process share the address space, but execution is independent otherwise. There is no guarantees how "threads behave on architectural level" anymore than how "processes behave on architectural level". Anyway, off-topic, too broad, etc. – user3427419 Sep 07 '15 at 01:22
  • Well people have given answers for getting control flow graph and basic block information from c programs. So I thought, there might be people who know it for multiple threads in C++ too. –  Sep 07 '15 at 01:49

0 Answers0