zlgopen / awtk-linux-fb

awtk port for linux framebuffer
108 stars 49 forks source link

MusicPlayer.v2-Demo CPU 占用过高,到了40% #74

Closed archeng320 closed 2 years ago

archeng320 commented 2 years ago

CPU 是双核A7 1G主频, LCD使用是 fb,分辨率是1920*720,使用top 看CPU占用了40%。同一台机器,用QT软件,CPU才占用5%。请问,怎么优化CPU的使用率?

archeng320 commented 2 years ago

Mem: 54908K used, 179264K free, 44K shrd, 320K buff, 13640K cached CPU: 39% usr 0% sys 0% nic 60% idle 0% io 0% irq 0% sirq Load average: 0.86 0.83 0.72 2/53 147 PID PPID USER STAT VSZ %VSZ CPU %CPU COMMAND 143 108 root R 49328 21% 0 40% ./mnt/udisk/bin/demo 20 2 root IW 0 0% 0 0% [kworker/0:1-eve] 147 108 root R 2316 1% 1 0% top 106 1 dbus S 2380 1% 0 0% dbus-daemon --system 108 1 root S 2316 1% 0 0% -/bin/sh 1 0 root S 2196 1% 0 0% init 82 1 root S 2196 1% 1 0% /sbin/syslogd -n 86 1 root S 2196 1% 1 0% /sbin/klogd -n 56 2 root IW 0 0% 0 0% [kworker/u4:1-fl] 66 2 root SW 0 0% 1 0% [ubi_bgt0d] 10 2 root IW 0 0% 1 0% [rcusched] 60 2 root IW 0 0% 1 0% [kworker/1:2-eve] 134 2 root SW 0 0% 0 0% [usb-storage] 9 2 root SW 0 0% 0 0% [ksoftirqd/0] 21 2 root IW 0 0% 1 0% [kworker/1:1-mm] 16 2 root SW 0 0% 1 0% [ksoftirqd/1] 135 2 root IW 0 0% 0 0% [kworker/u4:0-fl] 15 2 root SW 0 0% 1 0% [migration/1] 2 0 root SW 0 0% 0 0% [kthreadd] 3 2 root IW< 0 0% 0 0% [rcu_gp]

sohide commented 2 years ago

中间的转盘转动时会耗费cpu, 也可以看看你的平台是否支持drm模式,切换方法见awtk-linux-fb/readme

archeng320 commented 2 years ago

不平台支持drm模式。运行自带的demo1 ,cpu占用17%

./demo1 &

app_root=./

fb_info_t: /dev/fb0 xres=1920 yres=720 xres_virtual=1920 yres_virtual=1440 bits_per_pixel=32 line_length=7680 fb_info_t: red(16 8) green(8 8) blue(0 8) xpanstep=0 ywrapstep=0 fb_size=5529600 fb_total_size=16777216 fb_nr=2 smem_len=16777216 fb_open clear fb_open ok sh: dmidecode: not found =========fb_number=2 ratio=1.000000 1920 720 ratio=1.000000 1920 720 input_run:310: open keyboard failed, fd=-1, filename=/dev/input/event1 input_run:254: open mouse failed, fd=-1, filename=/dev/input/mouse0 Build at: Aug 30 2021 11:30:05

#

top

Mem: 47768K used, 186404K free, 44K shrd, 284K buff, 12916K cached CPU: 21% usr 4% sys 0% nic 73% idle 0% io 0% irq 0% sirq Load average: 0.09 0.07 0.04 1/54 158 PID PPID USER STAT VSZ %VSZ CPU %CPU COMMAND 154 116 root S 42716 18% 0 17% ./demo1

sohide commented 2 years ago

谢谢,我们查一下,可能是最近的版本修改的问题

archeng320 commented 2 years ago

更新到新版软件后,简单的demo的cpu占用率降到1%,但是有动画的demo,如demo_animator ,CPU占用 17% ,不知道是否正常

sohide commented 2 years ago

正常的, 动画, 特别是旋转动画会占用cpu 47f26cbae14ed9a 本问题已修复, 请把awtk和awtk-linux-fb都更新到最新版本