[Interest] Scalability of QTimer or QObject::startTimer

Bo Thorsen bo at fioniasoftware.dk
Fri Oct 26 12:45:20 CEST 2012


Den 26-10-2012 11:18, Prashant skrev:
>
> Hi.
> I intend to have quite a few QObject inherited classes each 
> implementing a couple of timers. The resolution of these timers is 
> expected to be around 1000ms. However, QTimer documentation states that
> "If Qt is unable to deliver the requested number of timer clicks, it 
> will silently discard some."
> I don't know how to interpret this statement. Does it mean that if a 
> timer has a very low resolution, some clicks are neglected. OR does it 
> mean that if a significant number of clicks from various timers 
> happens at around the same time, clicks will be discarded.
> In my application, it is not so important to have the click delivered 
> at the exact same time, it doesn't matter if clicks are off by x ms. 
> However, if no clicks are delivered there is a problem. I intend to 
> have around 2000 objects. However, I intend to scale it to around 
> 100,000 QTimers.

It means if the thread is busy for so long that the timer should have 
fired X times, it may fire anything from 1 to X times. But it will at 
least fire once.

One note: If you have that many timers, Qt will have to do some tricks 
for you. It would normally use hardware timers, but I don't know of any 
system that offer 100.000 timers.

You might be better off implementing some sort of distribution object if 
that's possible.

Bo Thorsen.

Come by my DevDays talk in Berlin - "Designing for testability". Learn how to build and run your unit tests with the Qt application.

Fionia Software - Qt experts for hire.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121026/bcc5235d/attachment.html>


More information about the Interest mailing list