Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 24 Oct 2014, 07:26
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
pProcess 2.3.2 - Process manager
Post new topic   Reply to topic View previous topic :: View next topic
Page 5 of 5 [64 Posts]   Goto page: Previous 1, 2, 3, 4, 5
Author Message
zigbert


Joined: 29 Mar 2006
Posts: 5753
Location: Valåmoen, Norway

PostPosted: Wed 01 Aug 2012, 05:23    Post subject:  

Version 2.3.2
See main post

Changelog
- Adjust gettext to work with updated MoManager (thanks to BarryK)

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Wed 08 May 2013, 09:06    Post subject:  

I was playing around with awk to learn how to store associative arrays and ended up coming up with a way to replace ps that is almost as fast but with better configurability option ... so in case it is useful:

Code:
#usage: my_ps [Options]
#Options
#Name:State:Tgid:Pid:PPid:TracerPid:Uid:Gid:FDSize:Groups:VmPeak:VmSize:VmLck:VmPin:VmHWM:VmRSS:VmData:VmStk:VmExe:VmLib:
#VmPTE:VmSwap:Threads:SigQ:SigPnd:ShdPnd:SigBlk:SigIgn:SigCgt:CapInh:CapPrm:CapEff:CapBnd:Seccomp:Cpus_allowed:
#Cpus_allowed_list:voluntary_ctxt_switches:nonvoluntary_ctxt_switches
my_ps(){
echo $@ | awk 'BEGIN{FN=0}
   FNR==1{FN++}
   FN==1{
      argc=NF
      for(j=0;j<NF;j++){
         argv[j]=$(j+1)
         field[FN][$(j+1)]=$(j+1)
      }
   }
   FN>1{
      title=substr($1,0,length($1)-1)
      $1=""
      field[FN][title]=$0
   }
   END{
      for(i=1;i<FN;i++){
         for(j=0;j<argc;j++){
            printf "%-20s\t", field[i][argv[j]]
         }
         printf "\n"
      }
   }
' - /proc/*/status
}

for gtkdialog you'd probably want to change the formatting fron printf "%-20s\t", field[i][argv[j]] to printf "%s|", field[i][argv[j]]
and replace the last printf "\n" with printf "<something useful>\n"

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5753
Location: Valåmoen, Norway

PostPosted: Mon 13 May 2013, 11:58    Post subject:  

technosaurus
Thank you.
your alternative ps is noted, and will be considered by a major upgrade.

Your awk-thread is very helpful, and I am getting some basic knowledge of awk. Used in the right places, awk is like speed-of-light compared to bash.
I am thankful


Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Mon 13 May 2013, 13:39    Post subject:  

zigbert wrote:
Used in the right places, awk is like speed-of-light compared to bash.
Its not really faster per se, but its faster than using bash + all the extra utilities to get the same functionality as awk.

btw if you decide you want to use it let me know and I can rework it to play well with busybox awk (switch from using 2d arrays)

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 5 of 5 [64 Posts]   Goto page: Previous 1, 2, 3, 4, 5
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0717s ][ Queries: 13 (0.0269s) ][ GZIP on ]