cpu heat

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
emilbarton
In need of some credit
In need of some credit
Posts: 5
Joined: Thu Jan 12, 2017 3:58 pm

cpu heat

Post by emilbarton »

Hello,
my application (https://github.com/emilbarton/Unidatab/) is running, but not too well and I wish to debug it. When it starts, it requires too much CPU activity (between 8 and 30% of each of the 4 cores), but if I do certain actions with the menu (like copying rows from a grid) then it comes to behave normally (requiring much less CPU).
When I start from the command line, I see lots of messages like below. Using gdb (which I don't master at all), I see that it stops often at syscalls.

Thank you in advance for your help.

Starting from command line:

$ Thu Jan 12 - 16:49:20 # unid-gui
using configuration file : unid-gui.conf
using log file : unid-gui.log
(unid-gui:27941): Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
(unid-gui:27941): Gtk-CRITICAL **: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
(unid-gui:27941): Gdk-WARNING **: gdk-frame-clock: layout continuously requested, giving up after 4 tries
(unid-gui:27941): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GtkWidget'
(unid-gui:27941): Gtk-CRITICAL **: gtk_widget_set_size_request: assertion 'GTK_IS_WIDGET (widget)' failed
(unid-gui:27941): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GtkWidget'
(unid-gui:27941): Gtk-CRITICAL **: gtk_widget_set_size_request: assertion 'GTK_IS_WIDGET (widget)' failed
(unid-gui:27941): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GtkWidget'
(unid-gui:27941): Gtk-CRITICAL **: gtk_widget_set_size_request: assertion 'GTK_IS_WIDGET (widget)' failed
(unid-gui:27941): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GtkWidget'
(unid-gui:27941): Gtk-CRITICAL **: gtk_widget_set_size_request: assertion 'GTK_IS_WIDGET (widget)' failed
(unid-gui:27941): Gdk-WARNING **: gdk-frame-clock: layout continuously requested, giving up after 4 tries
(unid-gui:27941): Gdk-WARNING **: gdk-frame-clock: layout continuously requested, giving up after 4 tries
(unid-gui:27941): Gdk-WARNING **: gdk-frame-clock: layout continuously requested, giving up after 4 tries
...
Manolo
Can't get richer than this
Can't get richer than this
Posts: 828
Joined: Mon Apr 30, 2012 11:07 pm

Re: cpu heat

Post by Manolo »

Welcome emilbarton.

There can be many different reasons for your CPU activity. It will be good if you can reduce your code to the minimal so as to expose this issue.
This is not a general coding forum. You should test if the problem comes from wxWidgets or from other point.

Regarding GTK messages, well, each GTK version has its owns issues (or bugs, somebody would say). Sometimes they show due to an unnormal way of using the API, sometimes (just a bunch) it's due to wxWidgets, some because of some "abuse" in your code of wx or gtk.

The best you can do is to use the debugger and to narrow the problem to a small piece of code.
emilbarton
In need of some credit
In need of some credit
Posts: 5
Joined: Thu Jan 12, 2017 3:58 pm

Re: cpu heat

Post by emilbarton »

Thank you, however gdb does not consider my breakpoints and runs the program as if they weren't there, while its activity seems to get stuck on IMPLEMENT_APP, opening many windows (I'm using Codeblocks) with files such as cairo-surface.c, ghash.c, gsignal.c etc.. Can you tell me how to limit the debugger to my program and have it stop at breakpoints?
Last edited by emilbarton on Sat Jan 14, 2017 7:21 am, edited 1 time in total.
emilbarton
In need of some credit
In need of some credit
Posts: 5
Joined: Thu Jan 12, 2017 3:58 pm

Re: cpu heat

Post by emilbarton »

Trying to run the GDB (from the shell too this time) onto the attached process of my program (unid-gui-debug) and setting a breakpoint at a suspected function like UnidWxMain::RecordVisit() yields unexpected results:

I can only step into the function calls from that method (with 's') but not step to the next line of code (n) in that method as I can for other non-Wx methods. As soon as I hit 'n' instead of 's', the method is ignored and run till the end, so there's no way to inspect the environment of the suspected method.

The fact that the moderator of this forum has pushed my question to "Platform Related Issues" without explanation is interesting there, since it was originally posted in "C++ Development"; some comments on this decision would surely have been enlightening.

Platform: GNU/Linux 4.8.15 x86_64 - Gcc version 6.3.1 - Wx version 3.0.2
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: cpu heat

Post by DavidHart »

Hi,
The fact that the moderator of this forum has pushed my question to "Platform Related Issues" without explanation is interesting there, since it was originally posted in "C++ Development"; some comments on this decision would surely have been enlightening.
You have a problem with one aspect of your program that sounds as if it's related to GTK+ not wxWidgets. 'C++ Development' is intended for questions or issues about the wxWidgets C++ classes. Why do you think that particular subforum is more appropriate?

As far as your problem is concerned, I agree with Manolo that you need to use your debugger. I strongly suggest you read a couple of gdb tutorials, and look in particular at how to use backtraces. However you will not be able to debug successfully inside 'release' system libraries or programs i.e. ones that have no debugging symbols installed, which is the default for Linux distros. (I presume you made a 'debug' build of your program.)

Also, I suggest you (build if necessary and) run some of the samples that come with wxWidgets; start with 'minimal', then either choose one that's similar to your program or try 'widgets' which shows most of the controls. If they don't have the same problem, at least you know your wxWidgets and GTK+ aren't responsible.

Finally, since this may be a GTK+ problem, you may find this page helpful, especially the part about --g-fatal-warnings.

Regards,

David
emilbarton
In need of some credit
In need of some credit
Posts: 5
Joined: Thu Jan 12, 2017 3:58 pm

Re: cpu heat

Post by emilbarton »

Many thanks for your answer, it helped me a lot to use GDB more successfully with `wx-config --prefix=/usr/lib/debug --libs`. You must be right regarding GTK (https://bugzilla.redhat.com/show_bug.cgi?id=1304681) and I don't feel like being able to repare this on my own. I hope this issue will be treated soon.
emilbarton
In need of some credit
In need of some credit
Posts: 5
Joined: Thu Jan 12, 2017 3:58 pm

Re: cpu heat

Post by emilbarton »

It might be useful to know that my package compiles fine under wxWidgets 2.8 and runs without overheat (1 to 5% of the activity of the 4 cores). :?
Post Reply