Suggestions for measuring memory usage

Hello all,

I am on 2022.01 release of RIOT and building apps for nrf52840dongle.

I worked on implementing a module. I need to know the RAM and FLASH usage required by the module. To understand the flash usage I used the binary size profiler Bloaty. But many information are missing from the bloaty output.For eg.

        FILE SIZE        VM SIZE    
 --------------  --------------
  45.9%  1.76Mi  62.6%  78.7Ki    [174 Others]
  15.8%   621Ki   0.0%       0    [section .debug_macro]
  14.9%   585Ki   0.0%       0    [section .debug_str]

Bloaty classifies many compile units into Others and does not tell where precisely the binary size is coming from. It shows the binary contribution of some files, and for some, it does not.

Could you guys give me any suggestions on how to measure flash usage? For eg. is there any better tools similar to bloaty? Also, How to measure the RAM usage?

Regards, Adarsh

Try make BOARD=nrf52840dongle cosy

1 Like

Thanks

could you tell me why I get this warning and how to solve this?

and it shows as most of the code unspecifield . I was expecting it may also show core,CPU,board,drivers etc parts in different colors. :sweat_smile: May be this is the reason why bloaty also mapped most part of the binary to unspecified.

Hi!

Actually, I have similar issues: 858 out of 1043 symbols could not be matched to a path.

In fact, everything besides newlib seems to appear as ā€˜unspecificā€™. Apparently the regex in https://github.com/haukepetersen/cosy/blob/master/cosy.py#L162 isnā€™t matching (any more?).

Cheers Oleg

prom_printf(ā€œDetected PenguinPages, getting out of here.\nā€); linux-2.0.38/arch/sparc/mm/srmmu.c

Hey!

On Fri, Jul 08, 2022 at 08:34:14AM +0000, Oleg Hahm via RIOT wrote:

In fact, everything besides newlib seems to appear as ā€˜unspecificā€™. Apparently the regex in cosy/cosy.py at master Ā· haukepetersen/cosy Ā· GitHub isnā€™t matching (any more?).

If I change cosy/cosy.py at master Ā· haukepetersen/cosy Ā· GitHub from r"(.+/)?" to r"(.*/)?" the problem seems to be fixed.

I will make a PR.

Cheers Oleg

printk(ā€œ%s: TDR is ga-ga (status %04x)\nā€, ā€¦); linux-2.6.6/drivers/net/eexpress.c

1 Like

And hey again!

On Fri, Jul 08, 2022 at 10:04:41AM +0000, Oleg Hahm via RIOT wrote:

I will make a PR.

After creating the PR I realized that there is already another open PR that addresses the issue differently, but equally successful:

but apparently @HaukePetersen is not accepting PRs on his repoā€¦ :wink:

Cheers Oleg

printk(ā€œEntering UltraSMPenguin Modeā€¦\nā€); linux-2.2.16/arch/sparc64/kernel/smp.c

1 Like

what about adding it as a patch in RIOT for now?

(it has been done for other issues dist/tools/cosy: allow to specify port by benpicco Ā· Pull Request #18194 Ā· RIOT-OS/RIOT Ā· GitHub)

Hey Leandro!

On Fri, Jul 08, 2022 at 10:30:48AM +0000, Leandro Lanzieri via RIOT wrote:

what about adding it as a patch in RIOT for now?

(it has been done for other issues dist/tools/cosy: allow to specify port by benpicco Ā· Pull Request #18194 Ā· RIOT-OS/RIOT Ā· GitHub)

I would be more in favor of asking Hauke whether he would either accept a co-maintainer for the repo or moving it to the RIOT repo. As far as one can judge from the activity in the cosy repo I would assume more maintenance happing in the Github RIOT org.

Cheers Oleg

printk(KERN_ERR ā€œhappy meal: Fry guys.ā€); linux-2.6.6/drivers/net/sunhme.c

1 Like

@oleg cool !! thanks a lot. Now Everything is much clear !! :clap: :metal:

Any leads on how to measure the RAM usage ?

Hey Adarsh,

for the RAM usage: depends on what exactly you want to measure. Statically allocated memory is shown by cosy as well (check data and bss sections). This includes the memory reserved for the stack of each thread. If youā€™re interested in how much memory per thread is actually consumed at runtime, you can use ps() (or the corresponding shell command).

Cheers Oleg

Chuck Norris doesnā€™t do TCP handshake - he does TCP roundhouse-kick to initiate the connection.

1 Like

Okā€¦I understandā€¦Thanks for the help :slight_smile:

Regards, Adarsh