Discrepancy between ps -i -o inblk and figuring numbers by hand
Jonathan Stewart
jonstew1983 at yahoo.com
Thu Mar 24 19:30:31 PST 2005
--- Dan Nelson <dnelson at allantgroup.com> wrote:
> In the last episode (Mar 24), Jonathan Stewart said:
> > When I run the command ps -u -o inblock on a process reading a
> > 262144000 byte file the highest block count I see is ~2010 but my
> > filesystem block size is 16384 and 262144000/16384 is 16000 so it
> > seems to be off by about a factor of 8. I even tried looking
> through
> > the source code for the ps command but my C is not good enough for
> me
> > to figure it out. Can someone explain or help me figure out what is
> > going on please.
>
> That ps column actually looks at the rusage value ru_inblk, which
> doesn't count the number blocks read, but the number of times the
> kernel did physical I/O on behalf of the process (how often the
> kernel
> blocked doing a read). The clustering code will fetch up to
> sysctl(vfs.read_max) blocks at a time into disk cache, so reading
> sequential files will increment ru_inblock (blocks_in_file/read_max)
> times. Raising vfs.read_max to 32 will greatly increase sequential
> read performance on fast RAID arrays.
>
In that case how would I track how much information a process has
actually read from a drive? I occasionally run processes that will
read as much as 40+ gig in a single run which takes quite a while and
on windows :P I can see "bytes read" and "bytes written" per process
which lets me track how much the program has read so far and thus get
an idea of how close it is to done. Sorry for the run-on sentence
there.
Thanks,
Jonathan
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
More information about the freebsd-questions
mailing list