[mythtv] INFO: EIT table handling and mythbackend performance.

jd mythdev at penyball.cix.co.uk
Thu Dec 8 11:57:00 EST 2005

(Just for information, not a bug - apologies if this was common 

"Be careful with QString.replace() - especially where a long string is 

I'd noticed that testing LiveTV one of the mythbackend threads had wildly 
varying cpu activity (as reported by top) and often showed more cpu usage 
than all other frontend and backend threads. 

Being curious I attached to this and found it was the siparser thread - 
spending most of its time in EITFixUpStyle2. (I'm in the UK on network 

Note that I'm using a non standard filter/mask of 0x7F,0x80 against pid 
0x12 to get all the EIT packets - this grossly exaggerates the usage 
figures below relative to the current svn but I think it exposes an 
underlying gotcha which is why I'm posting this note.

The current svn only picks up 0x50 pids which on my transmitter is about 
1/10 of the total EIT packets -. (My local transmitter is using 
50,51/60,61 for 7 day epg and 4E/4F for current/next details) 

I put some probes into SIParser and the following typical profile results 
are for your entertainment:

Over a 4.5 minute interval:

ParseTable was called 26575 times representing ~50% of the thread cpu.
ParseDVBEIT     20634/50.4%
EITFixUpStyle2  10900/47.2%  (i'd expect svn users to see 10% of this)
ParseNIT           28/0.009%
ParsePMT         2804/0.008%
ParsePAT         2805/0.003%
ParseSDT          304/0.002%

Looking closer at EITFixUpStyle2
22% of the thread cpu was associated with the single line:
    event.Description = event.Description.replace(rx,"");

where the regex had been setup with:
   QRegExp rx("\\s*(Then|Followed by) 60 Seconds\\.");

11% was associated with the next (identical) replace where the regex had 
been setup with:
    rx.setPattern("\\s*(Brand New|New) Series\\s*[:\\.\\-]");
10% was associated with the 'series' code
9% was associated with the 'episodes' code
4% was associated with the 'year' code

I've no experience with qt regex, so googling I found this
which makes a comment about: "the naive implementation of 

- Like I said its not a bug, I just commented out the first two replace 
statements so I could get the quicker EIT updtes - I'll put up with that 
text in the guide :)

share and enjoy?

More information about the mythtv-dev mailing list