cmp(1) has a bottleneck, but where?
Garrett Cooper
yanegomi at gmail.com
Tue Jan 3 08:21:12 UTC 2012
On Mon, Jan 2, 2012 at 11:37 PM, Dieter BSD <dieterbsd at engineer.com> wrote:
>>>>> Task: cp(1) a several-GB file from one drive to another,
>>>>> then run cmp(1) to verify. Cp runs as expected, but
>>>>> cmp runs slower than expected. Neither the disks
>>>>> nor the cpu is maxed out. Local drives, no network
>>>>> involved. Machine is otherwise idle.
>>>>
>>>> 1. How are you running cmp?
>>>> 2. Why do you claim cmp is the bottleneck? Is it spinning the CPU?
>>>
>>> cmp big_file /other_disk/big_file
>>>
>>> Cmp is running slower than it should. It isn't cpu bound ( 67.5%Idle )
>>> but it isn't disk bound either. Seems like it should be one or the
>>> other.
>>
>> What gets output on the console when you do CTRL-T?
>
> load: 0.59 cmd: cmp 93304 [vnread] 56.99r 8.50u 3.80s 23% 720k
> load: 0.59 cmd: cmp 93304 [vnread] 57.68r 8.60u 3.85s 22% 720k
> load: 0.54 cmd: cmp 93304 [vnread] 60.69r 9.03u 4.12s 22% 780k
> load: 0.54 cmd: cmp 93304 [runnable] 63.79r 9.58u 4.26s 22% 720k
> load: 0.58 cmd: cmp 93304 [runnable] 68.33r 10.28u 4.62s 21% 788k
> load: 0.53 cmd: cmp 93304 [runnable] 71.92r 10.78u 4.94s 23% 720k
> load: 0.53 cmd: cmp 93304 [vnread] 72.31r 10.84u 4.96s 21% 780k
> load: 0.44 cmd: cmp 93304 [vnread] 198.84r 30.64u 14.36s 23% 720k
Here's a pastebin to the gprof output for cmp of two almost
identical files (I added a byte at the end of the file):
http://pastebin.com/Rw355d8G .
Here's the time output of the process:
$ /usr/bin/time -l /usr/obj/usr/src/usr.bin/cmp/cmp /scratch/foo.iso*
99.48 real 27.35 user 33.32 sys
5820 maximum resident set size
251 average shared memory size
2083 average unshared data size
127 average unshared stack size
1310 page reclaims
1569083 page faults
0 swaps
49325 block input operations
88 block output operations
0 messages sent
0 messages received
0 signals received
396 voluntary context switches
13514 involuntary context switches
$ uname -a
FreeBSD streetfighter.ixsystems.com 10.0-CURRENT FreeBSD 10.0-CURRENT
#0 r227801: Mon Nov 21 14:04:39 PST 2011
root at streetfighter.ixsystems.com:/usr/obj/usr/src/sys/STREETFIGHTER
amd64
The file is 3.0GB in size. Look at all those page faults though!
Thanks!
-Garrett
More information about the freebsd-performance
mailing list