Subject: Re: O(n^2) or worse ? cat /proc/net/tcp

From: Andi Kleen <[email-masked]>
Date: 24 Mar 2008 05:06:28 +0100

Matti Aarnio <[email-masked]> writes:
> 
> I did observe odd slowness at first with  "lsof -p .."  program, 

You could oprofile it.

> then at
> "netstat -na".  Same slowdown happens with:  cat /proc/net/tcp
> (that 'cat' took 25 seconds...)

/proc/net/tcp should be only O(n^2) if the application does a lot of 
open()/seek()/read()/close() for very small chunks, but at least netstat
doesn't do that. Not sure about lsof though.

-Andi