On Dec 24, 2016 5:44 PM, "Tom Lane" <t...@sss.pgh.pa.us> wrote:
I think we'd need at least an order of magnitude cheaper to consider putting timing calls into spinlock or lwlock paths, and that's just not available at all, let alone portably. For spinlocks we could conceivably just bite the bullet and use a raw rdtsc or the equivalent for other platforms. It might be pretty easy to distinguish sane numbers from numbers that result after a process reschedule and we could just discard data when that happens (or count occurrences). That may possibly work for spinlocks but it won't work for anything heavier where process reschedules are routine.