Message-ID: <1319494779.40265.YahooMailNeo@domain.hid> Date: Mon, 24 Oct 2011 15:19:39 -0700 (PDT) From: makarand pradhan MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-916455410-1222723818-1319494779=:40265" Subject: [Xenomai-core] CPU utilization question Reply-To: makarand pradhan List-Id: Xenomai life and development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "xenomai@xenomai.org" ---916455410-1222723818-1319494779=:40265 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Greetings all,=0A=0AI am working on a real time power pc embedded system wh= ich uses xenomai. I am presently noticing a CPU utilization which I am not = able to explain. Will highly appreciate your opinion on the problem describ= ed below.=0A=0AI'm summarizing my understanding. Pl feel free to correct me= .=0AI'm using /proc/xenomai/stat to get the CPU util. I'm assuming that the= ROOT thread captures the %CPU spent in Linux/secnodary and each xenomai th= read listed, captures the %CPU in primary domain. If a thread transitions t= o the secondary, then I'm assuming that the %util in secondary domain will = get accounted against ROOT and the actual % usage in primary will get accou= nted against the thread.=0A=0AProblem:=0AI'm starting a xenomai thread usin= g rt_task_spawn.=A0=0A=A0 =A0 =A0 =A0 rt_task_spawn(&task2, "Task 2 ", STAC= K_SIZE, 11, 0, task2_func, NULL);=0A=0AThe thread invoking rt_task_spawn, s= leeps for a long long time without doing anything, or I can pause it.=0Asle= ep(5000000);=0A=0AThe xenomai task does rt_printfs periodically.=0A=0AWith = this setup, I was hoping to see 0% CPU util for the linux task in top.=0A= =0AContrary to this expectation, I notice CPU util as high as 3.1% when I t= op the linux process:=0A=0A=A0 PID USER =A0 =A0 =A0PR =A0NI =A0VIRT =A0RES = =A0SHR S %CPU %MEM =A0 =A0TIME+ =A0COMMAND =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0=A0=0A=A07988 root =A0 =A0 =A020 =A0 0 =A04940 4376 3688 S =A03.1 =A00.= 8 =A0 0:01.65 a.out =A0 =A0 =A0=0A=0AThe CPU % varies based on the activity= I do in the primary domain. i.e. more rt_printfs more %CPU in both primary= and secondary.=0A=0A=0AQuestion:=0A=0AIf the linux process is sleeping, wh= y do I see a CPU util against the process?=A0=0AWhy is the CPU % util vary = based on the activity I do in the primary domain?=0A=0AThanks for taking th= e time to look at the question.=0A=0AWould highly appreciate your inputs.= =0A=0AWarm Rgds,=0AMakarand. ---916455410-1222723818-1319494779=:40265 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Greet= ings all,

I am working on a = real time power pc embedded system which uses xenomai. I am presently notic= ing a CPU utilization which I am not able to explain. Will highly appreciat= e your opinion on the problem described below.

I'm summarizing my understanding. Pl feel free to correc= t me.
I'm using /proc/xenomai/stat to get the CPU util. I'm a= ssuming that the ROOT thread captures the %CPU spent in Linux/secnodary and= each xenomai thread listed, captures the %CPU in primary domain. If a thre= ad transitions to the secondary, then I'm assuming that the %util in second= ary domain will get accounted against ROOT and the actual % usage in primar= y will get accounted against the thread.

Problem:
I'm starting a xenomai thread us= ing rt_task_spawn. 
        rt_task_spawn(&task= 2, "Task 2 ", STACK_SIZE, 11, 0, task2_func, NULL);

The thread invoking rt_task_spa= wn, sleeps for a long long time without doing anything, or I can pause it.<= /div>
=09sleep(5000000)= ;
The xenomai task does rt_printfs periodic= ally.

With this setup, I was= hoping to see 0% CPU util for the linux task in top.

Contrary to this expectation, I notice CPU uti= l as high as 3.1% when I top the linux process:

&n= bsp; PID USER      PR  NI  VIRT  RES  SH= R S %CPU %MEM    TIME+  COMMAND         =                      = ;                     &nb= sp;     
 7988 root      20   0 &n= bsp;4940 4376 3688 S  3.1  0.8   0:01.65 a.out  =    

The CPU % varies based o= n the activity I do in the primary domain. i.e. more rt_printfs more %CPU i= n both primary and secondary.

Question:
If the linux process i= s sleeping, why do I see a CPU util against the process? 
Why is the CPU % util vary based on the activity I do in the prima= ry domain?

Thanks for taking the= time to look at the question.


Warm Rgds,
Makarand.
=


---916455410-1222723818-1319494779=:40265--