]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
DW:
authorwessels <>
Sun, 16 Jul 2000 13:28:38 +0000 (13:28 +0000)
committerwessels <>
Sun, 16 Jul 2000 13:28:38 +0000 (13:28 +0000)
 - Add some more counters.  These track success and failure of
   disk operations.

src/fs/diskd/store_dir_diskd.cc
src/fs/diskd/store_diskd.h
src/fs/diskd/store_io_diskd.cc

index 19a980b313c490d7bcb5a38d2f15f96156393db1..ff09287be117e4b3c8cf86ce3628ee22ab849c99 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_diskd.cc,v 1.15 2000/06/27 22:06:23 hno Exp $
+ * $Id: store_dir_diskd.cc,v 1.16 2000/07/16 07:28:38 wessels Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -446,6 +446,19 @@ storeDiskdStats(StoreEntry * sentry)
     storeAppendPrintf(sentry, "open_fail_queue_len: %d\n", diskd_stats.open_fail_queue_len);
     storeAppendPrintf(sentry, "block_queue_len: %d\n", diskd_stats.block_queue_len);
     diskd_stats.max_away = diskd_stats.max_shmuse = 0;
+    storeAppendPrintf(sentry, "\n             OPS SUCCESS    FAIL\n");
+    storeAppendPrintf(sentry, "%7s %7d %7d %7d\n",
+       "open", diskd_stats.open.ops, diskd_stats.open.success, diskd_stats.open.fail);
+    storeAppendPrintf(sentry, "%7s %7d %7d %7d\n",
+       "create", diskd_stats.create.ops, diskd_stats.create.success, diskd_stats.create.fail);
+    storeAppendPrintf(sentry, "%7s %7d %7d %7d\n",
+       "close", diskd_stats.close.ops, diskd_stats.close.success, diskd_stats.close.fail);
+    storeAppendPrintf(sentry, "%7s %7d %7d %7d\n",
+       "unlink", diskd_stats.unlink.ops, diskd_stats.unlink.success, diskd_stats.unlink.fail);
+    storeAppendPrintf(sentry, "%7s %7d %7d %7d\n",
+       "read", diskd_stats.read.ops, diskd_stats.read.success, diskd_stats.read.fail);
+    storeAppendPrintf(sentry, "%7s %7d %7d %7d\n",
+       "write", diskd_stats.write.ops, diskd_stats.write.success, diskd_stats.write.fail);
 }
 
 /*
@@ -482,10 +495,9 @@ storeDiskdDirCallback(SwapDir * SD)
 
     if (diskdinfo->away >= diskdinfo->magic2) {
        diskd_stats.block_queue_len++;
-        retval = 1; /* We might not have anything to do, but our queue
-                     * is full.. */
+       retval = 1;             /* We might not have anything to do, but our queue
+                                * is full.. */
     }
-
     if (diskd_stats.sent_count - diskd_stats.recv_count >
        diskd_stats.max_away) {
        diskd_stats.max_away = diskd_stats.sent_count - diskd_stats.recv_count;
@@ -495,7 +507,7 @@ storeDiskdDirCallback(SwapDir * SD)
        memset(&M, '\0', sizeof(M));
        x = msgrcv(diskdinfo->rmsgid, &M, msg_snd_rcv_sz, 0, IPC_NOWAIT);
        if (x < 0)
-               break;
+           break;
        else if (x != msg_snd_rcv_sz) {
            debug(81, 1) ("storeDiskdDirCallback: msgget returns %d\n",
                x);
@@ -504,7 +516,7 @@ storeDiskdDirCallback(SwapDir * SD)
        diskd_stats.recv_count++;
        diskdinfo->away--;
        storeDiskdHandle(&M);
-        retval = 1; /* Return that we've actually done some work */
+       retval = 1;             /* Return that we've actually done some work */
        if (M.shm_offset > -1)
            storeDiskdShmPut(SD, M.shm_offset);
     }
@@ -1156,7 +1168,7 @@ storeDiskdDirCleanLogNextEntry(SwapDir * sd)
  * "write" an entry to the clean log file.
  */
 static void
-storeDiskdDirWriteCleanEntry(SwapDir *sd, const StoreEntry * e)
+storeDiskdDirWriteCleanEntry(SwapDir * sd, const StoreEntry * e)
 {
     storeSwapLogData s;
     static size_t ss = sizeof(storeSwapLogData);
index 4c410d09a065eb3515aee6cf15c945af439796e0..91b6985150483544d58a750184338d78dc9f01cc 100644 (file)
@@ -73,6 +73,11 @@ struct _diskd_stats {
     int sent_count;
     int recv_count;
     int sio_id;
+    struct {
+       int ops;
+       int success;
+       int fail;
+    } open, create, close, unlink, read, write;
 };
 
 typedef struct _diskd_stats diskd_stats_t;
index 4fd6eb0bb9041a489001a16390c765f2806eba30..b46f26b4b85d9d56dd8b8dc492baceaa99d07d0e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_io_diskd.cc,v 1.13 2000/07/06 00:08:28 wessels Exp $
+ * $Id: store_io_diskd.cc,v 1.14 2000/07/16 07:28:38 wessels Exp $
  *
  * DEBUG: section 81    Squid-side DISKD I/O functions.
  * AUTHOR: Duane Wessels
@@ -102,6 +102,7 @@ storeDiskdOpen(SwapDir * SD, StoreEntry * e, STFNCB * file_callback,
        cbdataFree(sio);
        return NULL;
     }
+    diskd_stats.open.ops++;
     return sio;
 }
 
@@ -162,6 +163,7 @@ storeDiskdCreate(SwapDir * SD, StoreEntry * e, STFNCB * file_callback,
        return NULL;
     }
     storeDiskdDirReplAdd(SD, e);
+    diskd_stats.create.ops++;
     return sio;
 }
 
@@ -184,6 +186,7 @@ storeDiskdClose(SwapDir * SD, storeIOState * sio)
        debug(50, 1) ("storeDiskdSend CLOSE: %s\n", xstrerror());
        storeDiskdIOCallback(sio, DISK_ERROR);
     }
+    diskd_stats.close.ops++;
 }
 
 void
@@ -222,6 +225,7 @@ storeDiskdRead(SwapDir * SD, storeIOState * sio, char *buf, size_t size, off_t o
        storeDiskdShmPut(SD, shm_offset);
        storeDiskdIOCallback(sio, DISK_ERROR);
     }
+    diskd_stats.read.ops++;
 }
 
 void
@@ -253,6 +257,7 @@ storeDiskdWrite(SwapDir * SD, storeIOState * sio, char *buf, size_t size, off_t
        storeDiskdShmPut(SD, shm_offset);
        storeDiskdIOCallback(sio, DISK_ERROR);
     }
+    diskd_stats.write.ops++;
 }
 
 void
@@ -288,6 +293,7 @@ storeDiskdUnlink(SwapDir * SD, StoreEntry * e)
        unlink(buf);            /* XXX EWW! */
        storeDiskdShmPut(SD, shm_offset);
     }
+    diskd_stats.unlink.ops++;
 }
 
 
@@ -301,7 +307,10 @@ storeDiskdOpenDone(diomsg * M)
     debug(81, 3) ("storeDiskdOpenDone: dirno %d, fileno %08x status %d\n",
        sio->swap_dirn, sio->swap_filen, M->status);
     if (M->status < 0) {
+       diskd_stats.open.fail++;
        storeDiskdIOCallback(sio, DISK_ERROR);
+    } else {
+       diskd_stats.open.success++;
     }
 }
 
@@ -313,9 +322,11 @@ storeDiskdCloseDone(diomsg * M)
     debug(81, 3) ("storeDiskdCloseDone: dirno %d, fileno %08x status %d\n",
        sio->swap_dirn, sio->swap_filen, M->status);
     if (M->status < 0) {
+       diskd_stats.close.fail++;
        storeDiskdIOCallback(sio, DISK_ERROR);
        return;
     }
+    diskd_stats.close.success++;
     storeDiskdIOCallback(sio, DISK_OK);
 }
 
@@ -339,9 +350,11 @@ storeDiskdReadDone(diomsg * M)
     debug(81, 3) ("storeDiskdReadDone: dirno %d, fileno %08x status %d\n",
        sio->swap_dirn, sio->swap_filen, M->status);
     if (M->status < 0) {
+       diskd_stats.read.fail++;
        storeDiskdIOCallback(sio, DISK_ERROR);
        return;
     }
+    diskd_stats.read.success++;
     sbuf = diskdinfo->shm.buf + M->shm_offset;
     len = M->status;
     xmemcpy(their_buf, sbuf, len);     /* yucky copy */
@@ -364,9 +377,11 @@ storeDiskdWriteDone(diomsg * M)
     debug(81, 3) ("storeDiskdWriteDone: dirno %d, fileno %08x status %d\n",
        sio->swap_dirn, sio->swap_filen, M->status);
     if (M->status < 0) {
+       diskd_stats.write.fail++;
        storeDiskdIOCallback(sio, DISK_ERROR);
        return;
     }
+    diskd_stats.write.success++;
     sio->offset += M->status;
 }
 
@@ -376,6 +391,10 @@ storeDiskdUnlinkDone(diomsg * M)
     debug(81, 3) ("storeDiskdUnlinkDone: fileno %08x status %d\n",
        M->id, M->status);
     statCounter.syscalls.disk.unlinks++;
+    if (M->status < 0)
+       diskd_stats.unlink.fail++;
+    else
+       diskd_stats.unlink.success++;
 }
 
 void