Re: gdmgreeter CPU usage



I have looked more closely at when FcFontSort is called by gdmgreeter
and found that my original analysis was incorrect.

The function FcFontSort is called by pango_fc_font_map_get_patterns when
a hash table lookup fails to find a match.

The first column the table below is the address of the PangoFontMap so
we can see that two PangoFontMaps are used.

At first glance 9), 10) and 11) should not be present as they seem to be
the same as 5), 2) and 3). However pango_font_description_get_weight()
returns different values (0x2bc instead of 0x190).

FontMap  PangoDescription         Size
=======  ================         ====
 80a01bo "Sans"                   12668
 80a3410 "Sans"                   13653
 80a3410 "Bitstream Vera Sans"    13652
 80a3410 "Sans"                   16384
 80a3410 "Bitstream Vera Sans"    16384
 80a3410 "Sans"                   12288
 80a3410 "Bitstream Vera Sans"    12288
 80a3410 "Sans"                   16384
 80a3410 "Bitstream Vera Sans"    16384
 80a3410 "Sans"                   13653
 80a3410 "Bitstream Vera Sans"    13652
 80a01b0 "Bitstream Vera Sans"    13652

There was a suggestion from Stephan Kulow to use FcFontMatch instead of
FcFontSort. Is this a change which could be made to
pango_fc_font_map_get_patterns?

It looks like it will reduce the CPU used by gdmgreeter by a third.

Padraig


On Wed, 2006-01-18 at 17:00 +0000, Padraig O'Briain wrote:
> I have got my Performance Analyzer from Sun Studio 11 working on
> gdmgreeter and I see that 50% of the CPU used by gdmgreeter is used by
> FcFontSort.
> 
> FcFontSort is called 12 times by gdmgreeter. Each time it is called the
> top of the function stack is the same:
> 
> libfontconfig.so.1.0.4`FcFontSort
> libpangoft2-1.0.so.0.1101.0`pango_fc_font_map_get_patterns+0x1f4
> libpangoft2-1.0.so.0.1101.0`pango_fc_font_map_load_fontset+0x39
> libpango-1.0.so.0.1101.0`pango_font_map_load_fontset+0x3c
> 
> I see that pango_font_map_load_font is called about 200 times; 12 of
> these calls are for description "Bitstream Vera Sans" and the rest are
> for "Sans". The cost of the calls for "Sans" are negligible excapt for
> the first one.
> 
> The calls for "Bitstream Vera Sans" are the calls which call FcFontSort
> and cost about 30 ms each.
> 
> I have not yet figured out how to determine whether the values returned
> are the same.
> 
> Padraig
> 
> 
> 
> On Wed, 2006-01-11 at 12:44 -0600, Federico Mena Quintero wrote:
> > On Wed, 2006-01-11 at 09:05 +0000, Padraig O'Briain wrote:
> > > FcFontSort is called 12 times during gdmgreeter startup, with a total
> > > cost of 205 ms of CPU.
> > > 
> > > As this occurs during the boot phase I suspect that the elapsed time is
> > > even longer.
> > > 
> > > I have bootchart that show that gdmgreeter takes about 5 seconds to
> > > startup when booting. About 860 ms of that is CPU time.
> > 
> > Ah.  Now we are getting somewhere :)
> > 
> > I haven't looked at the dtrace log you posted - I assume it has a
> > breakdown of the user time for various parts of gdm?
> > 
> > Even though FcFontSort is only 4% of gdm's startup time, it will affect
> > all GNOME apps at startup, since each of them has to invoke it several
> > times.
> > 
> > - Do we really need to call it 12 times?  Just how many different font
> > descriptions does gdm use?
> > 
> > - Given the same parameters, does the function always return the same
> > value?  I don't want to put in a cache prematurely, but this would be
> > useful to know.
> > 
> > - Can we get a little program that runs FcFontSort in a loop so that we
> > can profile it?
> > 
> >   Federico
> > 
> > _______________________________________________
> > Performance-list mailing list
> > Performance-list gnome org
> > http://mail.gnome.org/mailman/listinfo/performance-list
> 
> _______________________________________________
> Performance-list mailing list
> Performance-list gnome org
> http://mail.gnome.org/mailman/listinfo/performance-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]