mailing-list for TeXmacs Users

Text archives Help


Re: Constant Use of 100% CPU


Chronological Thread 
  • From: Sebastian Miele <address@hidden>
  • To: Massimiliano Gubinelli <address@hidden>
  • Cc: TeXmacs <address@hidden>
  • Subject: Re: Constant Use of 100% CPU
  • Date: Sun, 02 Aug 2020 09:56:12 +0200

Massimiliano Gubinelli <address@hidden> writes:

> Maybe, something is going wrong in your runloop. If you look into
> Plusings/Qt/qt_gui.cpp you see that we use a QTimer to fire an update
> procedure which runs TeXmacs internal update routines (reading input
> events from a secondary queue, performing changes and updating the
> window graphic surfaces). Maybe something is changed in the version of
> Qt5 which you have and this makes this bug appear, it does not seems
> to me I have seen it on my Mac (with Qt4). If you want to try to debug
> you can see wether the update function is run too often and why.
> Usually the algorithm make sure that, unless there is input to handle,
> the update function is called with reasonable timeout (there are
> delayed events which are produced internally in TeXMacs which have to
> be handled anyway, like the update of the footer bar).

I do not want to start diving into the C++ source code at this point in
my TeXmacs learning curve. It probably will take several months until I
want to do that.

However, I ran gprof on a TeXmacs compiled via:

CFLAGS='-march=silvermont -mtune=silvermont -pg' \
CXXFLAGS='-march=silvermont -mtune=silvermont -pg' \
cmake ../0 \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/texmacs/0-gprof \
-DGUILECONFIG_EXECUTABLE=/usr/bin/guile-config1.8

I ran TeXmacs for more than two hours. The 100% CPU issue was present
nearly all of that time. The outputs of 'gprof --flat-profile ...' and
'gprof --graph ...' are:


https://drive.google.com/file/d/1zuNvh5xxBXivvr6JOOmONBV0UCW_ymjW/view?usp=sharing

https://drive.google.com/file/d/1dnQr6RU4TXbZ8KymtJ3NeRXQke9fIJIi/view?usp=sharing

The beginning of the latter is:

granularity: each sample hit covers 2 byte(s) for 0.00% of 1069.17 seconds

index % time self children called name
<spontaneous>
[1] 97.9 0.07 1046.15 QTMGuiHelper::doUpdate() [1]
0.13 1046.02 826744/826745 qt_gui_rep::update() [2]
-----------------------------------------------
0.00 0.00 1/826745 qt_gui_rep::event_loop()
[1705]
0.13 1046.02 826744/826745 QTMGuiHelper::doUpdate()
[1]
[2] 97.8 0.13 1046.03 826745 qt_gui_rep::update() [2]
0.67 1040.20 826909/826909
tm_server_rep::interpose_handler() [3]
0.66 3.57 826909/826909
qt_simple_widget_rep::repaint_all() [82]
0.05 0.32 1712/1712
qt_gui_rep::process_queued_events(int) [216]
0.13 0.08 826909/826909 sync_databases() [282]
0.14 0.00 826909/826909
texmacs_interpose_handler() [371]
0.13 0.00 2480734/8301127 texmacs_time() [196]
0.04 0.00 2484051/2484051 event_queue::size() const
[629]
0.03 0.00 826912/826912
command_queue::must_wait(long) const [710]
0.00 0.00 463/463
qt_gui_rep::process_delayed_commands() [2941]
-----------------------------------------------
0.67 1040.20 826909/826909 qt_gui_rep::update() [2]
[3] 97.4 0.67 1040.20 826909
tm_server_rep::interpose_handler() [3]
0.26 1039.31 1653517/1653517
edit_interface_rep::apply_changes() [4]
0.12 0.11 826909/826909 process_all_pipes() [270]
0.09 0.07 826909/826913 windows_refresh(string)
[336]
0.05 0.09 1653517/1653517 virtual thunk to
edit_interface_rep::animate() [369]
0.02 0.06 826909/985568419 string::string(char
const*) [26]
0.01 0.00 826909/1696524345 fast_free(void*,
unsigned long) [51]
0.01 0.00 826909/5143892594 fast_delete(void*) [33]



Archive powered by MHonArc 2.6.19.

Top of page