I am running a test program and want to check how many context switches is happening within that process. Basically, this busy loop takes more than
20 seconds to run in a system. Takes 2 seconds to run in my PC.
I want to know if there are other issues and whether the thread is running or context switched etc. How can I investigate this?
I tried the following command: watch -n2 grep ctxt /proc/5846/status
Which gives these numbers? Would nonvoluntary_ctxt_switches
be this big?
volatile unsigned long long i;
for(i = 0; i < 1000000000ULL; ++i);