Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cargo-bloat-action without --crates? #147

Closed
therealprof opened this issue May 12, 2020 · 4 comments · Fixed by #151
Closed

Use cargo-bloat-action without --crates? #147

therealprof opened this issue May 12, 2020 · 4 comments · Fixed by #151

Comments

@therealprof
Copy link

Thanks for creating this action for one of my most beloved tools. Of course I immediately had to try it on one of my embedded crates now that #145 has landed. Unfortunately it seems to rely on the use of the --crates flag which is unfortunate because that one is not useful in this case.

Is there any way this action could accept non---crates output as well?

cf.
https://github.com/stm32-rs/stm32f4xx-hal/pull/159/checks?check_run_id=665421950

@therealprof
Copy link
Author

@orf Any ideas on this? Would be incredible if we could use this for embedded projects...

CC stm32-rs/stm32f4xx-hal#159

@orf
Copy link
Owner

orf commented May 18, 2020

Hey! Sorry, I've been really busy since I released this!

There should absolutely be a way, I think it will be pretty simple. I'll have a crack at it today.

@orf
Copy link
Owner

orf commented May 18, 2020

Added! Try setting by_function: 1 in the workflow. Let me know if it works OK for you, and if so I'll push a new release. You'll have to use @master until I do that.

@therealprof
Copy link
Author

It compiles, which is great: stm32-rs/stm32f4xx-hal#159 (comment)

It doesn't quite yield the expected output though. ;)

This is the human-readable output:

File  .text   Size         Crate Name
0.3%  39.2% 1.2KiB    dwt_blinky dwt_blinky::__cortex_m_rt_main
0.3%  36.9% 1.1KiB           std __udivmoddi4
0.0%   5.2%   158B           std __aeabi_memset4
0.0%   3.9%   116B   cortex_m_rt Reset
0.0%   3.3%   100B stm32f4xx_hal stm32f4xx_hal::dwt::Delay::delay_ticks
0.0%   3.2%    96B           std __aeabi_memset
0.0%   2.4%    72B stm32f4xx_hal stm32f4xx_hal::dwt::StopWatch::lap_time
0.0%   1.6%    48B stm32f4xx_hal core::iter::traits::iterator::Iterator::min_by_key::key::{{closure}}
0.0%   0.7%    22B           std __aeabi_uldivmod
0.0%   0.3%    10B   cortex_m_rt ResetTrampoline
0.0%   0.3%    10B           std core::panicking::panic_fmt
0.0%   0.3%    10B           std core::panicking::panic_bounds_check
0.0%   0.3%    10B           std core::panicking::panic
0.0%   0.3%    10B     [Unknown] main
0.0%   0.2%     6B           std __aeabi_memclr4
0.0%   0.1%     2B   cortex_m_rt HardFault_
0.0%   0.1%     2B    panic_halt rust_begin_unwind
0.0%   0.1%     2B   cortex_m_rt DefaultPreInit
0.0%   0.1%     2B   cortex_m_rt DefaultHandler_
0.0%   0.0%     0B               And 0 smaller methods. Use -n N to show more.
0.9% 100.0% 2.9KiB               .text section size, the file size is 342.6KiB

Few things of note:

  • The toolchain is running on stable-x86_64-unknown-linux-gnu but the target is thumbv7em-none-eabihf (I would said the target is more important to know than the host architecture)
  • @@ Breakdown per crate @@ should probably be @@ Breakdown per function @@ if the function mode is enabled
  • It only lists the first two functions?
  • While the total file size might be interesting every now and the really interesting metric here is the code (or .text) size, the complete file size also contains debugging information and other data which may not even end up in memory when running the binary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants