From: Alex Rousskov Date: Fri, 15 Feb 2013 02:28:12 +0000 (-0700) Subject: Polished StoreEntry debugging to report more info, less noise. X-Git-Tag: SQUID_3_5_0_1~444^2~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c02804578be53521fad60dafb989149a1a91dc87;p=thirdparty%2Fsquid.git Polished StoreEntry debugging to report more info, less noise. Start with a relatively unique "e:" prefix to ease finding entries with specific properties in a large cache.log. Only report fileno and cache_dir ID if they are set. Only report non-default states and use mnemonics for them. Report all set flags using mnemonics. Report entry address in RAM. After a few lookups, mnemonics allow reading (and searching for) many logged entry states without referring to source code. While nobody is likely to remember all flags by heart, the most commonly used/important ones should be easy to remember. --- diff --git a/src/store.cc b/src/store.cc index 30d0e589c6..9cc73c397d 100644 --- a/src/store.cc +++ b/src/store.cc @@ -2025,9 +2025,42 @@ StoreEntry::isAccepting() const std::ostream &operator <<(std::ostream &os, const StoreEntry &e) { - return os << e.swap_filen << '@' << e.swap_dirn << '=' << - e.mem_status << '/' << e.ping_status << '/' << e.store_status << '/' << - e.swap_status << '*' << e.lock_count; + os << "e:"; + + if (e.swap_filen > -1 || e.swap_dirn > -1) + os << e.swap_filen << '@' << e.swap_dirn << '='; + + // print only non-default status values, using unique letters + if (e.mem_status != NOT_IN_MEMORY || + e.store_status != STORE_PENDING || + e.swap_status != SWAPOUT_NONE || + e.ping_status != PING_NONE) { + if (e.mem_status != NOT_IN_MEMORY) os << 'm'; + if (e.store_status != STORE_PENDING) os << 's'; + if (e.swap_status != SWAPOUT_NONE) os << 'w' << e.swap_status; + if (e.ping_status != PING_NONE) os << 'p' << e.ping_status; + os << '.'; + } + + // print only set flags, using unique letters + if (e.flags) { + if (EBIT_TEST(e.flags, ENTRY_SPECIAL)) os << 'S'; + if (EBIT_TEST(e.flags, ENTRY_REVALIDATE)) os << 'R'; + if (EBIT_TEST(e.flags, DELAY_SENDING)) os << 'T'; + if (EBIT_TEST(e.flags, RELEASE_REQUEST)) os << 'X'; + if (EBIT_TEST(e.flags, REFRESH_REQUEST)) os << 'F'; + if (EBIT_TEST(e.flags, ENTRY_CACHABLE)) os << 'C'; + if (EBIT_TEST(e.flags, ENTRY_DISPATCHED)) os << 'D'; + if (EBIT_TEST(e.flags, KEY_PRIVATE)) os << 'I'; + if (EBIT_TEST(e.flags, ENTRY_FWD_HDR_WAIT)) os << 'W'; + if (EBIT_TEST(e.flags, ENTRY_NEGCACHED)) os << 'N'; + if (EBIT_TEST(e.flags, ENTRY_VALIDATED)) os << 'V'; + if (EBIT_TEST(e.flags, ENTRY_BAD_LENGTH)) os << 'L'; + if (EBIT_TEST(e.flags, ENTRY_ABORTED)) os << 'A'; + os << '/'; + } + + return os << &e << '*' << e.lock_count; } /* NullStoreEntry */