1 1.1 christos The following are sample outputs of the pfilestat tool for various scenarios. 2 1.1 christos 3 1.1 christos 4 1.1 christos 5 1.1 christos Starting with something simple, 6 1.1 christos 7 1.1 christos Running: dd if=/dev/rdsk/c0d0s0 of=/dev/null bs=56k # x86, 32-bit 8 1.1 christos 9 1.1 christos # ./pfilestat `pgrep -x dd` 10 1.1 christos 11 1.1 christos STATE FDNUM Time Filename 12 1.1 christos read 3 2% /devices/pci@0,0/pci-ide@1f,1/ide@0/cmdk@0,0 13 1.1 christos write 4 3% /devices/pseudo/mm@0:null 14 1.1 christos waitcpu 0 7% 15 1.1 christos running 0 16% 16 1.1 christos sleep-r 0 69% 17 1.1 christos 18 1.1 christos STATE FDNUM KB/s Filename 19 1.1 christos write 4 53479 /devices/pseudo/mm@0:null 20 1.1 christos read 3 53479 /devices/pci@0,0/pci-ide@1f,1/ide@0/cmdk@0,0 21 1.1 christos 22 1.1 christos Total event time (ms): 4999 Total Mbytes/sec: 104 23 1.1 christos 24 1.1 christos Most of the time we are sleeping on read, which is to be expected as dd on 25 1.1 christos the raw device is simple -> read:entry, strategy, biodone, read:return. 26 1.1 christos CPU time in read() itself is small. 27 1.1 christos 28 1.1 christos 29 1.1 christos 30 1.1 christos Now for the dsk device, 31 1.1 christos 32 1.1 christos Running: dd if=/dev/dsk/c0d0s0 of=/dev/null bs=56k # x86, 32-bit 33 1.1 christos 34 1.1 christos # ./pfilestat `pgrep -x dd` 35 1.1 christos 36 1.1 christos STATE FDNUM Time Filename 37 1.1 christos write 4 5% /devices/pseudo/mm@0:null 38 1.1 christos waitcpu 0 8% 39 1.1 christos running 0 15% 40 1.1 christos sleep-r 0 18% 41 1.1 christos read 3 53% /devices/pci@0,0/pci-ide@1f,1/ide@0/cmdk@0,0 42 1.1 christos 43 1.1 christos STATE FDNUM KB/s Filename 44 1.1 christos read 3 53492 /devices/pci@0,0/pci-ide@1f,1/ide@0/cmdk@0,0 45 1.1 christos write 4 53492 /devices/pseudo/mm@0:null 46 1.1 christos 47 1.1 christos Total event time (ms): 4914 Total Mbytes/sec: 102 48 1.1 christos 49 1.1 christos Woah, we are now spending much more time in read()! I imagine segmap is 50 1.1 christos a busy bee. The "running" and "write" times are hardly different. 51 1.1 christos 52 1.1 christos 53 1.1 christos 54 1.1 christos Now for a SPARC demo of the same, 55 1.1 christos 56 1.1 christos Running: dd if=/dev/dsk/c0d0s0 of=/dev/null bs=56k # SPARC, 64-bit 57 1.1 christos 58 1.1 christos # ./pfilestat `pgrep -x dd` 59 1.1 christos 60 1.1 christos STATE FDNUM Time Filename 61 1.1 christos write 4 3% /devices/pseudo/mm@0:zero 62 1.1 christos waitcpu 0 7% 63 1.1 christos running 0 17% 64 1.1 christos read 3 24% /devices/pci@1f,0/pci@1,1/ide@3/dad@0,0:a 65 1.1 christos sleep-r 0 54% 66 1.1 christos 67 1.1 christos STATE FDNUM KB/s Filename 68 1.1 christos read 3 13594 /devices/pci@1f,0/pci@1,1/ide@3/dad@0,0:a 69 1.1 christos write 4 13606 /devices/pseudo/mm@0:zero 70 1.1 christos 71 1.1 christos Total event time (ms): 4741 Total Mbytes/sec: 25 72 1.1 christos 73 1.1 christos I did prime the cache by running this a few times first. There is less 74 1.1 christos read() time than with the x86 32-bit demo, as I would guess that the 75 1.1 christos process is more often exhausting the (faster) segmap cache and getting 76 1.1 christos to the point where it must sleep. (However, do take this comparison with 77 1.1 christos a grain of salt - my development servers aren't ideal for comparing 78 1.1 christos statistics: one is a 867 MHz Pentium, and the other a 360 MHz Ultra 5). 79 1.1 christos 80 1.1 christos The file system cache is faster on 64-bit systems due to the segkpm 81 1.1 christos enhancement in Solaris 10. For details see, 82 1.1 christos http://blogs.sun.com/roller/page/rmc?entry=solaris_10_fast_filesystem_cache 83 1.1 christos 84 1.1 christos 85 1.1 christos 86 1.1 christos Now, back to x86. 87 1.1 christos 88 1.1 christos Running: tar cf /dev/null / 89 1.1 christos 90 1.1 christos # ./pfilestat `pgrep -x tar` 91 1.1 christos 92 1.1 christos STATE FDNUM Time Filename 93 1.1 christos read 11 0% /extra1/test/amd64/libCstd.so.1 94 1.1 christos read 11 0% /extra1/test/amd64/libXm.so 95 1.1 christos read 11 0% /extra1/test/amd64/libXm.so.4 96 1.1 christos read 11 1% /extra1/test/amd64/libgtk-x11-2.0.so 97 1.1 christos read 11 2% /extra1/test/amd64/libgtk-x11-2.0.so.0 98 1.1 christos waitcpu 0 2% 99 1.1 christos read 9 4% /extra1/5000 100 1.1 christos write 3 7% /devices/pseudo/mm@0:null 101 1.1 christos running 0 19% 102 1.1 christos sleep-r 0 46% 103 1.1 christos 104 1.1 christos STATE FDNUM KB/s Filename 105 1.1 christos read 11 293 /extra1/test/amd64/libgdk-x11-2.0.so 106 1.1 christos read 11 295 /extra1/test/amd64/libgdk-x11-2.0.so.0 107 1.1 christos read 9 476 /extra1/1000 108 1.1 christos read 11 526 /extra1/test/amd64/libCstd.so.1 109 1.1 christos read 11 594 /extra1/test/amd64/libXm.so.4 110 1.1 christos read 11 594 /extra1/test/amd64/libXm.so 111 1.1 christos read 11 1603 /extra1/test/amd64/libgtk-x11-2.0.so.0 112 1.1 christos read 11 1606 /extra1/test/amd64/libgtk-x11-2.0.so 113 1.1 christos read 9 4078 /extra1/5000 114 1.1 christos write 3 21254 /devices/pseudo/mm@0:null 115 1.1 christos 116 1.1 christos Total event time (ms): 4903 Total Mbytes/sec: 41 117 1.1 christos 118 1.1 christos Fair enough. tar is crusing along at 21 Mbytes/sec (writes to fd 3!). 119 1.1 christos 120 1.1 christos 121 1.1 christos 122 1.1 christos More interesting is to do the following, 123 1.1 christos 124 1.1 christos Running: tar cf - / | gzip > /dev/null 125 1.1 christos 126 1.1 christos # ./pfilestat `pgrep -x tar` 127 1.1 christos 128 1.1 christos STATE FDNUM Time Filename 129 1.1 christos read 11 0% /extra1/test/amd64/libm.so 130 1.1 christos read 11 0% /extra1/test/amd64/libm.so.2 131 1.1 christos read 11 0% /extra1/test/amd64/libnsl.so 132 1.1 christos read 11 0% /extra1/test/amd64/libnsl.so.1 133 1.1 christos read 11 0% /extra1/test/amd64/libc.so.1 134 1.1 christos write 3 2% <none> 135 1.1 christos waitcpu 0 4% 136 1.1 christos sleep-r 0 4% 137 1.1 christos running 0 6% 138 1.1 christos sleep-w 0 78% 139 1.1 christos 140 1.1 christos STATE FDNUM KB/s Filename 141 1.1 christos read 11 74 /extra1/test/amd64/libldap.so 142 1.1 christos read 11 75 /extra1/test/amd64/libldap.so.5 143 1.1 christos read 11 75 /extra1/test/amd64/libresolv.so.2 144 1.1 christos read 11 76 /extra1/test/amd64/libresolv.so 145 1.1 christos read 11 97 /extra1/test/amd64/libm.so.2 146 1.1 christos read 11 98 /extra1/test/amd64/libm.so 147 1.1 christos read 11 174 /extra1/test/amd64/libnsl.so 148 1.1 christos read 11 176 /extra1/test/amd64/libnsl.so.1 149 1.1 christos read 11 216 /extra1/test/amd64/libc.so.1 150 1.1 christos write 3 3022 <none> 151 1.1 christos 152 1.1 christos Total event time (ms): 4911 Total Mbytes/sec: 6 153 1.1 christos 154 1.1 christos Woah now, tar is writing 3 Mbytes/sec - AND spending 78% of it's time on 155 1.1 christos sleep-w, sleeping on writes! Of course, this is because we are piping the 156 1.1 christos output to gzip, which is spending a while compressing the data. 78% 157 1.1 christos matches the time gzip was on the CPU (using either "prstat -m" or dtrace 158 1.1 christos to measure; procfs's pr_pctcpu would take too long to catch up). 159 1.1 christos 160 1.1 christos 161 1.1 christos 162 1.1 christos 163 1.1 christos Also interesting is, 164 1.1 christos 165 1.1 christos Running: perl -e 'while (1) {;}' & 166 1.1 christos Running: perl -e 'while (1) {;}' & 167 1.1 christos Running: perl -e 'while (1) {;}' & 168 1.1 christos Running: perl -e 'while (1) {;}' & 169 1.1 christos Running: tar cf /dev/null / 170 1.1 christos 171 1.1 christos # ./pfilestat `pgrep -x tar` 172 1.1 christos 173 1.1 christos STATE FDNUM Time Filename 174 1.1 christos read 11 0% /extra1/test/amd64/libxml2.so.2 175 1.1 christos read 11 0% /extra1/test/amd64/libgdk-x11-2.0.so.0 176 1.1 christos read 11 0% /extra1/test/amd64/libgdk-x11-2.0.so 177 1.1 christos read 11 0% /extra1/test/amd64/libCstd.so.1 178 1.1 christos read 11 0% /extra1/test/amd64/libgtk-x11-2.0.so.0 179 1.1 christos read 11 2% /extra1/test/amd64/libgtk-x11-2.0.so 180 1.1 christos write 3 2% /devices/pseudo/mm@0:null 181 1.1 christos running 0 8% 182 1.1 christos sleep-r 0 22% 183 1.1 christos waitcpu 0 65% 184 1.1 christos 185 1.1 christos STATE FDNUM KB/s Filename 186 1.1 christos read 11 182 /extra1/test/amd64/libsun_fc.so 187 1.1 christos read 11 264 /extra1/test/amd64/libglib-2.0.so 188 1.1 christos read 11 266 /extra1/test/amd64/libglib-2.0.so.0 189 1.1 christos read 11 280 /extra1/test/amd64/libxml2.so.2 190 1.1 christos read 11 293 /extra1/test/amd64/libgdk-x11-2.0.so 191 1.1 christos read 11 295 /extra1/test/amd64/libgdk-x11-2.0.so.0 192 1.1 christos read 11 526 /extra1/test/amd64/libCstd.so.1 193 1.1 christos read 11 761 /extra1/test/amd64/libgtk-x11-2.0.so.0 194 1.1 christos read 11 1606 /extra1/test/amd64/libgtk-x11-2.0.so 195 1.1 christos write 3 7881 /devices/pseudo/mm@0:null 196 1.1 christos 197 1.1 christos Total event time (ms): 4596 Total Mbytes/sec: 13 198 1.1 christos 199 1.1 christos Now we have "waitcpu" as tar competes for CPU cycles along with the greedy 200 1.1 christos infinite perl processes. 201