- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
Every time the tbb::tick_count::interval_t(double sec) constructor is called, the ticks_per_second() method gets called.
Inside the ticks_per_second() method, the QueryPerformanceFrequency() function gets called (on Windows targets).
All those calls are inefficient, as stated in https://www.threadingbuildingblocks.org/docs/help/reference/timing/tick_count_cls/tick_count_interval_t_cls.html
A simple way to handle his would be to modify the ticks_per_second() method like this, so that the QueryPerformanceFrequency() call is done only the first time :
static LARGE_INTEGER qpfreq;
int rval = (qpfreq.QuadPart == 0) ? QueryPerformanceFrequency(&qpfreq) : TRUE;
instead of :
LARGE_INTEGER qpfreq;
int rval = QueryPerformanceFrequency(&qpfreq);
This way, each time we call condition_variable.wait_for(interval_t(0.1)) for example, we don't get any penalty during interval_t construction.
Do you think it would be possible to integrate this tiny modification inside the TBB ?
I know it looks like a detail, but it would be useful I think.
Thanks a lot.
Best regards,
Vincent
Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page