[OpenMP][NFC] Encapsulate profiling logic (#74003)

This simply puts the profiling logic into the `Profiler` class and
allows non-RAII profiling via `beginSection` and `endSection`.

GitOrigin-RevId: b8b2a279d002f4d424d9b089bc32a0e5d6989dbb
3 files changed