I need to add some artificial latency to my code without using std::this_thread::sleep_for()
to test some hardware. In fact, I need a function like:
addLatency(10m) // Do dummy computation for 10 milli second
I know that one possible solution is by doing a dummy calculation like:
long int j=0;
for (long int = 0; i < MAX_SIZE < i++)
j++;
But, Is there any easier or logical way to do this? I searched a lot and could find out a lot of solutions to improve performance, but I could not find anything how to make the performance worst.