Author Topic: High CPU usage  (Read 27789 times)

phear

  • Guest
High CPU usage
« on: June 16, 2005, 07:16:47 pm »
Codeblocks has an idle cpu usage of 10-12%, which seems way to high.

My specs are:

Windows XP SP2 Pro, fairly well tweaked.
Pentium M 1,8GHz
1024MB RAM

Am I the only one (or selected few) who suffers from this? And what may cause this?

Offline Profic

  • Multiple posting newcomer
  • *
  • Posts: 56
High CPU usage
« Reply #1 on: June 16, 2005, 07:28:58 pm »
WinXP SP2 Pro, tweaked too
Pentium-4 2.8/256MB RAM
and c::b (with one project within ~100 files loaded) in idle state consume nothing
I have system idle cpu utilisation ~1.5%, and most of it is system monitoring software (~1.25%) and other player (~0.25%)
Not fear, nor tears can reach me now, the light seems so clear as the night fades away (c) Tristania - Beyond The Veil

Anonymous

  • Guest
High CPU usage
« Reply #2 on: June 16, 2005, 07:32:15 pm »
it sounds like it could be the codecompletion plugin playing tricks on you - have you tried disabling it?

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
High CPU usage
« Reply #3 on: June 16, 2005, 07:34:22 pm »
Try enabling the cache on codecompletion. The parser keeps running on the background until all files are read.

phear

  • Guest
High CPU usage
« Reply #4 on: June 16, 2005, 08:52:34 pm »
It actually didn't seem like codecompletion was much to blame. After some trial and error, I've found that the compiler plugin uses about half, and it seems the GDB plugin alongside the compiler plugin stands for some.

The CPU usage oscillates quite a bit more, but I will give it some time, and see if it stabilizes.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
High CPU usage
« Reply #5 on: June 16, 2005, 09:17:46 pm »
you're constantly debugging and setpping into your app, right?

Anonymous

  • Guest
High CPU usage
« Reply #6 on: June 16, 2005, 09:30:44 pm »
no... not debugging at all.

Anonymous

  • Guest
High CPU usage
« Reply #7 on: June 16, 2005, 09:43:00 pm »
ok, I've done some more testing, this time altering code, compiling and debugging, and then letting it idle for 5-10 minutes. The results are as follows:

no plugins: 0-1%
compiler + gdb: 3-5%
compiler + gdb + code completion w/caching: 3-6%
compiler + gdb + code completion wo/caching: 4-8%
all plugins: 7-10%

I've also found that simply moving the mouse over codeblocks, raises cpu usage to 20-70% depending on mouse speed. This is regardless of whether codeblocks has focus or not.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
High CPU usage
« Reply #8 on: June 16, 2005, 10:59:26 pm »
hmmmmmmm interesting. Hadn't noticed. I guess this is part of the events management (wxWidgets).

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
High CPU usage
« Reply #9 on: June 17, 2005, 05:33:57 pm »
Hmm... cannot confirm that observation.

System: Athlon64 3400 / 1G / WinXP SP2 /c::b 1.0finalbeta

2 Projects loaded, 6 files open, all plugins loaded, no Debugger, idle:
Total CPU 2%,
taskmgr.exe 1%    <--- that's where my cpu goes :)
svchost.exe 1%     <---
codeblocks.exe  0%

same, but moving Mouse up and down over project manager:
codeblocks.exe 18%   (quite clear why that has to be)

frenzily moving Mouse over editor window:
codeblocks.exe 24%   (quite clear, too)

compiling project:
cc1.exe 99%  (well, duh :-)  )

debugging app that is blocking in a syscall (getchar):
codeblocks.exe 0%
app.exe 0%

debugging app that runs in a tight infinite loop with a watch:
codeblocks.exe 5%
app.exe 95%

This looks quite normal to me, does it not?

EDIT:
Forgot about the "moving mouse thing":
Moving the mouse fires a lot of events and requires calculations like "do tooltips have to be popped up?" and "do I need to change a button's outline?" or "is some plugin maybe involved?", so quite clearly this takes cpu.
I can get Windows Explorer to use 3-4% cpu by moving the mouse, too, and Explorer does quite a lot less than an IDE.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Anonymous

  • Guest
High CPU usage
« Reply #10 on: June 18, 2005, 01:11:01 pm »
Seems like I've got it pretty bad then. I can't explain it, so it looks like it might be a dealbraker for me (being on a laptop, it's pretty annoying when the fan is constantly  on and revving up and down).

As far as the mousemoving thing goes, there should be no checking for tooltips (or anything else for that matter), as tooltips display on delay, so it's just setting a delay, which certainly shouldn't use 70%. I can't even get a tooltip at all in the editor actually. There's nothing else mousemove related there either. The only thing that appears to happen when moving the mouse is hittesting, which should be pretty non-exhaustive, unless there are some future features having a lot of logic implemented there.

As far as wxWidgets go, I have a hard time believing a library in so wide-use has this issue. It might be however, that the API is prone to be used in such a way.

Anonymous

  • Guest
High CPU usage
« Reply #11 on: June 23, 2005, 02:11:20 pm »
Quote from: Anonymous
As far as wxWidgets go, I have a hard time believing a library in so wide-use has this issue. It might be however, that the API is prone to be used in such a way.

Hmm... sadly, wxWidgets has quite a few issues. I am struggling with some of them at the present time. And yes, a few things are quite inefficient.

But despite the many reasons to hate wxWidgets, it has one advantage, which cannot be denied... It may never work perfectly, but it kind of works somehow, and it does so on several Platforms without requiring you to change a line of code (well, almost).

And you have to account for the fact that code::blocks as a beta version is still an awful lot
- faster (about 2-3 times in some things?)
- more stable (c::b crashes total: 0  / dev-cpp crashes per day: 4-6)
- smaller
- better usable
than for example Dev-CPP in version 4 or 5.

So, despite all evil that comes with wxWidgets, it still enables people to produce quite good end results.


Is this fan on/off issue not something that can be configured under power management? Surely, it can be configured to something like "When on AC, always run CPU at full speed"?

Another way to keep the fan running is this, of course:

Code: [Select]
int main()
{
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_LOWEST);
for(;;)
;
}


That will prevent the fan from ever going off and the only thing that you lose is the validity of CPU idle time in the task manager ;)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
High CPU usage
« Reply #12 on: June 23, 2005, 05:39:23 pm »
Good idea. Submit a patch for it then :)

Offline Birdeeoh

  • Single posting newcomer
  • *
  • Posts: 4
Re: High CPU usage
« Reply #13 on: September 13, 2005, 02:42:03 am »
I'd just like to jump in with my take -
With a fresh install of 1.0rc1, my cpu usage while moving the mouse or typing into the editor is 25-30%.  XP Pro has a really weird time reporting CPU usage for duel processors (I have P4 w/HT) and one "CPU" at full reports back 50% overall usage.  So 25-30 is likely an understatement.

Disabling all of the plugins, and mouse/typing only causes 5-6% usage.  Add the GDB plugin adds 4% more usage, and adding the compiler plugin adds 10% more - the others seem to add only a little.

As an anonymou poster pointed out in this thread, it's a potential dealbreaker for quite a few people - I, too, am on a laptop and the sporatic foray into 10% + usage territory causes the fan to rev all over the place.

Someone suggested the overhead is from wxwidgets and, while that MAY be the case from suboptimal usage of wxw I'd have to say it's not near definite.  My previous IDE, Chinook, was also built with wxwidgets and the typing/mousing over the window will never get the CPU above 2% - typical for ANY application.

Codeblocks looks so great and full featured and, again unlike Chinook, it's actively developed by a community and seems to have support for some time to come.

But I'd sure like to be able to use fancier plugins without biting into my CPU hard enough to cause the fan to ramp up.  Normally I only ever hear the fan speed up while I'm gaming  :)

Anywho, on a more general note, it looks great overall and keep up the great work!

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: High CPU usage
« Reply #14 on: September 13, 2005, 04:43:36 am »
Hmmmmmmmmmmmmmmmmmmmm

This makes me think. What events in the compiler / debugger / (code completion?) plugins are affected by mouse moves?