[MERGE] Extend -Dhpss to emit a count of HPSS calls to stderr

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Oct 1 06:57:19 BST 2008

>>>>> "Andrew" == Andrew Bennetts <andrew at canonical.com> writes:

    Andrew> Andrew Bennetts wrote:
    >> This patch extends the -Dhpss option to dump a count of HPSS calls to
    >> stderr for each SmartClientMedium that was used.

    Andrew> This updates the patch based on feedback on the list and on IRC.

    Andrew> It's based on the alternative patch from my original mail.  The main changes
    Andrew> from my original submission:

    Andrew>   * only installs one hook function for the lifetime of the process

Key point.

    Andrew>   * uses trace.note rather than print to stderr
    Andrew>   * removes the unnecessary parentheses from the output
    Andrew>   * uses a WeakKeyDictionary to track the counts per medium
    Andrew>   * it still adds its own weakref so that the _DebugCounter can report the value
    Andrew>     in the WeakKeyDictionary before the WeakKeyDictionary destroys it.

    Andrew> I still use both weakref callbacks and an atexit
    Andrew> function as a last resort.  It feels cleaner to at
    Andrew> least try to remove things as soon as possible, and
    Andrew> the atexit fallback is pretty trivial, so I don't
    Andrew> feel the redundancy is a big issue.

Far cleaner overall and no more suspicious 'if' :)



More information about the bazaar mailing list