[in progress] Instrumentation && more sync primitives && trace

please make sure you reverted these functions to the state they were before our changes, so that we don't have unwanted diffs here