Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12606 Discussions

Monitoring all loaded processes

Altera_Forum
Honored Contributor II
1,461 Views

Hi, 

 

I wondered if anybody could help me with this: I want to monitor all the processes that are loaded in µClinux (CPU usage, memory usage,...). 

 

Warm Regards
0 Kudos
13 Replies
Altera_Forum
Honored Contributor II
787 Views

Look in the /proc file system.

0 Kudos
Altera_Forum
Honored Contributor II
787 Views

 

--- Quote Start ---  

originally posted by hippo@Mar 22 2006, 03:30 AM 

look in the /proc file system. 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=13657) 

--- quote end ---  

 

--- Quote End ---  

 

Ok hippo, 

 

thanks 

 

Warm Regards
0 Kudos
Altera_Forum
Honored Contributor II
787 Views

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

I want to monitor all the processes that are loaded in µClinux (CPU usage, memory usage,...). 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=13655) 

--- Quote End ---  

[/b] 

--- Quote End ---  

 

Hi, 

 

To do so I executed the ps command, it gives all the stuff I need, unfortunately there is no top command so I got to write a script to execute the ps command every 3s and write results to a file. 

If anybody could help in that, that&#39;s gonna be cool. 

 

Warm Regards.
0 Kudos
Altera_Forum
Honored Contributor II
787 Views

 

--- Quote Start ---  

originally posted by mfm@Mar 24 2006, 02:42 AM 

...unfortunately there is no top command so i got to write a script to execute the ps command every 3s and write results to a file. 

if anybody could help in that, that&#39;s gonna be cool. 

--- Quote End ---  

 

Hi MFM, 

I haven&#39;t tried it yet, but it looks like top command may already have been been ported http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif  

 

* Follow step 13 here... 

http://forum.niosforum.com/forum/index.php?showtopic=3174# (http://forum.niosforum.com/forum/index.php?showtopic=3174#

 

* Select Miscellaneous Applications --> Propcs tools --> top
0 Kudos
Altera_Forum
Honored Contributor II
787 Views

Oops. I tried building the top and setserial apps from dist-test, however no binaries were generated. 

Any ideas?
0 Kudos
Altera_Forum
Honored Contributor II
787 Views

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

unfortunately there is no top command so I got to write a script to execute the ps command every 3s and write results to a file.[/b] 

--- Quote End ---  

 

 

Hi, 

 

well, I wrote that script and it works fine with one exception: 

I want to launch the ps command every 3s and save results in mfm.txt till the q key is pressed. 

I&#39;m still testing it in Redhat before implementing it in µClinux. 

The only problem is how to get the q key stopping the execution of the script 

# ################################## 

# !/bin/sh 

touch mfm.txt 

until [ "$*" = "q" ];  

      do  

            sleep 3 

            date >> mfm.txt 

            ps >> mfm.txt 

            echo " " >> mfm.txt; 

done 

# ################################## 

 

Can anybody help me with that ? 

 

Warm Regards
0 Kudos
Altera_Forum
Honored Contributor II
787 Views

Why are you doing this when you can just get &#39;top&#39; from busybox? Moreso, doesn&#39;t the processor need some sort of time reference to actual calculate loading on the CPU? IE: a RTC

0 Kudos
Altera_Forum
Honored Contributor II
787 Views

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

################################### 

# !/bin/sh 

touch mfm.txt 

until [ "$*" = "q" ];  

      do  

            sleep 3 

            date >> mfm.txt 

            ps >> mfm.txt 

            echo " " >> mfm.txt; 

done 

# ##################################/b 

--- Quote End ---  

 

 

Hi, 

I&#39;ve tried to execute that script under µClinux after changing the sleep 3 command, which isn&#39;t implemented in µClinux, by the following:# ############### 

for ((a=1;a<300;a++)) 

     do echo 

done# ############### 

But unfortunately it won&#39;t work http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/huh.gif  

I&#39;m getting some "syntax error". 

Can anybody help me with that. 

 

Warm Regards
0 Kudos
Altera_Forum
Honored Contributor II
787 Views

 

--- Quote Start ---  

originally posted by jdhar@Mar 24 2006, 06:02 PM 

why are you doing this when you can just get &#39;top&#39; from busybox? 

--- Quote End ---  

 

 

Hi, 

that&#39;s cause I spent a lot of time trying to compile it but all I got is a lot of errors 

maybe you can help. 

This is the console output (I&#39;m under Windows) 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

make -k all  

  no emulation specific options. 

nios2-elf-gcc -nostdinc -D__linux__ -O2 -I"c:/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"/include -I/cygdrive/c/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1//include -fno-optimize-sibling-calls -mhw-mul -mhw-mulx -Wall -c -o top.o top.c 

In file included from top.c:37: 

page.h:27:20: config.h: No such file or directory 

In file included from busybox.h:27, 

              from top.c:38: 

config.h:4:28: linux/autoconf.h: No such file or directory 

In file included from busybox.h:54, 

              from top.c:38: 

libbb.h:49:18: pwd_.h: No such file or directory 

libbb.h:50:18: grp_.h: No such file or directory 

In file included from busybox.h:54, 

              from top.c:38: 

libbb.h:426: warning: "struct passwd" declared inside parameter list 

libbb.h:426: warning: its scope is only this definition or declaration, which is probably not what you want 

libbb.h:427: warning: "struct passwd" declared inside parameter list 

libbb.h:435: warning: "struct passwd" declared inside parameter list 

libbb.h:436: warning: "struct passwd" declared inside parameter list 

libbb.h:438: warning: "struct passwd" declared inside parameter list 

libbb.h:439: warning: "struct passwd" declared inside parameter list 

top.c:57: warning: &#39;pid_sort&#39; defined but not used 

make: *** [top.o] Error 1 

make: Target `all&#39; not remade because of errors.[/b] 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
787 Views

 

--- Quote Start ---  

originally posted by jdhar@Mar 24 2006, 06:02 PM 

why are you doing this when you can just get &#39;top&#39; from busybox? 

--- Quote End ---  

 

 

I succeded in building that one but when I launch it, µClinux reboot. 

I tested it again and again and it&#39;s always the same!!!!!!! 

 

Any idea? 

 

Warm Regards
0 Kudos
Altera_Forum
Honored Contributor II
787 Views

Hi, 

 

If you are looking for something GUI based like Windows task manager, Then have a look at LTaMe (Linux Task Manager) in source forge. This was made by me and 3 of my friends. Works but got some small bugs. It is made of QT. If u want to monitor tasks running on target you will have to write some socket programs and run LTaMe on ur linux box. It currentlygives details about the linux box on which u run LTaMe. Have a look.  

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

Is any one interested in doing that??????????????????[/b] 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
787 Views

 

--- Quote Start ---  

originally posted by mfm+mar 25 2006, 01:31 am--><div class='quotetop'>quote (mfm @ mar 25 2006, 01:31 am)</div> 

--- quote start ---  

<!--quotebegin-jdhar@Mar 24 2006, 06:02 PM 

why are you doing this when you can just get &#39;top&#39; from busybox? 

--- Quote End ---  

 

 

I succeded in building that one but when I launch it, µClinux reboot. 

I tested it again and again and it&#39;s always the same!!!!!!! 

 

Any idea? 

 

Warm Regards 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=13771)</div> 

[/b] 

--- Quote End ---  

 

I checked the &#39;top&#39; of busybox with buildroot tools. It runs without problem.
0 Kudos
Altera_Forum
Honored Contributor II
787 Views

TO_BE_DONE

0 Kudos
Reply