HAMMER Utilities: Sync with 61E
authorMatthew Dillon <dillon@dragonflybsd.org>
Mon, 14 Jul 2008 20:28:07 +0000 (20:28 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Mon, 14 Jul 2008 20:28:07 +0000 (20:28 +0000)
* Implement hammer iostats

sbin/hammer/cmd_stats.c

index 0b67890..7ecbd39 100644 (file)
@@ -31,7 +31,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * 
- * $DragonFly: src/sbin/hammer/cmd_stats.c,v 1.2 2008/07/13 02:02:40 swildner Exp $
+ * $DragonFly: src/sbin/hammer/cmd_stats.c,v 1.3 2008/07/14 20:28:07 dillon Exp $
  */
 
 #include "hammer.h"
@@ -124,23 +124,33 @@ hammer_cmd_iostats(char **av, int ac)
        lens[3] = 16;
        lens[4] = 16;
        lens[5] = 16;
+       lens[6] = 16;
+       lens[7] = 16;
        r = 0;
 
-       r |= sysctlnametomib("vfs.hammer.stats_read",
+       r |= sysctlnametomib("vfs.hammer.stats_file_read",
                             mibs[0], &lens[0]);
-       r |= sysctlnametomib("vfs.hammer.stats_write",
+       r |= sysctlnametomib("vfs.hammer.stats_file_write",
                             mibs[1], &lens[1]);
-       r |= sysctlnametomib("vfs.hammer.stats_rd_cached",
+       r |= sysctlnametomib("vfs.hammer.stats_disk_read",
                             mibs[2], &lens[2]);
-       r |= sysctlnametomib("vfs.hammer.stats_wr_cached",
+       r |= sysctlnametomib("vfs.hammer.stats_disk_write",
                             mibs[3], &lens[3]);
+       r |= sysctlnametomib("vfs.hammer.stats_file_iopsr",
+                            mibs[4], &lens[4]);
+       r |= sysctlnametomib("vfs.hammer.stats_file_iopsw",
+                            mibs[5], &lens[5]);
+       r |= sysctlnametomib("vfs.hammer.stats_inode_flushes",
+                            mibs[6], &lens[6]);
+       r |= sysctlnametomib("vfs.hammer.stats_commits",
+                            mibs[7], &lens[7]);
        if (r < 0) {
                perror("sysctl: HAMMER stats not available");
                exit(1);
        }
 
        for (count = 0; ; ++count) {
-               for (i = 0; i < 4; ++i) {
+               for (i = 0; i <= 7; ++i) {
                        size = sizeof(stats[0]);
                        r = sysctl(mibs[i], lens[i], &stats[i], &size, NULL, 0);
                        if (r < 0) {
@@ -150,12 +160,15 @@ hammer_cmd_iostats(char **av, int ac)
                }
                if (count) {
                        if ((count & 15) == 1)
-                               printf("     reads     writes  rd_cached  wr_cached\n");
-                       printf("%10lld %10lld %10lld %10lld\n",
+                               printf("   file-rd   file-wr  dev-read dev-write inode_ops ino_flush  commits\n");
+                       printf("%9lld %9lld %9lld %9lld %9lld %8lld %8lld\n",
                                stats[0] - copy[0],
                                stats[1] - copy[1],
                                stats[2] - copy[2],
-                               stats[3] - copy[3]);
+                               stats[3] - copy[3],
+                               stats[4] + stats[5] - copy[4] - copy[5],
+                               stats[6] - copy[6],
+                               stats[7] - copy[7]);
                }
                sleep(delay);
                bcopy(stats, copy, sizeof(stats));