PDA

View Full Version : [QTime] Create Thread time Mesure



loic072
1st February 2017, 06:59
Hi,

I would like mesure with QTime the time between the creation and using thread

In fact, I don't know how retrieve Qtime object in thread? Should it be passed as a thread parameter ?

Or else there is another way without using QTime?

Thank you

regards
Loïc

anda_skoa
1st February 2017, 09:18
What does "using thread" mean?

When it starts executing its run() method?

Cheers,
_

jefftee
1st February 2017, 23:51
Do you really care how long it takes to start a thread? I would suggest that if your design is such that you are creating/terminating threads often enough that you are concerned with the overhead of doing so, then you should re-think your design... For example, start your thread and then feed it work via emitting a signal, or serializing a data structure like a QVector/QList/QMap, etc. that contains elements from the thread to work on.

Alternatives: use a thread pool or Qt's map/reduce type functionality.

Can you explain why this timing is critical for your needs?