From: wessels <> Date: Sun, 16 Jul 2000 13:28:38 +0000 (+0000) Subject: DW: X-Git-Tag: SQUID_3_0_PRE1~1892 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b09fabb6ff73de8aa1f7fb1c1d607d78dbbe1ae7;p=thirdparty%2Fsquid.git DW: - Add some more counters. These track success and failure of disk operations. --- diff --git a/src/fs/diskd/store_dir_diskd.cc b/src/fs/diskd/store_dir_diskd.cc index 19a980b313..ff09287be1 100644 --- a/src/fs/diskd/store_dir_diskd.cc +++ b/src/fs/diskd/store_dir_diskd.cc @@ -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); diff --git a/src/fs/diskd/store_diskd.h b/src/fs/diskd/store_diskd.h index 4c410d09a0..91b6985150 100644 --- a/src/fs/diskd/store_diskd.h +++ b/src/fs/diskd/store_diskd.h @@ -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; diff --git a/src/fs/diskd/store_io_diskd.cc b/src/fs/diskd/store_io_diskd.cc index 4fd6eb0bb9..b46f26b4b8 100644 --- a/src/fs/diskd/store_io_diskd.cc +++ b/src/fs/diskd/store_io_diskd.cc @@ -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