I have been trying to develop an application that would model a system using Graph Theory (See [1]) Graph theory, basically, can be used in order to model runnables in order to figure out their partitions (grouped runnables) and can be used in order to map them to cores.

In order to achieve this, we need many information. Since I don't know about how Linux (Raspbian in particular for us) OS schedules everything in detail and I'm interested in finding out how our algorithm will improve core utilization, I thought I could obtain the information of processes and try to model them myself.

For that purpose, we need:

Instruction size, how many instructions CPU runs to complete the task (very important) Memory needed for the process, physical memory and virtual memory Core load for debugging the processes. Read/write accesses, which process is it communicating with, is it a read or write access, what kind of interface is it, and what is the instruction size and memory needed to read and/or write. I think I can extract some of these information by using 'top' command in Linux. It gives the core load, memory usage, virtual and physical memory. I also think I should mention that I'm intending to use 'taskset' in order to place processes to cores to see their information (See [2]).

Now the first question I have is how do I effectively obtain the instruction sizes, r/w accesses and the things I listed above?

Second question is there any possible way to see runnables of a process, i.e. simple functions it runs. And also their information and r/w accesses with each other? This question is simply about finding out a way to model a process itself, rather than the interactions of processes?

Third, Do you guys know if there is a way to visualize processes and their instruction sizes in a graph using some tool?

[1] http://math.tut.fi/~ruohonen/GT_English.pdf

[2] To place a process to a core, I use:

pid = $(pgrep -u root -f $process_name -n)
sudo taskset -pc $core $pid &&
echo "Process $process_name with PID=$pid has been placed on core $core"
  • For 1 and 2: You may need to write some plugins to do everything you want, but valgrind likely does much of what you need. It runs your program on a virtual CPU, and you can get traces of instructions and memory and cache accesses. Look at the sample plugin called lackey. Dec 12 '16 at 17:35
  • Hmm, I found that there is a tool that is called kcachegrind that is based on valgrind. It helps to profile ONE process. And its not in a chronological order, rather it is just the function calls. Do you think its possible to visualize runnables of a process in chronological order? And more importantly, is there a tool that helps see the whole system execution, hence inter-process calls and the instructions spent with those. Would it help to profile systemd? Dec 13 '16 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.