Log database lock contention as well (as seperate pseudo-queries).

This also makes the 500ms logging threshold (over which is always
logged, and under which is sub-sampled) configurable via a
SystemProperty, which is mostly useful for interactive debugging when
lock contention is suspected, but could also be useful in the future
as a quick way to adjust this threshold for dogfooders, without code
changes.

Change-Id: I769069d8d870331d89a4aa3239ba50db806fe4d4
2 files changed