From: Amos Jeffries Date: Sun, 15 Mar 2015 18:13:19 +0000 (-0700) Subject: Cleanup: extend SBuf debugging information X-Git-Tag: merge-candidate-3-v1~214 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28b7e5a922590f931693b6e17ec167158840e47a;p=thirdparty%2Fsquid.git Cleanup: extend SBuf debugging information It can be hard determining what simple operations (ie cow(), grow()) are being done no what SBuf object. Add the SBuf::id to debugs() output on many more operations. --- diff --git a/src/SBuf.cc b/src/SBuf.cc index ead90673c2..7d8217559d 100644 --- a/src/SBuf.cc +++ b/src/SBuf.cc @@ -182,7 +182,7 @@ SBuf::rawSpace(size_type minSpace) // it's available, we're effectively claiming ownership // of it. If it's not, we need to go away (realloc) if (store_->canAppend(off_+len_, minSpace)) { - debugs(24, 7, "not growing"); + debugs(24, 7, id << "not growing"); return bufEnd(); } // TODO: we may try to memmove before realloc'ing in order to avoid @@ -508,7 +508,7 @@ SBuf::consume(size_type n) n = length(); else n = min(n, length()); - debugs(24, 8, "consume " << n); + debugs(24, 8, id << "consume " << n); SBuf rv(substr(0, n)); chop(n); return rv; @@ -539,6 +539,8 @@ SBuf::rawContent() const void SBuf::forceSize(size_type newSize) { + debugs(24, 8, id << "force " << (newSize > length() ? "grow" : "shrink") << " to length=" << newSize); + Must(store_->LockCount() == 1); if (newSize > min(maxSize,store_->capacity-off_)) throw SBufTooBigException(__FILE__,__LINE__); @@ -902,7 +904,7 @@ SBuf::toString() const void SBuf::reAlloc(size_type newsize) { - debugs(24, 8, "new size: " << newsize); + debugs(24, 8, id << "new size: " << newsize); if (newsize > maxSize) throw SBufTooBigException(__FILE__, __LINE__); MemBlob::Pointer newbuf = new MemBlob(newsize); @@ -911,7 +913,7 @@ SBuf::reAlloc(size_type newsize) store_ = newbuf; off_ = 0; ++stats.cowSlow; - debugs(24, 7, "new store capacity: " << store_->capacity); + debugs(24, 7, id << "new store capacity: " << store_->capacity); } SBuf& @@ -932,12 +934,12 @@ SBuf::lowAppend(const char * memArea, size_type areaSize) void SBuf::cow(SBuf::size_type newsize) { - debugs(24, 8, "new size:" << newsize); + debugs(24, 8, id << "new size:" << newsize); if (newsize == npos || newsize < length()) newsize = length(); if (store_->LockCount() == 1 && newsize == length()) { - debugs(24, 8, "no cow needed"); + debugs(24, 8, id << "no cow needed"); ++stats.cowFast; return; }