[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Texmacs-dev] Constant Use of 100% CPU
From: |
Sebastian Miele |
Subject: |
Re: [Texmacs-dev] Constant Use of 100% CPU |
Date: |
Mon, 03 Aug 2020 02:17:24 +0200 |
User-agent: |
mu4e 1.4.12; emacs 27.1 |
Applying
diff --git a/src/Plugins/Qt/qt_gui.cpp b/src/Plugins/Qt/qt_gui.cpp
index 22b21d2cd..5fcb0fb26 100644
--- a/src/Plugins/Qt/qt_gui.cpp
+++ b/src/Plugins/Qt/qt_gui.cpp
@@ -836,7 +836,10 @@ qt_gui_rep::update () {
if (interrupted) needing_update = true;
if (nr_windows == 0) qApp->quit();
- time_t delay = delayed_commands.lapse - texmacs_time();
+ time_t delay = (0 < N(delayed_commands.q))
+ ? (delayed_commands.lapse - texmacs_time())
+ : std_delay;
+
if (needing_update) delay = 0;
else delay = max (0, min (std_delay, delay));
if (postpone_treatment) delay= 100; // NOTE: force occasional display
seems to produce no problems and solves the bug. (At least the bug that
I experienced and debugged. I do not know whether there are more 100%
CPU bugs.) I found it with:
diff --git a/src/Plugins/Qt/qt_gui.cpp b/src/Plugins/Qt/qt_gui.cpp
index 22b21d2cd..b3a0d9102 100644
--- a/src/Plugins/Qt/qt_gui.cpp
+++ b/src/Plugins/Qt/qt_gui.cpp
@@ -836,10 +836,26 @@ qt_gui_rep::update () {
if (interrupted) needing_update = true;
if (nr_windows == 0) qApp->quit();
- time_t delay = delayed_commands.lapse - texmacs_time();
+ time_t now_1 = texmacs_time();
+ time_t lapse = delayed_commands.lapse;
+ time_t delay = lapse - now_1;
+
if (needing_update) delay = 0;
else delay = max (0, min (std_delay, delay));
if (postpone_treatment) delay= 100; // NOTE: force occasional display
+
+ if( delay <= 0 )
+ {
+ const command_queue& q = delayed_commands;
+ cout << '\n'
+ << " now_1: " << now_1 << '\n'
+ << " lapse - now_1: " << lapse - now_1 << '\n'
+ << "needing_update: " << needing_update << '\n'
+ << " delay: " << delay << '\n'
+ << " q.wait: " << q.wait << '\n'
+ << " q.lapse: " << q.lapse << '\n'
+ << " q.start_times: " << q.start_times << LF;
+ }
updatetimer->start (delay);
updating = false;
When the bug appears, that procudes a lot of
now_1: 46233
lapse - now_1: -41
needing_update: false
delay: 0
q.wait: false
q.lapse: 46192
q.start_times: [ ]
where q.lapse and q.start_times stay constant, now_1 increases, and
lapse - now_1 decreases. The lapse is used without checking whether the
queue is empty. I do not understand command_queue. But if the queue is
empty, a lapse (other than +inf) probably does not make sense.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Texmacs-dev] Constant Use of 100% CPU,
Sebastian Miele <=