- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I detected an issue with 'tbb::tick_count' class. Please take a look at a test-case:
...
tbb::tick_count starttick;
tbb::tick_count endtick;
starttick = tbb::tick_count::now();
::Sleep( 5000 ); // 5000 ms = 5 seconds
endtick = tbb::tick_count::now();
_tprintf( _T("Task Delay: %ld secs\\n"), ( int )( endtick - starttick ).seconds() );
...
A delay is 5 seconds. However, '( endtick - starttick ).seconds()' returns 4 seconds. It is reproducible
with a test application compiled in Debug and Release configurations and TBBs v4 updates 3 and 1.
A generic description of the problem is as follows:
If a delay of N seconds is expected then '( endtick - starttick ).seconds()' always returns N-1 seconds.
My Development Environment:
OS : Windows XP 32-bit SP3
IDE: Visual Studio 2005 SP1
TBB: Version 4 Update 3
TBB: Version 4 Update 1
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would expect an opposite due to amultitaskingin Windows OS.So,a real interval could be more than 5000ms.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for these tips andI'll take a look tomorrow.
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[SOLVED]. A 'seconds()' method returns aresult as a double-precisionfloating-pointvalue ( type 'double' ).
A modified test-case:
...
tbb::tick_count starttick;
tbb::tick_count endtick;
starttick = tbb::tick_count::now();
::Sleep( 2000 );
endtick = tbb::tick_count::now();
_tpintf( _T("Task Delay: %f secs\n"), ( endtick - starttick ).seconds() );
_tpintf( _T("Task Delay: %1.f secs\n"), ( endtick - starttick ).seconds() );
...
outputs correct results:
...
Task Delay: 1.988046 secs
Task Delay: 2 secs // Rounded by '_tprintf' to 1 digit
...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page