You are not logged in.

#1 2005-12-20 19:59:55

joe
Member
From: Folsom, CA
Registered: 2004-07-27
Posts: 51
Website

School assignment I'd like to expand

For school, we had an assignment that basically was a simple top-like program, in that it extracts information from /proc.  Now that I finished the class, I want to expand on the work that I had done and make something that may be very useful.

The program was written in C, and was my first significant time programming in that language. 

Anyways, I'm looking for criticisms, ideas or whatever.  I know there's a lot of bugs, hacks and probably very inefficient code and all sorts of goodies like that, and I just want feedback from people who know more than I do. There was a lot of "ok it works, move on" type of code in there that could use some reworking...

If you're bored and want to give feedback, here's the gcc4 compliant source:

http://gaia.ecs.csus.edu/~olivasj/newtop.tar.gz

Thanks in advance.

By the way, the class is over and I got an A on everything, so I'm not one of those looking for people to do my homework...

Offline

#2 2005-12-20 21:09:32

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: School assignment I'd like to expand

joe wrote:

For school, we had an assignment that basically was a simple top-like program, in that it extracts information from /proc.  Now that I finished the class, I want to expand on the work that I had done and make something that may be very useful.

The program was written in C, and was my first significant time programming in that language. 
...
If you're bored and want to give feedback, here's the gcc4 compliant source

So, I clicked on the link thinking "another crappy school assignment, let's see how bad this is", and was very surprised.  While I haven't gone through and compiled it, I looked through a decent chunk of the code and it's very nicely done and very clean.  In fact, it's probably better, from a code-cleanliness perspective, than alot of open source projects I've looked at.

I just wanted to applaud you for that.  I really have no suggestions or anything, but keep up the good work.

Offline

#3 2005-12-20 21:27:39

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: School assignment I'd like to expand

I, on the other hand, haven't looked at the code, but anyway it seems to be a very decent program, putting all those useful information in one place ;-)

Quite an achievement for a mere school assignment, I'd say. Congratulations and keep up the good work :-)

Offline

#4 2005-12-20 22:39:38

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

Re: School assignment I'd like to expand

I dunno C to comment on the code but thats a nice program lol Has a lot of neato info, well done champ!

Offline

#5 2005-12-21 20:38:43

joe
Member
From: Folsom, CA
Registered: 2004-07-27
Posts: 51
Website

Re: School assignment I'd like to expand

Thanks everyone for the compliments.

Here's a question: Is there anything you would have done differently? (besides language choice?)

Offline

#6 2005-12-21 21:07:23

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: School assignment I'd like to expand

joe wrote:

Thanks everyone for the compliments.

Here's a question: Is there anything you would have done differently? (besides language choice?)

Hmmm, if you'd realy like to expand it... it might be fun (though a bit of a challenge perhaps) to make it configurable similar to torsmo/conky.

i.e. the config file would look similar to:

${diskinfo /dev/hda1}
${cpuinfo 0} - ${cpuinfo 1}
${top}

Also, adding key bindings to reorder the top output would be nice too...

Offline

#7 2005-12-21 22:26:40

kth5
Member
Registered: 2004-04-29
Posts: 657
Website

Re: School assignment I'd like to expand

*aplauds*

haven't had a look at the source yet but i already like it. colors per default make it way prettier than top per default, heh. anyway i'd suggest to add support for powerpc. could be easy if you have a look at their cpuinfo:

processor       : 0
cpu             : 740/750
temperature     : 24 C (uncalibrated)
clock           : 400MHz
revision        : 2.2 (pvr 0008 0202)
bogomips        : 794.62
machine         : PowerMac1,1
motherboard     : PowerMac1,1 MacRISC Power Macintosh
detected as     : 66 (Blue&White G3)
pmac flags      : 00000000
L2 cache        : 1024K unified
memory          : 512MB
pmac-generation : NewWorld

also a process selector wouldn't be bad. like cursor keys up/down and then select one for a detailed process-tree view like in ps afx but for one process only. wink


I recognize that while theory and practice are, in theory, the same, they are, in practice, different. -Mark Mitchell

Offline

#8 2005-12-22 01:06:13

joe
Member
From: Folsom, CA
Registered: 2004-07-27
Posts: 51
Website

Re: School assignment I'd like to expand

kth5 wrote:

*aplauds*

haven't had a look at the source yet but i already like it. colors per default make it way prettier than top per default, heh. anyway i'd suggest to add support for powerpc. could be easy if you have a look at their cpuinfo:

processor       : 0
cpu             : 740/750
temperature     : 24 C (uncalibrated)
clock           : 400MHz
revision        : 2.2 (pvr 0008 0202)
bogomips        : 794.62
machine         : PowerMac1,1
motherboard     : PowerMac1,1 MacRISC Power Macintosh
detected as     : 66 (Blue&White G3)
pmac flags      : 00000000
L2 cache        : 1024K unified
memory          : 512MB
pmac-generation : NewWorld

also a process selector wouldn't be bad. like cursor keys up/down and then select one for a detailed process-tree view like in ps afx but for one process only. wink

Hmmm, I never thought about support for PPC, good idea! 

Now only if I could have a nice iso installer for ArchPPC I could install on my G3 iMac tongue

I've thought about doing the process selection thing, too...

Keep the ideas rolling!!

Offline

#9 2005-12-22 01:14:07

kth5
Member
Registered: 2004-04-29
Posts: 657
Website

Re: School assignment I'd like to expand

joe wrote:

Now only if I could have a nice iso installer for ArchPPC I could install on my G3 iMac tongue

oh man... i know, i have been promising to come up with a working one ever since linuxtag 2005 and i am truly sorry about not having spent the effort yet. feel free to pm me though or catch me on irc://irc.freenode.net/#archlinux-ppc, maybe i can be of help. that is, if you're really interested.


I recognize that while theory and practice are, in theory, the same, they are, in practice, different. -Mark Mitchell

Offline

#10 2005-12-22 03:43:31

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: School assignment I'd like to expand

I haven't looked at the code but it's very nice as the usual top  doen't have disk statistics. As a suggestion, you could add keybindings to quit the app or to kill a process.  For ideas, you could also checkout htop. It's an improved top. There's a package in extra.

Offline

Board footer

Powered by FluxBB