StartStopTimer returning incorrect value (Bug #1165)


Added by Bob Naugle over 13 years ago. Updated about 12 years ago.


Status:Done Start date:
Priority:Low Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:2.4.3
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

Environment details: Linux x86, gcc version 4.4.3, OpenCV 2.2.0

http://linux.die.net/man/3/clock

"Note that the time can wrap around. On a 32bit system where CLOCKS_PER_SEC equals 1000000 this function will return the same value approximately every 72 minutes."

This means, I believe, that after a process has used enough processor time, there is a possibility that subsequent calls to clock() and comparison of their return values does not give a proper indication of elapsed processor time.

In openCVroot/modules/flann/include/opencv2/timer.h::StartStopTimer clock() is used for this purpose, and in this case the difference between processor times is cast to a double. This can result in a negative value, and leads to a misbehaving while loop in openCVroot/modules/flann/include/opencv2/index_testing.h::search_with_ground_truth


Associated revisions

Revision d72cc06b
Added by Vadim Pisarevsky over 12 years ago

fixed possibly inccorrect interval measurements in flann's timer (bug #1165). Note: this may break binary compatibility, but since the class is not wrapped in Java and not exposed in Windows API, for example (it's considered internal-use class for flann), the effect should be minimal

Revision 38a0b47b
Added by Roman Donchenko over 11 years ago

Merge pull request #1165 from vpisarev:24_ipp

History

Updated by Bob Naugle over 13 years ago

Apologies, this can be difficult to reproduce. My hope is that careful inspection of the use of clock() here can lead to an understanding of the validity (or perhaps invalidity) of this bug, and to a resulting fix either through better timer value checks, or a different method of calculating timer value.

Updated by Alexander Shishkov about 13 years ago

  • Description changed from Environment details: Linux x86, gcc version 4.4.3, [[OpenCV]] 2.2.0 http://l... to Environment details: Linux x86, gcc version 4.4.3, OpenCV 2.2.0 http://linux... More

Updated by Alexander Shishkov almost 13 years ago

  • Target version deleted ()

Updated by Alexander Shishkov almost 13 years ago

  • Assignee deleted (Marius Muja)

Updated by Alexander Shishkov almost 13 years ago

  • Target version deleted ()

Updated by Kirill Kornyakov almost 13 years ago

  • Assignee set to Marius Muja

Updated by Vadim Pisarevsky over 12 years ago

  • Target version deleted ()
  • Category changed from flann to core
  • Assignee deleted (Marius Muja)

Updated by Vadim Pisarevsky over 12 years ago

fixed in d72cc06

  • Status changed from Open to Done
  • Assignee set to Vadim Pisarevsky

Updated by Andrey Kamaev about 12 years ago

  • Target version set to 2.4.3

Also available in: Atom PDF