[MOD-10622] Change time measurement method in FT.PROFILE#6574
[MOD-10622] Change time measurement method in FT.PROFILE#6574
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6574 +/- ##
==========================================
- Coverage 87.57% 87.51% -0.06%
==========================================
Files 278 281 +3
Lines 44606 44664 +58
Branches 7571 7615 +44
==========================================
+ Hits 39064 39088 +24
- Misses 5430 5458 +28
- Partials 112 118 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
raz-mon
left a comment
There was a problem hiding this comment.
Nicely done
Some non-critical nitpicks
| static inline void rs_wall_clock_init(rs_wall_clock *clk) { | ||
| clock_gettime(CLOCK_MONOTONIC, clk); | ||
| } |
There was a problem hiding this comment.
Consider removing this function
| return (rs_wall_clock_ns_t)now.tv_sec * NANOSEC_PER_SECOND + now.tv_nsec; | ||
| } | ||
|
|
||
| static inline double rs_wall_clock_convert_ns_to_ms_f(rs_wall_clock_ns_t ns) { |
There was a problem hiding this comment.
f = float?
If so change to rs_wall_clock_convert_ns_to_ms_d?
I would add some more documentation to this file in general
| return ns / MILLISEC_PER_SECOND; | ||
| } | ||
|
|
||
| // Undefine macros to avoid conflicts |
There was a problem hiding this comment.
Do we have any conflicts?
I don't see an issue with keeping them defined
There was a problem hiding this comment.
I agree with Guy on this,
I see no other use for it besides in this file (I don't want conversion to be done "manually")
Maybe if we see a use for this in the broader refactor to use rs_wall_clock
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 2.8
git worktree add -d .worktree/backport-6574-to-2.8 origin/2.8
cd .worktree/backport-6574-to-2.8
git switch --create backport-6574-to-2.8
git cherry-pick -x f8b4bfff6666a358be2792eb45c304c317a0ac20 |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 2.6
git worktree add -d .worktree/backport-6574-to-2.6 origin/2.6
cd .worktree/backport-6574-to-2.6
git switch --create backport-6574-to-2.6
git cherry-pick -x f8b4bfff6666a358be2792eb45c304c317a0ac20 |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 2.10
git worktree add -d .worktree/backport-6574-to-2.10 origin/2.10
cd .worktree/backport-6574-to-2.10
git switch --create backport-6574-to-2.10
git cherry-pick -x f8b4bfff6666a358be2792eb45c304c317a0ac20 |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 8.2
git worktree add -d .worktree/backport-6574-to-8.2 origin/8.2
cd .worktree/backport-6574-to-8.2
git switch --create backport-6574-to-8.2
git cherry-pick -x f8b4bfff6666a358be2792eb45c304c317a0ac20 |
* introduce profile_clock * add now function to profile_clock * remove const keyword * Many changes * Revert "Many changes" This reverts commit e92f8c6. * fix rp next timing * change AREQ initClock to new profile_clock, this includes changing global stats field * change searchRequestCtx initClock to profile_clock type * Revert "change searchRequestCtx initClock to profile_clock type" This reverts commit 0495c8b. * revert TotalGlobalStats_CountQuery to use clock_t instead of profile_clock_ns, but convert profile_clock to clock_t * total_query_execution_time * fix AREQ profileTotalTime * fix AREQ profileParseTime * fix AREQ profilePipelineBuildTime * rename profile_clock to rs_wall_clock * change total index time to rs_wall_clock * Change searchRequestCtx profileClock to rs_wall_clock, change PrintCoordProfile_ctx fields to rs_wall_clock * rename time unit convert macro * change ProfileIterator, ProfileIteratorCtx to use wall clock * change QueryIterator, QueryProcessingCtx initTime to rs_wall_clock * Change QueryIterator, QueryProcessingCtx GILTime to rs_wall_clock * Use idiomatic rs_wall_clock in Print total GIL time * Change rpSafeLoaderNext_Accumulate rpStartTime to rs_wall_clock * use ns to ms convert function * rs_wall_clock aligments * complete merge with master * delete index.c * use rs_wall_clock in cursor.c * Revert "use rs_wall_clock in cursor.c" This reverts commit c70f82c. * change req init time to use rs_wall_clock instead of clock * create 2 different conversion functions * fix rs_wall_clock_diff_ns * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix wrong diff and optimize elapsed * fix comments * move convert to outside of CountQuery function * fix time aggreagation * fix: add extern "C" block for C++ compatibility * undefine macros * fix: correct GILTime accumulation in buildPipelineAndExecute function * fix: reorder rs_wall_clock functions for clarity and maintainability * fix: update profileParseTime calculation to use rs_wall_clock_diff_ns, saving clock call * fix macro name * spellcheck * fix: rename profileInitClock to initClock for consistency across aggregate profiling * comments alignment * Asser end > start * change rs_wall_clock to typedef timespec * change convert to ms function name, better documentation --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This PR introduces a new time measurement abstraction:
rs_wall_clock.It provides high-precision, wall-clock time using c
lock_gettime(CLOCK_MONOTONIC), in nanoseconds, with helper conversions to milliseconds. Unlikeclock(), which measures CPU time and is unreliable in multi-threaded or asynchronous environments,rs_wall_clockoffers consistent and accurate wall time measurement. The goal is to fully deprecate and removeclock()usage across the codebase.The
rs_wall_clockutility includes:rs_wall_clockrs_wall_clock_ns_t,rs_wall_clock_ms_trs_wall_clock_init(),rs_wall_clock_elapsed_ns(),rs_wall_clock_now_ns(), andrs_wall_clock_convert_ns_to_ms().As a first step, rs_wall_clock has been integrated into
FT.PROFILEtime measurement.Avoiding touching timeout handling and other time-sensitive logic, to minimize risk of unintended behavioral changes.
Next Steps
msgranulity is enough (stackoverflow thread)