/*
- * $Id: MemObject.cc,v 1.13 2004/08/30 05:12:31 robertc Exp $
+ * $Id: MemObject.cc,v 1.14 2004/12/27 11:04:36 serassio Exp $
*
* DEBUG: section 19 Store Memory Primitives
* AUTHOR: Robert Collins
struct StoreClientStats : public unary_function<store_client, void>
{
- StoreClientStats(StoreEntry *anEntry):where(anEntry),index(0){}
+ StoreClientStats(MemBuf *anEntry):where(anEntry),index(0){}
void operator()(store_client const &x)
{
x.dumpStats(where, index++);
}
- StoreEntry *where;
+ MemBuf *where;
size_t index;
};
void
-MemObject::stat (StoreEntry *s) const
+MemObject::stat (MemBuf * mb) const
{
- storeAppendPrintf(s, "\t%s %s\n",
- RequestMethodStr[method], log_url);
- storeAppendPrintf(s, "\tinmem_lo: %d\n", (int) inmem_lo);
- storeAppendPrintf(s, "\tinmem_hi: %d\n", (int) data_hdr.endOffset());
- storeAppendPrintf(s, "\tswapout: %d bytes queued\n",
- (int) swapout.queue_offset);
+ memBufPrintf(mb, "\t%s %s\n",
+ RequestMethodStr[method], log_url);
+ memBufPrintf(mb, "\tinmem_lo: %d\n", (int) inmem_lo);
+ memBufPrintf(mb, "\tinmem_hi: %d\n", (int) data_hdr.endOffset());
+ memBufPrintf(mb, "\tswapout: %d bytes queued\n",
+ (int) swapout.queue_offset);
if (swapout.sio.getRaw())
- storeAppendPrintf(s, "\tswapout: %d bytes written\n",
- (int) swapout.sio->offset());
+ memBufPrintf(mb, "\tswapout: %d bytes written\n",
+ (int) swapout.sio->offset());
- StoreClientStats statsVisitor(s);
+ StoreClientStats statsVisitor(mb);
for_each<StoreClientStats>(clients, statsVisitor);
}
/*
- * $Id: MemObject.h,v 1.9 2004/08/30 05:12:31 robertc Exp $
+ * $Id: MemObject.h,v 1.10 2004/12/27 11:04:36 serassio Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
void write(StoreIOBuffer, STMCB *, void *);
void unlinkRequest();
HttpReply const *getReply() const;
- void stat (StoreEntry *s) const;
+ void stat (MemBuf * mb) const;
off_t endOffset () const;
size_t size() const;
void reset();
/*
- * $Id: StoreClient.h,v 1.12 2004/08/30 05:12:31 robertc Exp $
+ * $Id: StoreClient.h,v 1.13 2004/12/27 11:04:36 serassio Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
void doCopy (StoreEntry *e);
void readHeader(const char *buf, ssize_t len);
void copy(StoreEntry *, StoreIOBuffer, STCB *, void *);
- void dumpStats(StoreEntry * output, int clientNumber) const;
+ void dumpStats(MemBuf * output, int clientNumber) const;
off_t cmp_offset;
#if STORE_CLIENT_LIST_DEBUG
/*
- * $Id: stat.cc,v 1.386 2004/12/20 19:26:11 robertc Exp $
+ * $Id: stat.cc,v 1.387 2004/12/27 11:04:36 serassio Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
static void statCountersClean(StatCounters *);
static void statCountersCopy(StatCounters * dest, const StatCounters * orig);
static double statMedianSvc(int, int);
-static void statStoreEntry(StoreEntry * s, StoreEntry * e);
+static void statStoreEntry(MemBuf * mb, StoreEntry * e);
static double statCPUUsage(int minutes);
static OBJH stat_io_get;
static OBJH stat_objects_get;
}
static void
-statStoreEntry(StoreEntry * s, StoreEntry * e)
+statStoreEntry(MemBuf * mb, StoreEntry * e)
{
MemObject *mem = e->mem_obj;
- storeAppendPrintf(s, "KEY %s\n", e->getMD5Text());
- storeAppendPrintf(s, "\t%s\n", describeStatuses(e));
- storeAppendPrintf(s, "\t%s\n", storeEntryFlags(e));
- storeAppendPrintf(s, "\t%s\n", describeTimestamps(e));
- storeAppendPrintf(s, "\t%d locks, %d clients, %d refs\n",
- (int) e->lock_count,
- storePendingNClients(e),
- (int) e->refcount);
- storeAppendPrintf(s, "\tSwap Dir %d, File %#08X\n",
- e->swap_dirn, e->swap_filen);
+ memBufPrintf(mb, "KEY %s\n", e->getMD5Text());
+ memBufPrintf(mb, "\t%s\n", describeStatuses(e));
+ memBufPrintf(mb, "\t%s\n", storeEntryFlags(e));
+ memBufPrintf(mb, "\t%s\n", describeTimestamps(e));
+ memBufPrintf(mb, "\t%d locks, %d clients, %d refs\n",
+ (int) e->lock_count,
+ storePendingNClients(e),
+ (int) e->refcount);
+ memBufPrintf(mb, "\tSwap Dir %d, File %#08X\n",
+ e->swap_dirn, e->swap_filen);
if (mem != NULL)
- mem->stat (s);
+ mem->stat (mb);
- storeAppendPrintf(s, "\n");
+ memBufPrintf(mb, "\n");
}
/* process objects list */
return;
}
- storeBuffer(state->sentry);
debug(49, 3) ("statObjects: Bucket #%d\n", state->bucket);
link_next = hash_get_bucket(store_table, state->bucket);
- while (NULL != (link_ptr = link_next)) {
- link_next = link_ptr->next;
- e = (StoreEntry *) link_ptr;
+ if (link_next) {
+ MemBuf mb;
+ memBufDefInit(&mb);
- if (state->filter && 0 == state->filter(e))
- continue;
+ while (NULL != (link_ptr = link_next)) {
+ link_next = link_ptr->next;
+ e = (StoreEntry *) link_ptr;
- statStoreEntry(state->sentry, e);
+ if (state->filter && 0 == state->filter(e))
+ continue;
+
+ statStoreEntry(&mb, e);
+ }
+
+ storeAppend(state->sentry, mb.buf, mb.size);
+ memBufClean(&mb);
}
state->bucket++;
eventAdd("statObjects", statObjects, state, 0.0, 1);
- storeBufferFlush(state->sentry);
}
static void
/*
- * $Id: store_client.cc,v 1.138 2004/12/20 16:30:36 robertc Exp $
+ * $Id: store_client.cc,v 1.139 2004/12/27 11:04:37 serassio Exp $
*
* DEBUG: section 90 Storage Manager Client-Side Interface
* AUTHOR: Duane Wessels
}
void
-store_client::dumpStats(StoreEntry * output, int clientNumber) const
+store_client::dumpStats(MemBuf * output, int clientNumber) const
{
if (_callback.pending())
return;
- storeAppendPrintf(output, "\tClient #%d, %p\n", clientNumber, _callback.callback_data);
+ memBufPrintf(output, "\tClient #%d, %p\n", clientNumber, _callback.callback_data);
- storeAppendPrintf(output, "\t\tcopy_offset: %lu\n",
- (unsigned long) copyInto.offset);
+ memBufPrintf(output, "\t\tcopy_offset: %lu\n",
+ (unsigned long) copyInto.offset);
- storeAppendPrintf(output, "\t\tcopy_size: %d\n",
- (int) copyInto.length);
+ memBufPrintf(output, "\t\tcopy_size: %d\n",
+ (int) copyInto.length);
- storeAppendPrintf(output, "\t\tflags:");
+ memBufPrintf(output, "\t\tflags:");
if (flags.disk_io_pending)
- storeAppendPrintf(output, " disk_io_pending");
+ memBufPrintf(output, " disk_io_pending");
if (flags.store_copying)
- storeAppendPrintf(output, " store_copying");
+ memBufPrintf(output, " store_copying");
if (flags.copy_event_pending)
- storeAppendPrintf(output, " copy_event_pending");
+ memBufPrintf(output, " copy_event_pending");
- storeAppendPrintf(output, "\n");
+ memBufPrintf(output, "\n");
}
bool