Autosizing column widths in ps(1).

Alexander Best arundel at freebsd.org
Sun Jul 24 22:22:24 UTC 2011


On Sun Jul 24 11, Edward Tomasz Napiera?a wrote:
> Wiadomo?? napisana przez Test Rat w dniu 22 lip 2011, o godz. 19:21:
> > Edward Tomasz Napiera?a <trasz at freebsd.org> writes:
> > 
> >> Patch below changes ps(1) to automatically size column widths according to their
> >> contents.  From the user point of view, it prevents breaking layout with too wide values
> >> and in most cases makes output narrower.  From the developer point of view, it removes
> >> the need to specify widths.  Testing is welcome - the patch shouldn't change ps(1)
> >> behaviour except slightly changing the widths, but the code changes are pretty large
> >> and it's quite possible I've missed something.
> > 
> > STAT column seems to be right-aligned when it was previously left-aligned.
> > This makes sorting it harder, e.g.
> > 
> >  $ ps ax | (IFS=; read h; echo $h; sort -k3) | less
> 
> Good catch, thanks!  Updated patch, which also fixes two issues affecting TTY column,
> is at http://people.freebsd.org/~trasz/ps-9.diff.

working great here. have you experienced any performance issues, due to ps
having to iterate through all columns before constructing the output in
comparison to the previous design?

cheers.
alex

P.S.: one utility which would also benefit from auto column sizing is top, for
sure! ;)

> 
> --
> If you cut off my head, what would I say?  Me and my head, or me and my body?
> 


More information about the freebsd-hackers mailing list