------------------------------------------------------------ revno: 13342 revision-id: squid3@treenet.co.nz-20140406070804-6mlnwwbmdh1rlmrt parent: chtsanti@users.sourceforge.net-20140404163647-lhpcewddnbbe1rr4 committer: Amos Jeffries branch nick: trunk timestamp: Sun 2014-04-06 00:08:04 -0700 message: Add counter for SBuf::c_str() calls It is useful to know how many c_str() calls are being made as each results in a possible reallocation. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20140406070804-6mlnwwbmdh1rlmrt # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: 9110c1e026b1e3a5fb5207e5bfc440c60cc4a4c7 # timestamp: 2014-04-07 05:53:55 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: chtsanti@users.sourceforge.net-20140404163647-\ # lhpcewddnbbe1rr4 # # Begin patch === modified file 'src/SBuf.cc' --- src/SBuf.cc 2014-02-21 10:46:19 +0000 +++ src/SBuf.cc 2014-04-06 07:08:04 +0000 @@ -59,7 +59,7 @@ : alloc(0), allocCopy(0), allocFromString(0), allocFromCString(0), assignFast(0), clear(0), append(0), toStream(0), setChar(0), getChar(0), compareSlow(0), compareFast(0), copyOut(0), - rawAccess(0), chop(0), trim(0), find(0), scanf(0), + rawAccess(0), nulTerminate(0), chop(0), trim(0), find(0), scanf(0), caseChange(0), cowFast(0), cowSlow(0), live(0) {} @@ -80,6 +80,7 @@ compareFast += ss.compareFast; copyOut += ss.copyOut; rawAccess += ss.rawAccess; + nulTerminate += ss.nulTerminate; chop += ss.chop; trim += ss.trim; find += ss.find; @@ -491,6 +492,7 @@ *rawSpace(1) = '\0'; ++store_->size; ++stats.setChar; + ++stats.nulTerminate; return buf(); } @@ -764,6 +766,7 @@ "\ncomparisons not requiring data-scan: " << compareFast << "\ncopy-out ops: " << copyOut << "\nraw access to memory: " << rawAccess << + "\nNULL terminate C string: " << nulTerminate << "\nchop operations: " << chop << "\ntrim operations: " << trim << "\nfind: " << find << === modified file 'src/SBuf.h' --- src/SBuf.h 2014-02-21 10:46:19 +0000 +++ src/SBuf.h 2014-04-06 07:08:04 +0000 @@ -77,6 +77,7 @@ uint64_t compareFast; ///