[mythtv] Ticket #10414: HDHomeRun: Bad Recordings
Raymond Wagner
raymond at wagnerrp.com
Mon Mar 12 14:22:50 UTC 2012
On 3/12/2012 08:50, Daniel Kristjansson wrote:
> On Sun, 2012-03-11 at 15:29 -0500, David Engel wrote:
>
>> Daniel, I traced my high CPU usage to the following commit.
>>
>> Specifically, it is the following code in DTVRecorder::BufferedWrite().
>>
>> if (!timeOfFirstData.isValid()&& curRecording)
>> {
>> QMutexLocker locker(&statisticsLock);
>> timeOfFirstData = mythCurrentDateTime();
>> }
>>
>> uint64_t now = mythCurrentDateTime().toTime_t();
>> if (!timeOfLatestData.isValid() || (now - timeOfLatestData.toTime_t()>= 5))
>> {
>> QMutexLocker locker(&statisticsLock);
>> timeOfLatestData = mythCurrentDateTime();
>> }
> Makes sense, QDateTime can take up crazy amounts of CPU. I'll rework
> this so we only need to look up the time every five seconds or so.
If the expense is in QDateTime's internal conversions from one type to
the next, is there any reason to not just use time() directly? Looking
through recorderbase.cpp and recordingquality.cpp, I don't see anything
that has need for better than the second precision provided by time_t,
and QDateTime is just used for convenience with its toString() method.
More information about the mythtv-dev
mailing list