Hello,

I noticed by chance that Kopete (using KDE 3.5.6) was using several %
of CPU time, despite
there being no chat windows open and no accounts running.

I traced the Kopete process using strace and it seems that Kopete is
waking up almost continuously, though it ought to be idle (or at
least, with minimal, infrequent activity).

A little more investigative debugging with GDB and it seems that
Kopete is waking up every 30 milliseconds as the timer used to handle
smooth scrolling in the contact list view is fired.  That timer is
started in Kopete::UI::ListView::ListView::setSmoothScrolling() and
never subsequently disabled.  Relevant code is
libkopete/ui/kopetelistview.cpp lines 324-338.

To find out what object the timers belonged to I put a breakpoint on
QEventLoop::activateTimers.  When the breakpoint is reached, there is
a timerList variable available which is a list of pointers to
TimerInfo instances which contain information about the timers to be
fired.  Each TimerInfo instance has an 'obj' variable which is a
pointer to the QObject that owns the timer.  So to get the class name
of the object which owns the timer I ran the following when the
breakpoint was hit:

print timerList->first()->obj->metaObject()->className()

To demonstrate, start Kopete, disconnect from all accounts and close
any chat windows,
get the process id of the kopete process, and attach to it using
"strace -p <kopete process id>".  You can see that gettimeofday is
being called continuously.  Comment out the calls to startTimer() in
the setSmoothScrolling() method mentioned above and re-run Kopete and
trace again with strace.  Kopete now wakes up far less frequently.

A possible solution would be to enable the timer only whilst scrolling
is in progress if possible and then disable at as soon as the list
stops scrolling, although I am not very familiar with this code -
better ideas welcomed.

Regards,
Robert.
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to