Page 1 of 1
CPU Usage While Idle
Posted: 05.05.2024 12:40
by atomapple
Hi,
I'm running Cudatext v1.213.0.2 on FreeBSD. It's working great, but I noticed when I have Cudatext in the background / not using it, it's still consuming ~2% WCPU time. What is Cudatext doing while in the background, and can it be reduced? The only additional plugins I have are Highlight_Occurences and Suggest_Untitled_Filename. I removed Suggest_Untitled_Filename and that reduced CPU usage to ~0.75%. So maybe that's the main thing consuming the extra CPU cycles?
Thanks!
Re: CPU Usage While Idle
Posted: 05.05.2024 13:20
by main Alexey
1. what if you turn off option "ui_session_save_interval", to 0 ? I guess it don't matter but check it.
2. try the attached plugin. does it increase CPU time? it is activated by 'on_state'.
to install zip file: open zip file in Cud via 'File / Open'.
Suggest_untitled_filename is also activated by on_state.
plugin prints in the Console: "plg on_state: NN" where numbers are:
Code: Select all
APPSTATE_LANG = 20
APPSTATE_THEME_UI = 21
APPSTATE_THEME_SYNTAX = 22
APPSTATE_GROUPS = 23
APPSTATE_CONFIG_REREAD = 24
APPSTATE_SESSION_LOAD = 25
APPSTATE_SESSION_LOAD_BEGIN = 26
APPSTATE_SESSION_LOAD_FAIL = 27
APPSTATE_PROJECT = 28
APPSTATE_API_SUBCOMMANDS = 30
APPSTATE_API_MENU_ADD = 31
APPSTATE_API_MENU_REMOVE = 32
APPSTATE_API_MENU_CHANGE = 33
APPSTATE_WINDOW = 39
APPSTATE_CODETREE_CLEAR = 40
APPSTATE_CODETREE_BEFORE_FILL = 41
APPSTATE_CODETREE_AFTER_FILL = 42
APPSTATE_CODETREE_SET_SELECTION = 43
Re: CPU Usage While Idle
Posted: 05.05.2024 13:28
by main Alexey
3. try to set option (in user.json) "caret_blink_en": false
Re: CPU Usage While Idle
Posted: 05.05.2024 18:20
by atomapple
I tried setting "ui_session_save_interval" to 0, no change.
I tried setting "caret_blink_en" to false, no change.
I installed the plugin, but I'm not sure how often it's support to print out the "plg on_state: NN" information. I only saw two printouts over the course of a minute of not using Cudatext (one was 26, the other was 25). Let me know what I should do with that plugin

Re: CPU Usage While Idle
Posted: 05.05.2024 18:30
by atomapple
Oh, I think I understand what the plugin is doing now -- it's being called during on_state, the same as Suggest_untitled_filename. OK, after installing the plugin the CPU usage is fine (as if I didn't have it installed).
Re: CPU Usage While Idle
Posted: 05.05.2024 18:38
by atomapple
As an aside, setting "caret_blink_en": false lowered CPU usage by about 1% with Cudatext in the foreground (just sitting there not moving the mouse). Another interesting bit is that if Cudatext is in the foreground (not doing anything), CPU usage is ~0.25%. If I switch apps and Cudatext is either not in focus or "behind" some other app, it consistently uses ~0.85% CPU.
These aren't huge issues, just trying to make it not consume anything if I'm not using it.
Re: CPU Usage While Idle
Posted: 05.05.2024 19:22
by main Alexey
> If I switch apps and Cudatext is either not in focus or "behind" some other app, it consistently uses ~0.85% CPU.
I don't know the reason of it...
Is this 0.85% - with "caret_blink_en": false? Is it better when it's 'true'?
Re: CPU Usage While Idle
Posted: 05.05.2024 19:43
by main Alexey
What editor can do in background? paint caret. but it's done by TimerBlink, and TimerBlink.OnTimer handler has this checking:
if not Application.Active then exit;
so when app is not active, timer does nothing at all. I dont know what else to check.
Re: CPU Usage While Idle
Posted: 05.05.2024 19:46
by atomapple
It's ~0.85% with "caret_blink_en": true if Cudatext is not in focus (even though the cursor is not flashing on the screen) or if Cudatext is in the background.