Bug 61317 - Gideon burns a lot of cpu cycles
Summary: Gideon burns a lot of cpu cycles
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: Java (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-16 17:40 UTC by Giampaolo Gallo
Modified: 2003-09-05 15:26 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Giampaolo Gallo 2003-07-16 17:40:32 UTC
Version:           cvs 20030716 (using KDE KDE 3.1.2)
Installed from:    Compiled From Sources
Compiler:          gcc 3.3 
OS:          Linux

This early morning I recompiled gideon from cvs sources (16/07/2003). It's quite stable now. Now gideon is able to handle a java project without crashing too much (till yesterday It crashed very often).Good work!. However as yesterday it burns out a lot of cpu cycles. My machine is always heavily loaded. There is a gideon process that eats up till 93% of cpu resources.I tried to profile it with valgrind but it was impossible.

Thanks & regards,
Giampaolo Gallo
Comment 1 Harald Fernengel 2003-07-16 17:48:04 UTC
Run it in gdb and press CTRL-C from time to time to find out which function uses that much 
CPU. 
Comment 2 Giampaolo Gallo 2003-07-16 19:46:44 UTC
I haven't compiled a debug version of gideon. What I get from this operations is 
always the following: 
 
Program received signal SIGINT, Interrupt. 
0x41709e01 in __select () at __select:-1 
-1      in __select 
(gdb) backtrace 
#0  0x41709e01 in __select () at __select:-1 
#1  0x413af27c in typeinfo for QMotifStyle () from /usr/local/qt/lib/libqt-mt.so.3 
#2  0x40f69556 in QEventLoop::enterLoop() () from /usr/local/qt/lib/libqt-mt.so.3 
#3  0x40f693f8 in QEventLoop::exec() () from /usr/local/qt/lib/libqt-mt.so.3 
#4  0x40f55921 in QApplication::exec() () from /usr/local/qt/lib/libqt-mt.so.3 
#5  0x0806e83b in main () 
#6  0x41647bf6 in __libc_start_main (main=0x806dd70 <main>, argc=1, 
ubp_av=0x0, 
    init=0x80b2f40 <__libc_csu_init>, fini=0x80b2f70 <__libc_csu_fini>, 
rtld_fini=0x819cd90, 
    stack_end=0x819d0a4) at ../sysdeps/generic/libc-start.c:152 
 
Another problem which I found was the lockup on exit. I don't know if I am right in 
reporting this here of if it is better to open another bug. However gideon blocks until 
killed on exit (if a project is open). this is the backtrace I obtain from GDB 
 
 Program received signal SIGINT, Interrupt. 
0x4165ba6a in *__GI___sigsuspend (set=0xbfffe180) at 
../sysdeps/unix/sysv/linux/sigsuspend.c:76 
76      in ../sysdeps/unix/sysv/linux/sigsuspend.c 
(gdb) backtrace 
#0  0x4165ba6a in *__GI___sigsuspend (set=0xbfffe180) at 
../sysdeps/unix/sysv/linux/sigsuspend.c:76 
#1  0x414f0248 in __pthread_wait_for_restart_signal (self=0x414f50a0) at 
pthread.c:1141 
#2  0x414ecd0b in __pthread_cond_wait (cond=0x0, mutex=0x91bff9c) at 
restart.h:34 
#3  0x41201e8f in QWaitCondition::wait(QMutex*, unsigned long) () from 
/usr/local/qt/lib/libqt-mt.so.3 
#4  0x40f4b176 in QThread::wait(unsigned long) () from /usr/local/qt/lib/libqt-mt.so.3 
#5  0x41f37034 in JavaSupportPart::~JavaSupportPart() () from 
/usr/kde3/lib/kde3/libkdevjavasupport.so 
#6  0x08080dd8 in ProjectManager::unloadLanguageSupport() () 
#7  0x0807f519 in ProjectManager::closeProject() () 
#8  0x0807652e in Core::queryClose() () 
#9  0x0808907e in MainWindowIDEAl::queryClose() () 
#10 0x40a0aa13 in KMainWindow::closeEvent(QCloseEvent*) () from 
/usr/kde3/lib/libkdeui.so.4 
#11 0x40fe7941 in QWidget::event(QEvent*) () from /usr/local/qt/lib/libqt-mt.so.3 
#12 0x4108ed82 in QMainWindow::event(QEvent*) () from 
/usr/local/qt/lib/libqt-mt.so.3 
#13 0x40f556f4 in QApplication::internalNotify(QObject*, QEvent*) () from 
/usr/local/qt/lib/libqt-mt.so.3 
#14 0x40f54ebb in QApplication::notify(QObject*, QEvent*) () from 
/usr/local/qt/lib/libqt-mt.so.3 
#15 0x40b96e49 in KApplication::notify(QObject*, QEvent*) () from 
/usr/kde3/lib/libkdecore.so.4 
#16 0x40fe7393 in QWidget::close(bool) () from /usr/local/qt/lib/libqt-mt.so.3 
#17 0x412957c6 in QWidget::qt_invoke(int, QUObject*) () from 
/usr/local/qt/lib/libqt-mt.so.3 
#18 0x412a4964 in QMainWindow::qt_invoke(int, QUObject*) () from 
/usr/local/qt/lib/libqt-mt.so.3 
#19 0x40a0d743 in KMainWindow::qt_invoke(int, QUObject*) () from 
/usr/kde3/lib/libkdeui.so.4 
#20 0x405c9f14 in KParts::MainWindow::qt_invoke(int, QUObject*) () from 
/usr/kde3/lib/libkparts.so.2 
#21 0x0808beb8 in MainWindowIDEAl::qt_invoke(int, QUObject*) () 
#22 0x40fb35e9 in QObject::activate_signal(QConnectionList*, QUObject*) () 
   from /usr/local/qt/lib/libqt-mt.so.3 
#23 0x40fb348d in QObject::activate_signal(int) () from /usr/local/qt/lib/libqt-mt.so.3 
#24 0x409b9dcb in KAction::activated() () from /usr/kde3/lib/libkdeui.so.4 
#25 0x409a833f in KAction::slotActivated() () from /usr/kde3/lib/libkdeui.so.4 
#26 0x409b9fd1 in KAction::qt_invoke(int, QUObject*) () from 
/usr/kde3/lib/libkdeui.so.4 
#27 0x40fb35e9 in QObject::activate_signal(QConnectionList*, QUObject*) () 
---Type <return> to continue, or q <return> to quit--- 
   from /usr/local/qt/lib/libqt-mt.so.3 
#28 0x41291982 in QSignal::signal(QVariant const&) () from 
/usr/local/qt/lib/libqt-mt.so.3 
#29 0x40fcd868 in QSignal::activate() () from /usr/local/qt/lib/libqt-mt.so.3 
#30 0x410a0dad in QPopupMenu::mouseReleaseEvent(QMouseEvent*) () from 
/usr/local/qt/lib/libqt-mt.so.3 
#31 0x40fe77ac in QWidget::event(QEvent*) () from /usr/local/qt/lib/libqt-mt.so.3 
#32 0x40f556f4 in QApplication::internalNotify(QObject*, QEvent*) () from 
/usr/local/qt/lib/libqt-mt.so.3 
#33 0x40f54f23 in QApplication::notify(QObject*, QEvent*) () from 
/usr/local/qt/lib/libqt-mt.so.3 
#34 0x40b96e49 in KApplication::notify(QObject*, QEvent*) () from 
/usr/kde3/lib/libkdecore.so.4 
#35 0x40efb326 in QETWidget::translateMouseEvent(_XEvent const*) () from 
/usr/local/qt/lib/libqt-mt.so.3 
#36 0x40ef90bb in QApplication::x11ProcessEvent(_XEvent*) () from 
/usr/local/qt/lib/libqt-mt.so.3 
#37 0x40f0e0e1 in QEventLoop::processEvents(unsigned) () from 
/usr/local/qt/lib/libqt-mt.so.3 
#38 0x40f69556 in QEventLoop::enterLoop() () from /usr/local/qt/lib/libqt-mt.so.3 
#39 0x40f693f8 in QEventLoop::exec() () from /usr/local/qt/lib/libqt-mt.so.3 
#40 0x40f55921 in QApplication::exec() () from /usr/local/qt/lib/libqt-mt.so.3 
#41 0x0806e83b in main () 
 
 
Comment 3 Giampaolo Gallo 2003-07-17 18:15:40 UTC
This backtrace, obtained attaching gdb to the "cpu eating" process, may be is more meaningful: 
 
Program received signal SIGINT, Interrupt. 
0x410fe637 in QMapPrivateBase::removeAndRebalance(QMapNodeBase*, QMapNodeBase*&, 
QMapNodeBase*&, QMapNodeBase*&) () from /usr/local/qt/lib/libqt-mt.so.3 
(gdb) backtrace 
#0  0x410fe637 in QMapPrivateBase::removeAndRebalance(QMapNodeBase*, 
QMapNodeBase*&, QMapNodeBase*&, QMapNodeBase*&) () from /usr/local/qt/lib/libqt-mt.so.3 
#1  0x41e80cb4 in Driver::takeTranslationUnit(QString const&) () 
   from /usr/kde3/lib/kde3/libkdevjavasupport.so 
#2  0x41dc502a in BackgroundParser::parseFile(QString const&) () 
   from /usr/kde3/lib/kde3/libkdevjavasupport.so 
#3  0x41dc55e2 in BackgroundParser::run() () 
   from /usr/kde3/lib/kde3/libkdevjavasupport.so 
#4  0x40e25578 in QProc::~QProc() () from /usr/local/qt/lib/libqt-mt.so.3 
#5  0x413c8d70 in pthread_start_thread (arg=0x892d870) at manager.c:301 
(gdb) cont 
Continuing. 
 
Comment 4 Amilcar do Carmo Lucas 2003-07-18 15:43:21 UTC
Seams to be a java support problem 
Comment 5 Giampaolo Gallo 2003-07-22 21:11:36 UTC
It seems to me that in the java parser spends a lot of cpu cycles trying to parse 
non-java source files. I noticed that if I try to edit a non java file, while a java project is 
open, gideon starts to eat cpu cycles. I reproduced the problem in this way.  
 
- Open a java project. 
- Open a non java source (I tried with an xml one) 
- Open a java source 
 
I think the cause is elsewhere, however to avoid the problem I did an ugly hack 
adding a  couple of lines to the file parts/javasupport/problemreporter.cpp 
in the method ProblemReporter::reparse() (see below). 
 
Hope this helps in some way. 
 
Thanks, 
  
 
--- kdevelop/parts/javasupport/problemreporter.cpp      2003-05-26 
15:38:56.000000000 +0200 
+++ kdevelop-20030722/parts/javasupport/problemreporter.cpp     2003-07-22 
19:52:50.000000000 +0200 
@@ -167,12 +167,14 @@ 
     if( !m_javaSupport->isValid() ) 
        return; 
 
+    if (strstr(m_filename,".java") == NULL) 
+        return; 
 
     m_timer->stop(); 
 
     kdDebug(9007) << "ProblemReporter::reparse()" << endl; 
     m_javaSupport->backgroundParser()->addFile( m_filename ); 
-    kdDebug(9007) << "---> file added" << endl; 
+    kdDebug(9007) << "---> file added " << m_filename << endl; 
 } 
 
 
 
Comment 6 Amilcar do Carmo Lucas 2003-09-05 13:45:08 UTC
Roberto, the ball is on your side now. 
Comment 7 Amilcar do Carmo Lucas 2003-09-05 15:26:10 UTC
Subject: kdevelop/parts/javasupport

CVS commit by aclu: 

Java parser spends a lot of cpu cycles trying to parse non-java source files. I noticed that if I try to edit a non java file, while a java project is open, gideon starts to eat cpu cycles.
This is a ugly hack to solve it.

Patch by: ( gp AT iws.it)
CCMAIL: roberto@kdevelop.org
CCMAIL: 61317-done@bugs.kde.org


  M +6 -1      problemreporter.cpp   1.13


--- kdevelop/parts/javasupport/problemreporter.cpp  #1.12:1.13
@@ -181,9 +181,14 @@ void ProblemReporter::reparse()
         return;
 
+    // @todo: use the project database to decide which files to parse instead of this!
+    // ugly hack: do not parse non .java ending files
+    if ( !m_fileName.endsWith(".java") )
+        return;
+
     m_timer->stop();
 
     kdDebug(9013) << "ProblemReporter::reparse()" << endl;
     m_javaSupport->backgroundParser()->addFile( m_fileName );
-    kdDebug(9013) << "---> file added" << endl;
+    kdDebug(9013) << "---> file added " << m_fileName << endl;
 }