Profile an iterator by monkey-patching its _read and read methods.
Only the given iterator is patched, never the iterators it reads from: those belong to whichever
operation produced them, and patching them from here both double-counts their time and disturbs
streams that are already flowing.
An iterator may be instrumented more than once, which happens when operations pass a stream
through unchanged. Every measurement then observes the same reads, instead of only the first
one collecting anything.
Profile an iterator by monkey-patching its
_readandreadmethods.Only the given iterator is patched, never the iterators it reads from: those belong to whichever operation produced them, and patching them from here both double-counts their time and disturbs streams that are already flowing.
An iterator may be instrumented more than once, which happens when operations pass a stream through unchanged. Every measurement then observes the same reads, instead of only the first one collecting anything.