PDA

View Full Version : Where's the source code?



Znupi
March 4th, 2009, 07:59 PM
I'm trying to find the source code for any of these: top, gnome-system-monitor or the system monitor gnome panel applet. It seems I am unable to do that (I really don't know where to search -- tried Google but to no avail). Why I'm trying to do this is because I want to create a better alternative to `free'. For this, I need to know if there's any other way of reading available / used / total RAM (and maybe swap) memory than parsing /proc/meminfo.
Thanks.

Majorix
March 4th, 2009, 08:07 PM
What about the output from executing "free"?

Tibuda
March 4th, 2009, 08:15 PM
You can download the source code for any program in the repositories with apt-get source:
apt-get source packagename

Znupi
March 4th, 2009, 08:35 PM
You can download the source code for any program in the repositories with apt-get source:
apt-get source packagename
Thanks! I still can't find the source code for top or free, but I am able to find the source code for gnome-system-monitor. Do you have any idea where I can find the source code for top? If not, I'll just have to dig in the system monitor source :D

Majorix: did you read my post? I want to build a better alternative to free, or maybe even improve it (if there's no other way to read the free memory than parsing /proc/meminfo). What I don't like about it is the way it rounds up numbers when using different switches. And I would like to add a "-h" option (like ls -h) that would display sizes in a "human-readable" format.

cabalas
March 4th, 2009, 08:59 PM
You can find top at sourceforge here: http://sourceforge.net/projects/unixtop/

geirha
March 4th, 2009, 09:04 PM
$ which top # To get the full path of the command
/usr/bin/top
$ dpkg -S /usr/bin/top # Search for the package that installs that file
procps: /usr/bin/top
$ apt-get source procps # Get the source

Znupi
March 4th, 2009, 09:19 PM
Wow, thanks for the tips everyone! :)

monkeyking
March 5th, 2009, 02:20 AM
just out of curiosity what do you want to add to top?

I think /proc/meminfo is the base of every other memory monitor program on linux.
The same with /proc/cpuinfo