oneapi-src / oneapi-src/oneAPI-samples
The Execution Time Difference Between Event_Profiling and Steady Clock
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.2k
- Forks
- 745
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to profile my code and I am getting different results each time I run the code.
auto start = std::chrono::steady_clock::now();
foo()
auto end = std::chrono::steady_clock::now();
time = std::chrono::duration_cast<std::chrono::nanoseconds>(end - start).count();
why is this giving me different results than using
start_kernel_time = event.get_profiling_info<info::event_profiling::command_start>();
end_kernel_time = event.get_profiling_info<info::event_profiling::command_end>();
time_kernel = (end_kernel_time - start_kernel_time) / kNs; // kNs = 1e9
I run the code several times and interesting thing is steady_clock version first printed out 6.7 seconds and then in the second run printed out 0.07 seconds ( unrealistic) then the event profiling was printed the ~0.64 seconds which made more sense. Why it is different ?
I am using oneapi 2023 with icpx compiler
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file, test, or sample entry point is named. Start by reproducing the two timing snippets with the stated oneAPI 2023 and icpx setup, then compare the host steady-clock interval with event_profiling command_start and command_end; done means documenting the cause of the discrepancy and a reliable way to measure the execution time.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100