[kde-freebsd] QFilesSystemWatcher instead of polling/FAM

Hannes list_kde-freebsd at soulrebel.in-berlin.de
Mon Jun 28 17:11:00 CEST 2010


Am Montag, 28. Juni 2010, 15:44:42 schrieb Kris Moore:
> On 06/25/2010 17:15, Tijl Coosemans wrote:
> > On Friday 25 June 2010 19:41:11 Kris Moore wrote:
> >> On 06/25/2010 12:37, Tijl Coosemans wrote:
> >>> KDE currently uses polling to detect file and directory changes
> >>> on FreeBSD, which can use up cpu time (and laptop battery
> >>> power). The kded4 process seems to make heavy use of this and
> >>> currently continuously consumes about 5% of my cpu and often
> >>> causes it to be throttled up by powerd.
> >>> 
> >>> I've attached a patch that makes KDE use QFileSystemWatcher on
> >>> FreeBSD which uses kqueue instead of stat. I've been using it for
> >>> the past few days and it seems to work rather well.
> >>> 
> >>> One thing I'm not sure about is whether it works with NFS, so it
> >>> could use some more testing. If you'd like to test it, replace
> >>> /usr/ports/x11/kdelibs4/files/patch-kio-kio-kdirwatch.cpp with
> >>> the attached patch and reinstall kdelibs.
> >> 
> >> Just built with this patch here. It does greatly improve my
> >> kdeinit4 processes, went from a constant 8-10% to 0-1%.
> >> 
> >> However, it does mess up NFS. When browsing my NFS mounts it
> >> doesn't show any directory/file changes until I manually refresh
> >> the view. Is this something fixable?
> > 
> > It can be fixed in Qt or in KDE. Both already provide polling as a
> > fallback and it would be easy to add some logic similar to what
> > devel/gamin does (call statfs(2) on the given path and use kqueue
> > when MNT_LOCAL is set, polling otherwise).
> > 
> > For now, you can also add the following to your ~/.kderc:
> > 
> > [DirWatch]
> > nfsPreferredMethod=Stat
> 
> Great, that seems to work. I was also able to add it to
> /usr/local/kde4/share/config/kdeglobals and it seems to take effect
> as well. This is such a reduction in CPU usage that this patch
> really should be enabled by default :)

Great :), will the dependency on gamin/fam now be dropped altogether? 

Regards,
Hannes


More information about the kde-freebsd mailing list