From: robertc <> Date: Thu, 3 Oct 2002 04:32:22 +0000 (+0000) Subject: split async io counters into started and finished to give better visibility on outsta... X-Git-Tag: SQUID_3_0_PRE1~714 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12e137b0e48abcee9185f2ed456afecd41c2c79b;p=thirdparty%2Fsquid.git split async io counters into started and finished to give better visibility on outstanding requests --- diff --git a/src/fs/aufs/aiops.cc b/src/fs/aufs/aiops.cc index 615c227493..fa735a4127 100644 --- a/src/fs/aufs/aiops.cc +++ b/src/fs/aufs/aiops.cc @@ -1,5 +1,5 @@ /* - * $Id: aiops.cc,v 1.13 2002/07/21 00:25:45 hno Exp $ + * $Id: aiops.cc,v 1.14 2002/10/02 22:32:22 robertc Exp $ * * DEBUG: section 43 AIOPS * AUTHOR: Stewart Forster @@ -58,19 +58,6 @@ enum _squidaio_thread_status { }; typedef enum _squidaio_thread_status squidaio_thread_status; -enum _squidaio_request_type { - _AIO_OP_NONE = 0, - _AIO_OP_OPEN, - _AIO_OP_READ, - _AIO_OP_WRITE, - _AIO_OP_CLOSE, - _AIO_OP_UNLINK, - _AIO_OP_TRUNCATE, - _AIO_OP_OPENDIR, - _AIO_OP_STAT -}; -typedef enum _squidaio_request_type squidaio_request_type; - typedef struct squidaio_request_t { struct squidaio_request_t *next; squidaio_request_type request_type; @@ -283,6 +270,7 @@ squidaio_init(void) /* Create threads and get them to sit in their wait loop */ squidaio_thread_pool = memPoolCreate("aio_thread", sizeof(squidaio_thread_t)); + assert (NUMTHREADS); for (i = 0; i < NUMTHREADS; i++) { threadp = memPoolAlloc(squidaio_thread_pool); threadp->status = _THREAD_STARTING; @@ -552,6 +540,7 @@ squidaio_cancel(squidaio_result_t * resultp) request->cancelled = 1; request->resultp = NULL; resultp->_data = NULL; + resultp->result_type = _AIO_OP_NONE; return 0; } return 1; @@ -572,6 +561,7 @@ squidaio_open(const char *path, int oflag, mode_t mode, squidaio_result_t * resu requestp->resultp = resultp; requestp->request_type = _AIO_OP_OPEN; requestp->cancelled = 0; + resultp->result_type = _AIO_OP_OPEN; squidaio_queue_request(requestp); return 0; @@ -603,6 +593,7 @@ squidaio_read(int fd, char *bufp, int bufs, off_t offset, int whence, squidaio_r requestp->resultp = resultp; requestp->request_type = _AIO_OP_READ; requestp->cancelled = 0; + resultp->result_type = _AIO_OP_READ; squidaio_queue_request(requestp); return 0; @@ -635,6 +626,7 @@ squidaio_write(int fd, char *bufp, int bufs, off_t offset, int whence, squidaio_ requestp->resultp = resultp; requestp->request_type = _AIO_OP_WRITE; requestp->cancelled = 0; + resultp->result_type = _AIO_OP_WRITE; squidaio_queue_request(requestp); return 0; @@ -661,6 +653,7 @@ squidaio_close(int fd, squidaio_result_t * resultp) requestp->resultp = resultp; requestp->request_type = _AIO_OP_CLOSE; requestp->cancelled = 0; + resultp->result_type = _AIO_OP_CLOSE; squidaio_queue_request(requestp); return 0; @@ -689,6 +682,7 @@ squidaio_stat(const char *path, struct stat *sb, squidaio_result_t * resultp) requestp->resultp = resultp; requestp->request_type = _AIO_OP_STAT; requestp->cancelled = 0; + resultp->result_type = _AIO_OP_STAT; squidaio_queue_request(requestp); return 0; @@ -715,6 +709,7 @@ squidaio_unlink(const char *path, squidaio_result_t * resultp) requestp->resultp = resultp; requestp->request_type = _AIO_OP_UNLINK; requestp->cancelled = 0; + resultp->result_type = _AIO_OP_UNLINK; squidaio_queue_request(requestp); return 0; @@ -741,6 +736,7 @@ squidaio_truncate(const char *path, off_t length, squidaio_result_t * resultp) requestp->resultp = resultp; requestp->request_type = _AIO_OP_TRUNCATE; requestp->cancelled = 0; + resultp->result_type = _AIO_OP_TRUNCATE; squidaio_queue_request(requestp); return 0; @@ -767,6 +763,7 @@ squidaio_opendir(const char *path, squidaio_result_t * resultp) if (!squidaio_initialised) squidaio_init(); requestp = memPoolAlloc(squidaio_request_pool); + resultp->result_type = _AIO_OP_OPENDIR; return -1; } diff --git a/src/fs/aufs/async_io.cc b/src/fs/aufs/async_io.cc index 98117807b2..3c9473c8c8 100644 --- a/src/fs/aufs/async_io.cc +++ b/src/fs/aufs/async_io.cc @@ -1,6 +1,6 @@ /* - * $Id: async_io.cc,v 1.14 2002/07/28 11:31:06 robertc Exp $ + * $Id: async_io.cc,v 1.15 2002/10/02 22:32:22 robertc Exp $ * * DEBUG: section 32 Asynchronous Disk I/O * AUTHOR: Pete Bentley @@ -59,14 +59,20 @@ typedef struct squidaio_ctrl_t { } squidaio_ctrl_t; static struct { - int open; - int close; - int cancel; - int write; - int read; - int stat; - int unlink; - int check_callback; + int open_start; + int open_finish; + int close_start; + int close_finish; + int cancel; + int write_start; + int write_finish; + int read_start; + int read_finish; + int stat_start; + int stat_finish; + int unlink_start; + int unlink_finish; + int check_callback; } squidaio_counts; typedef struct squidaio_unlinkq_t { @@ -112,7 +118,7 @@ aioOpen(const char *path, int oflag, mode_t mode, AIOCB * callback, void *callba squidaio_ctrl_t *ctrlp; assert(initialised); - squidaio_counts.open++; + squidaio_counts.open_start++; ctrlp = memPoolAlloc(squidaio_ctrl_pool); ctrlp->fd = -2; ctrlp->done_handler = callback; @@ -130,7 +136,7 @@ aioClose(int fd) squidaio_ctrl_t *ctrlp; assert(initialised); - squidaio_counts.close++; + squidaio_counts.close_start++; aioCancel(fd); ctrlp = memPoolAlloc(squidaio_ctrl_pool); ctrlp->fd = fd; @@ -180,7 +186,7 @@ aioWrite(int fd, int offset, char *bufp, int len, AIOCB * callback, void *callba int seekmode; assert(initialised); - squidaio_counts.write++; + squidaio_counts.write_start++; ctrlp = memPoolAlloc(squidaio_ctrl_pool); ctrlp->fd = fd; ctrlp->done_handler = callback; @@ -207,7 +213,7 @@ aioRead(int fd, int offset, char *bufp, int len, AIOCB * callback, void *callbac int seekmode; assert(initialised); - squidaio_counts.read++; + squidaio_counts.read_start++; ctrlp = memPoolAlloc(squidaio_ctrl_pool); ctrlp->fd = fd; ctrlp->done_handler = callback; @@ -231,7 +237,7 @@ aioStat(char *path, struct stat *sb, AIOCB * callback, void *callback_data) squidaio_ctrl_t *ctrlp; assert(initialised); - squidaio_counts.stat++; + squidaio_counts.stat_start++; ctrlp = memPoolAlloc(squidaio_ctrl_pool); ctrlp->fd = -2; ctrlp->done_handler = callback; @@ -248,7 +254,7 @@ aioUnlink(const char *path, AIOCB * callback, void *callback_data) { squidaio_ctrl_t *ctrlp; assert(initialised); - squidaio_counts.unlink++; + squidaio_counts.unlink_start++; ctrlp = memPoolAlloc(squidaio_ctrl_pool); ctrlp->fd = -2; ctrlp->done_handler = callback; @@ -264,7 +270,7 @@ aioTruncate(const char *path, off_t length, AIOCB * callback, void *callback_dat { squidaio_ctrl_t *ctrlp; assert(initialised); - squidaio_counts.unlink++; + squidaio_counts.unlink_start++; ctrlp = memPoolAlloc(squidaio_ctrl_pool); ctrlp->fd = -2; ctrlp->done_handler = callback; @@ -289,6 +295,30 @@ aioCheckCallbacks(SwapDir * SD) if ((resultp = squidaio_poll_done()) == NULL) break; ctrlp = (squidaio_ctrl_t *) resultp->data; + switch (resultp->result_type){ + case _AIO_OP_NONE: + case _AIO_OP_TRUNCATE: + case _AIO_OP_OPENDIR: + break; + case _AIO_OP_OPEN: + ++squidaio_counts.open_finish; + break; + case _AIO_OP_READ: + ++squidaio_counts.read_finish; + break; + case _AIO_OP_WRITE: + ++squidaio_counts.write_finish; + break; + case _AIO_OP_CLOSE: + ++squidaio_counts.close_finish; + break; + case _AIO_OP_UNLINK: + ++squidaio_counts.unlink_finish; + break; + case _AIO_OP_STAT: + ++squidaio_counts.stat_finish; + break; + } if (ctrlp == NULL) continue; /* XXX Should not happen */ dlinkDelete(&ctrlp->node, &used_list); @@ -316,16 +346,16 @@ void aioStats(StoreEntry * sentry) { storeAppendPrintf(sentry, "ASYNC IO Counters:\n"); - storeAppendPrintf(sentry, "Operation\t# Requests\n"); - storeAppendPrintf(sentry, "open\t%d\n", squidaio_counts.open); - storeAppendPrintf(sentry, "close\t%d\n", squidaio_counts.close); - storeAppendPrintf(sentry, "cancel\t%d\n", squidaio_counts.cancel); - storeAppendPrintf(sentry, "write\t%d\n", squidaio_counts.write); - storeAppendPrintf(sentry, "read\t%d\n", squidaio_counts.read); - storeAppendPrintf(sentry, "stat\t%d\n", squidaio_counts.stat); - storeAppendPrintf(sentry, "unlink\t%d\n", squidaio_counts.unlink); - storeAppendPrintf(sentry, "check_callback\t%d\n", squidaio_counts.check_callback); - storeAppendPrintf(sentry, "queue\t%d\n", squidaio_get_queue_len()); + storeAppendPrintf(sentry, "Operation\t# Requests\tNumber serviced\n"); + storeAppendPrintf(sentry, "open\t%d\t%d\n", squidaio_counts.open_start,squidaio_counts.open_finish); + storeAppendPrintf(sentry, "close\t%d\t%d\n", squidaio_counts.close_start,squidaio_counts.close_finish); + storeAppendPrintf(sentry, "cancel\t%d\t-\n", squidaio_counts.cancel); + storeAppendPrintf(sentry, "write\t%d\t%d\n", squidaio_counts.write_start,squidaio_counts.write_finish); + storeAppendPrintf(sentry, "read\t%d\t%d\n", squidaio_counts.read_start,squidaio_counts.read_finish); + storeAppendPrintf(sentry, "stat\t%d\t%d\n", squidaio_counts.stat_start,squidaio_counts.stat_finish); + storeAppendPrintf(sentry, "unlink\t%d\t%d\n", squidaio_counts.unlink_start,squidaio_counts.unlink_finish); + storeAppendPrintf(sentry, "check_callback\t%d\t-\n", squidaio_counts.check_callback); + storeAppendPrintf(sentry, "queue\t%d\t-\n", squidaio_get_queue_len()); } /* Flush all pending I/O */ diff --git a/src/fs/aufs/store_asyncufs.h b/src/fs/aufs/store_asyncufs.h index 34494a79f6..83250e3f70 100644 --- a/src/fs/aufs/store_asyncufs.h +++ b/src/fs/aufs/store_asyncufs.h @@ -25,9 +25,23 @@ #define ASYNC_WRITE 0 #define ASYNC_READ 1 +enum _squidaio_request_type { + _AIO_OP_NONE = 0, + _AIO_OP_OPEN, + _AIO_OP_READ, + _AIO_OP_WRITE, + _AIO_OP_CLOSE, + _AIO_OP_UNLINK, + _AIO_OP_TRUNCATE, + _AIO_OP_OPENDIR, + _AIO_OP_STAT +}; +typedef enum _squidaio_request_type squidaio_request_type; + struct _squidaio_result_t { int aio_return; int aio_errno; + enum _squidaio_request_type result_type; void *_data; /* Internal housekeeping */ void *data; /* Available to the caller */ };