nrfutil uses a large amount of CPU time when run under Linux.

I have found that in Linux, "nrfutil toolchain-manager launch --shell" is starting a process that uses almost 20% of the CPU according to the top utility. I have found this directly on a Ubuntu machine and also with Windows Subsystem for Linux. I may be running 24.04-1 but I am guessing it will be the same for 22.04-1.

I don't know why it should use any resources if it just exports environment variables. In fact, I tried to tease out most of the environment variables added/modified by nrfutil...--shell and run a simple script that exports the same variables into a basic bash shell.  This seems to allow me to build and I don't see anything gobbling up CPU. But I'd rather run nrfutil...--shell rather than my hack script--minus wasting CPU.

Burt

Parents Reply Children
  • Hi Burt,

    I asked my colleague to have a try on ubuntu 22.04 and do not see the increased cpu usage. I will try to get one with ubuntu 2.4.04 to do test.

    At the same time, could you proivde more informaiton about your PC(like processer) and system? 

    Best regards,

    Charlie

  • Hi Charlie,

    I tried it using WSL: I added a WSL Ubuntu-22.04.5 machine to my Windows machine (I had already tested with the default 24.04.1 and on a regular Linux machine (non VM) as I originally stated). I decided to install the latest toolchain: 2.8.0 as long as it now exists. I get the same exact behavior as previously. Running the "top" command, the first process listed is nrfutil. I probably can only set up a different type of virtual machine (like VirtualBox) to illustrate another 22.04 instance, but the WSL seems to mirror a physical machine. Yeah, too much work to go beyond what I have already done!

    Burt

    (v2.8.0) burt@T450S:~$ top
    top - 10:05:05 up 18 min, 2 users, load average: 0.02, 0.15, 0.09
    Tasks: 30 total, 1 running, 29 sleeping, 0 stopped, 0 zombie
    %Cpu(s): 0.5 us, 1.6 sy, 0.0 ni, 97.8 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
    MiB Mem : 5866.8 total, 116.3 free, 455.9 used, 5294.6 buff/cache
    MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 5121.8 avail Mem

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    796 burt 20 0 24992 10112 8628 S 18.9 0.2 0:02.11 nrfutil

    1 root 20 0 165772 10892 8076 S 0.0 0.2 0:01.15 systemd
    2 root 20 0 2460 1340 1224 S 0.0 0.0 0:00.00 init-sy+
    6 root 20 0 2476 196 196 S 0.0 0.0 0:00.01 init
    62 root 19 -1 47736 14548 13516 S 0.0 0.2 0:00.54 systemd+
    85 root 20 0 21704 5580 4388 S 0.0 0.1 0:00.74 systemd+
    105 systemd+ 20 0 25664 12436 8080 S 0.0 0.2 0:00.20 systemd+
    119 systemd+ 20 0 89364 6548 5744 S 0.0 0.1 0:00.20 systemd+
    167 root 20 0 4308 2752 2516 S 0.0 0.0 0:00.01 cron
    168 message+ 20 0 8588 4552 4008 S 0.0 0.1 0:00.22 dbus-da+
    173 root 20 0 30044 18132 9328 S 0.0 0.3 0:00.20 network+
    174 syslog 20 0 222404 7056 4256 S 0.0 0.1 0:00.06 rsyslogd
    177 root 20 0 15332 7584 6600 S 0.0 0.1 0:00.23 systemd+
    213 root 20 0 107128 20232 12052 S 0.0 0.3 0:00.16 unatten+
    284 root 20 0 7528 4892 3972 S 0.0 0.1 0:00.01 login
    337 burt 20 0 16964 9200 7704 S 0.0 0.2 0:00.17 systemd
    338 burt 20 0 103288 3308 12 S 0.0 0.1 0:00.00 (sd-pam)

  • Hi Burt,

    Thank you for sharing your observations. I can confirm that this behavior is repeatable on Ubuntu systems, including versions 22.04, 24.04, and WSL Ubuntu.

    I have reported this potential improvement to our nrfutil developers, and an enhancement will hopefully come in the near future update. I will keep you informed of any progress.

    Best regards,

    Charlie

Related