I have an assignment to plot the running time of a quicksort algorithm(implemented myself) with both versions i.e randomised and deterministic(picking last element as pivot).
Now I have very large lists of integers and also relatively short ones [range : (500 - 10^6) ]. Now as the worst case complexity of Quicksort is O(n^2)
I assume the code could take more than 30 mins to execute and I want to measure the CPU time taken by the process as is expected from std::clock however I am on a Windows system and std::clock
returns the same time as the Wall clock. This is an issue as I want precise time that the process takes to execute and isn't affected by other processes on my computer.
So far I have searched on some questions on this website and codereview ; nothing seems to be doing what I want.
I also have Ubuntu installed on WSL2 on my system, so if there is way to do the same there, that'd help me too.
So my question is : How do I find exact time taken by the process on the CPU for my sorting algorithms?
(PS: This website seems to suggest that the std::clock
may wrap after 36mins(approx.) so if there is a way to note time in case the process takes more than that time would be helpful too.)