From: adrian <> Date: Wed, 20 Sep 2006 14:13:38 +0000 (+0000) Subject: Add profiling points for Membuf::grow, ::append and ::consume X-Git-Tag: SQUID_3_0_PRE5~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d29274cbd9309b65cf1ed37a50f832193c1aade;p=thirdparty%2Fsquid.git Add profiling points for Membuf::grow, ::append and ::consume --- diff --git a/include/profiling.h b/include/profiling.h index 31dc1270d5..b3fdf33e9a 100644 --- a/include/profiling.h +++ b/include/profiling.h @@ -130,6 +130,9 @@ typedef enum { XPROF_headersEnd, XPROF_parseHttpRequest, XPROF_HttpStateData_processReplyHeader, + XPROF_MemBuf_consume, + XPROF_MemBuf_append, + XPROF_MemBuf_grow, XPROF_LAST } xprof_type; diff --git a/src/MemBuf.cc b/src/MemBuf.cc index 1de033a661..443f416380 100644 --- a/src/MemBuf.cc +++ b/src/MemBuf.cc @@ -1,6 +1,6 @@ /* - * $Id: MemBuf.cc,v 1.41 2005/09/17 05:50:07 wessels Exp $ + * $Id: MemBuf.cc,v 1.42 2006/09/20 08:13:38 adrian Exp $ * * DEBUG: section 59 auto-growing Memory Buffer with printf * AUTHOR: Alex Rousskov @@ -208,6 +208,7 @@ void MemBuf::consume(mb_size_t shiftSize) assert(0 <= shiftSize && shiftSize <= cSize); assert(!stolen); /* not frozen */ + PROF_start(MemBuf_consume); if (shiftSize > 0) { if (shiftSize < cSize) xmemmove(buf, buf + shiftSize, cSize - shiftSize); @@ -216,6 +217,7 @@ void MemBuf::consume(mb_size_t shiftSize) terminate(); } + PROF_stop(MemBuf_consume); } // calls memcpy, appends exactly size bytes, extends buffer if needed @@ -225,6 +227,7 @@ void MemBuf::append(const char *newContent, mb_size_t sz) assert(buf); assert(!stolen); /* not frozen */ + PROF_start(MemBuf_append); if (sz > 0) { if (size + sz + 1 > capacity) grow(size + sz + 1); @@ -235,6 +238,7 @@ void MemBuf::append(const char *newContent, mb_size_t sz) appended(sz); } + PROF_stop(MemBuf_append); } // updates content size after external append @@ -357,6 +361,8 @@ MemBuf::grow(mb_size_t min_cap) { assert(!stolen); assert(capacity < min_cap); + PROF_start(MemBuf_grow); + /* determine next capacity */ if (min_cap > 64 * 1024) { @@ -382,6 +388,7 @@ MemBuf::grow(mb_size_t min_cap) { /* done */ capacity = (mb_size_t) buf_cap; + PROF_stop(MemBuf_grow); }