From: wessels <> Date: Sat, 20 May 2006 06:11:59 +0000 (+0000) Subject: Made stream outputting more consistent in Mem::PoolReport. Use a X-Git-Tag: SQUID_3_0_PRE4~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eecdacf625e83c2bfe5ad419bc1cc4b54afb023f;p=thirdparty%2Fsquid.git Made stream outputting more consistent in Mem::PoolReport. Use a const char * for the column delimiter instead of repeating "\t " on each line. Always put the delimiter at the end of the (source code) line. --- diff --git a/src/mem.cc b/src/mem.cc index e7294b078a..2b64c0d6e1 100644 --- a/src/mem.cc +++ b/src/mem.cc @@ -1,6 +1,6 @@ /* - * $Id: mem.cc,v 1.95 2006/05/20 00:05:02 wessels Exp $ + * $Id: mem.cc,v 1.96 2006/05/20 00:11:59 wessels Exp $ * * DEBUG: section 13 High Level Memory Pool Management * AUTHOR: Harvest Derived @@ -545,16 +545,14 @@ Mem::PoolReport(const MemPoolStats * mp_st, const MemPoolMeter * AllMeter, std:: int excess = 0; int needed = 0; MemPoolMeter *pm = mp_st->meter; + const char *delim = "\t "; - stream << std::setw(20) << std::left << mp_st->label; - stream << "\t " << std::setw(4) << std::right; - stream << mp_st->obj_size; + stream << std::setw(20) << std::left << mp_st->label << delim; + stream << std::setw(4) << std::right << mp_st->obj_size << delim; /* Chunks */ - stream << "\t " << std::setw(4); - stream << toKB(mp_st->obj_size * mp_st->chunk_capacity); - stream << "\t " << std::setw(4) << mp_st->chunk_capacity; - stream << "\t "; + stream << std::setw(4) << toKB(mp_st->obj_size * mp_st->chunk_capacity) << delim; + stream << std::setw(4) << mp_st->chunk_capacity << delim; if (mp_st->chunk_capacity) { needed = mp_st->items_inuse / mp_st->chunk_capacity; @@ -565,11 +563,11 @@ Mem::PoolReport(const MemPoolStats * mp_st, const MemPoolMeter * AllMeter, std:: excess = mp_st->chunks_inuse - needed; } - stream << std::setw(4) << mp_st->chunks_alloc << "\t "; - stream << std::setw(4) << mp_st->chunks_inuse << "\t "; - stream << std::setw(4) << mp_st->chunks_free << "\t "; - stream << std::setw(4) << mp_st->chunks_partial << "\t "; - stream << std::setprecision(3) << xpercent(excess, needed) << "\t "; + stream << std::setw(4) << mp_st->chunks_alloc << delim; + stream << std::setw(4) << mp_st->chunks_inuse << delim; + stream << std::setw(4) << mp_st->chunks_free << delim; + stream << std::setw(4) << mp_st->chunks_partial << delim; + stream << std::setprecision(3) << xpercent(excess, needed) << delim; /* * Fragmentation calculation: * needed = inuse.level / chunk_capacity @@ -579,24 +577,25 @@ Mem::PoolReport(const MemPoolStats * mp_st, const MemPoolMeter * AllMeter, std:: * Fragm = (alloced - (inuse / obj_ch) ) / alloced */ /* allocated */ - stream << mp_st->items_alloc << "\t "; - stream << toKB(mp_st->obj_size * pm->alloc.level) << "\t "; - stream << toKB(mp_st->obj_size * pm->alloc.hwater_level) << "\t "; - stream << std::setprecision(2) << ((squid_curtime - pm->alloc.hwater_stamp) / 3600.); - stream << "\t " << std::setprecision(3) << xpercent(mp_st->obj_size * pm->alloc.level, AllMeter->alloc.level); + stream << mp_st->items_alloc << delim; + stream << toKB(mp_st->obj_size * pm->alloc.level) << delim; + stream << toKB(mp_st->obj_size * pm->alloc.hwater_level) << delim; + stream << std::setprecision(2) << ((squid_curtime - pm->alloc.hwater_stamp) / 3600.) << delim; + stream << std::setprecision(3) << xpercent(mp_st->obj_size * pm->alloc.level, AllMeter->alloc.level) << delim; /* in use */ - stream << "\t" << mp_st->items_inuse << "\t "; - stream << toKB(mp_st->obj_size * pm->inuse.level) << "\t "; - stream << toKB(mp_st->obj_size * pm->inuse.hwater_level) << "\t "; - stream << std::setprecision(2) << ((squid_curtime - pm->inuse.hwater_stamp) / 3600.); - stream << "\t " << std::setprecision(3) << xpercent(pm->inuse.level, pm->alloc.level); + stream << mp_st->items_inuse << delim; + stream << toKB(mp_st->obj_size * pm->inuse.level) << delim; + stream << toKB(mp_st->obj_size * pm->inuse.hwater_level) << delim; + stream << std::setprecision(2) << ((squid_curtime - pm->inuse.hwater_stamp) / 3600.) << delim; + stream << std::setprecision(3) << xpercent(pm->inuse.level, pm->alloc.level) << delim; /* idle */ - stream << "\t" << mp_st->items_idle << "\t " << toKB(mp_st->obj_size * pm->idle.level); - stream << "\t " << toKB(mp_st->obj_size * pm->idle.hwater_level) << "\t"; + stream << mp_st->items_idle << delim; + stream << toKB(mp_st->obj_size * pm->idle.level) << delim; + stream << toKB(mp_st->obj_size * pm->idle.hwater_level) << delim; /* saved */ - stream << (int)pm->gb_saved.count << "\t "; - stream << std::setprecision(3) << xpercent(pm->gb_saved.count, AllMeter->gb_saved.count); - stream << "\t " << std::setprecision(3) << xpercent(pm->gb_saved.bytes, AllMeter->gb_saved.bytes) << "\t "; + stream << (int)pm->gb_saved.count << delim; + stream << std::setprecision(3) << xpercent(pm->gb_saved.count, AllMeter->gb_saved.count) << delim; + stream << std::setprecision(3) << xpercent(pm->gb_saved.bytes, AllMeter->gb_saved.bytes) << delim; stream << std::setprecision(3) << xdiv(pm->gb_saved.count - pm->gb_osaved.count, xm_deltat) << "\n"; pm->gb_osaved.count = pm->gb_saved.count; }