evl ps cpu time reporting issue
Hy there,
I found a few issues with the output of ps -st.
The most crucial one is that sometimes it reports excessive CPU usage, e.g. (running watch -n1 evl ps -st):
CPU PID ISW CTXSW SYS RWA STAT TIMEOUT %CPU CPUTIME NAME 1 947 105 119 203 1 X - 0.0 0:011.988 test-pd:947:1804289383 1 952 2 2 3 0 X - 0.0 0:000.087 systemTask 1 954 2 2 3 0 X - 0.0 0:000.056 WSServer_40100 1 956 2 2 3 0 X - 0.0 0:000.070 WSClient_signalMonitor40100_bin 1 1003 2 2 3 0 X - 0.0 0:000.054 WSServer_5555 1 1004 2 2 3 0 X - 0.0 0:000.054 WSClient_gui_data5555_bin 1 1005 2 2 3 0 X - 0.0 0:000.044 WSClient_gui_control5555_bin 1 1006 15 15 47 0 X - 0.0 0:000.594 WSServer_5432 1 1007 504 514 505 0 X - 0.0 0:021.035 WSClient_scope_data5432_bin 1 1008 2 2 3 0 X - 0.0 0:000.049 WSClient_scope_control5432_bin 1 1009 48842 73393 123151 24420 W - 0.0 0:380.085 scope-trigger-task 0 1011 6640 31157 37608 23656 W - 1193652.1 0:642.101 thread:947:0xffffb3c0fe30:2214587712 1 1012 774278 1546216 776625 0 D 001.393 0.5 7:690.643 libpd-fdTask 1 1013 0 2 4 0 W - 0.0 0:000.081 touchSensorRead 3 1019 2 28822348 28885721 27 011 48.3 1092:295.224 bela-audio
note that thread:947:0xffffb3c0fe30:2214587712 has 1193652.1% CPU. In another case it reported 1405727.9, in another something like 16000; some other times it shows between 60% and 150% ... In the instances I've seen, it was only this thread that was affected, no other one. The thread should never go anywhere 10%: most of the time it sleeps on an evl_wait_event(); when it's woken up, it reads 4k of data from disk (thus switching to secondary mode), puts it in a buffer, signals another evl condition variable via evl_signal_event() (thus switching to primary mode) and goes back to sleep in evl_wait_event().
Now, I cannot exclude that there may be something wrong in my code, which may justify the occasional 60% reading (I didn't write it myself, only ported it to evl, and I didn't inspect it closely), but there's clearly something pathological in evl's CPU reporting system with anything above 100%, I guess?
As usual, I am running this on ARM64 (PocketBeagle 2)
evl.0.55 -- #98a8b88 (2025-10-08 22:41:39 +0000) [requires ABI 42]
Linux bela 6.12.49-arm64-ti-evl #4 SMP EVL Sun Nov 2 19:24:32 UTC 2025 aarch64 GNU/Linux
Best,
Giulio
Quoted 7 lines
The most crucial one is that sometimes it reports excessive CPU usage, e.g. (running watch -n1 evl ps -st):
CPU PID ISW CTXSW SYS RWA STAT TIMEOUT %CPU CPUTIME NAME
...
0 1011 6640 31157 37608 23656 W - 1193652.1 0:642.101 thread:947:0xffffb3c0fe30:2214587712
...
I forgot to mention that most of the time this thread reports 0% usage as expected. To confirm this is not an issue with libevl's visualisation, but the issue is somewhere deeper, one further log:
# while sleep 0.1; do cat /sys/devices/virtual/thread/thread\:8011\:0xffff97cdfe30\:2491661632/stats; done
8926 41873 50471 29419 609329129 0 8927 41875 50474 29420 609388012 11133 8927 41876 50475 29420 609410796 0 8927 41878 50477 29420 609451945 0 8928 41880 50480 29420 609481429 0 8928 41881 50481 29420 609498449 0 8928 41883 50483 29420 609535063 0 8929 41886 50486 29420 609574946 0 8929 41887 50487 29420 609592925 0 8929 41889 50489 29420 609632058 1 8930 41891 50492 29420 609663628 0 8930 41892 50493 29420 609680457 0 8930 41894 50495 29420 609717002 0 8931 41896 50498 29420 609746761 0 8931 41897 50499 29420 609766180 0 8931 41898 50500 29420 609783920 0 8932 41901 50504 29420 609836897 0 8932 41902 50505 29420 609858481 0 8932 41903 50506 29420 609887230 0 8933 41906 50510 29420 609946013 20581947 8933 41907 50511 29421 609971602 0 8933 41908 50512 29422 609998161 0 8933 41909 50513 29423 610025640 0 8934 41912 50517 29424 610095202 5239 8934 41913 50518 29424 610113607 0 8934 41914 50519 29424 610137617 0
Best,
Giulio
Quoted 40 lines · Giulio Moro
Quoted 6 lines
The most crucial one is that sometimes it reports excessive CPU usage, e.g. (running watch -n1 evl ps -st):
CPU PID ISW CTXSW SYS RWA STAT TIMEOUT
%CPU CPUTIME NAME
...
0 1011 6640 31157 37608 23656 W - 1193652.1 0:642.101 thread:947:0xffffb3c0fe30:2214587712
...I forgot to mention that most of the time this thread reports 0% usage as expected. To confirm this is not an issue with libevl's visualisation, but the issue is somewhere deeper, one further log:
# while sleep 0.1; do cat /sys/devices/virtual/thread/thread\:8011\:0xffff97cdfe30\:2491661632/stats; done8926 41873 50471 29419 609329129 0 8927 41875 50474 29420 609388012 11133 8927 41876 50475 29420 609410796 0 8927 41878 50477 29420 609451945 0 8928 41880 50480 29420 609481429 0 8928 41881 50481 29420 609498449 0 8928 41883 50483 29420 609535063 0 8929 41886 50486 29420 609574946 0 8929 41887 50487 29420 609592925 0 8929 41889 50489 29420 609632058 1 8930 41891 50492 29420 609663628 0 8930 41892 50493 29420 609680457 0 8930 41894 50495 29420 609717002 0 8931 41896 50498 29420 609746761 0 8931 41897 50499 29420 609766180 0 8931 41898 50500 29420 609783920 0 8932 41901 50504 29420 609836897 0 8932 41902 50505 29420 609858481 0 8932 41903 50506 29420 609887230 0 8933 41906 50510 29420 609946013 20581947 8933 41907 50511 29421 609971602 0 8933 41908 50512 29422 609998161 0 8933 41909 50513 29423 610025640 0 8934 41912 50517 29424 610095202 5239 8934 41913 50518 29424 610113607 0 8934 41914 50519 29424 610137617 0
Quoted 2 lines
Best,
Giulio
Can you please add this patch to your kernel? This may help in figuring out which input to the calculation is wrong.
kernel/evl/thread.c +5 -3
@@ -2619,7 +2619,7 @@ static ssize_t stats_show(struct device *dev,struct device_attribute *attr, char *buf) { - ktime_t period, exectime, account, total; + ktime_t period, exectime, _exectime, account, _account, total;struct evl_thread *thread;unsigned long flags;struct evl_rq *rq;
@@ -2650,6 +2650,8 @@ static ssize_t stats_show(struct device *dev,raw_spin_unlock_irqrestore (&thread->lock, flags); + _exectime = exectime; + _account = account;if (account) {while (account >0xffffffffUL ) { exectime >>=16 ;
@@ -2662,13 +2664,13 @@ static ssize_t stats_show(struct device *dev, }else usage =0 ; - ret =snprintf (buf,PAGE_SIZE ,"%lu %lu %lu %lu %Lu %d\n" , + ret =snprintf (buf,PAGE_SIZE ,"%lu %lu %lu %lu %Lu %d %Lu %Lu\n" ,evl_opt_counter_read (&thread->stat.isw),evl_opt_counter_read (&thread->stat.csw),evl_opt_counter_read (&thread->stat.sc),evl_opt_counter_read (&thread->stat.rwa), total, - usage); + usage, _exectime, _account);evl_put_element (&thread->element);
Signature · 1 line
Philippe.
Philippe Gerum wrote on 24/02/2026 09:01:
Quoted 2 lines
Can you please add this patch to your kernel? This may help in figuring out which input to the calculation is wrong.
Thanks, here's a sample:
while sleep 0.1; do cat /sys/devices/virtual/thread/thread\:2597\:0xffffb417fe30\:2966408512/stats ; done
...
286 1230 1511 922 23489998 0 25909 92772685
287 1232 1514 923 23531006 0 41008 93137397
287 1233 1515 924 23559820 0 28814 92637646
287 1234 1516 925 23585834 0 26014 92881291
288 1237 1520 927 23656565 788211 23656565 30013
288 1238 1521 928 23684279 0 27714 92538624
288 1239 1522 929 23711753 0 27474 92913295
288 1240 1523 930 23737566 0 25813 92877151
289 1242 1526 931 23775363 0 37797 93009590
289 1244 1528 933 23862059 0 27904 92771007
289 1245 1529 934 23889157 0 27098 92878781
290 1247 1532 935 23925820 0 36663 93076817
290 1248 1533 936 23951423 0 25603 92655744
290 1250 1535 938 24013939 0 62516 185803244
291 1252 1538 939 24066786 1 52847 93163049
291 1253 1539 940 24086170 0 19384 92564594
291 1254 1540 941 24114369 0 28199 92882843
291 1255 1541 942 24146957 0 32588 92868913
292 1258 1545 944 24209654 0 25559 92716216
292 1259 1546 945 24244103 0 34449 92941370
292 1260 1547 946 24272996 0 28893 92816177
293 1262 1550 947 24311504 0 38508 93060111
293 1263 1551 948 24338783 0 27279 92701893
293 1265 1553 950 24394686 0 55903 185748119
294 1267 1556 951 24432533 0 37847 93039946
294 1268 1557 952 24456816 0 24283 92702343
294 1269 1558 953 24485695 0 28879 92879370
295 1272 1562 955 24575185 545061 24575185 45087
295 1273 1563 956 24600363 0 25178 92046991
295 1274 1564 957 24627141 0 26778 92884865
295 1275 1565 958 24654509 0 27368 92847752