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

px4iofirmware: add PX4IO_PERF define to completely disable perf counters #14128

Merged
merged 2 commits into from
Feb 10, 2020

Conversation

dagar
Copy link
Member

@dagar dagar commented Feb 9, 2020

This saves a paltry 64 bytes of ram, but it seems to be enough to get us out of the immediate bind (#14116).

On the upside it does save a good chunk of flash (nearly 1 kB).

$ make px4_io-v2_default bloaty_compare_master

     VM SIZE    
 -------------- 
  [NEW]     +12    channels_cache.7449
  [NEW]      +8    base_time.7109
  [NEW]      +8    last_mem_time.7465
  [NEW]      +4    brightness.7477
  [NEW]      +4    brightness_counter.7478
  [NEW]      +4    counter.7476
  [NEW]      +4    last_count.7110
  [NEW]      +4    new_channel_count.7087
  [NEW]      +4    new_channel_holdoff.7088
  [NEW]      +4    on_counter.7479
  [NEW]      +1    abort_on_idle.7147
  [NEW]      +1    failsafe.7178
  [NEW]      +1    heartbeat.7471
  [ = ]       0    [Unmapped]
  [ = ]       0    [section .debug_abbrev]
  [ = ]       0    [section .debug_aranges]
  [ = ]       0    [section .debug_frame]
  [ = ]       0    [section .debug_info]
  [ = ]       0    [section .debug_line]
  [ = ]       0    [section .debug_loc]
  [ = ]       0    [section .debug_ranges]
  [ = ]       0    [section .debug_str]
  [ = ]       0    [section .strtab]
  [ = ]       0    [section .symtab]
  [ = ]       0    output_limit_init
  [ = ]       0    ppm
  [DEL]      -1    abort_on_idle.7391
  [DEL]      -1    failsafe.7175
  [DEL]      -1    heartbeat.7529
  -5.7%      -4    [section .bss]
  [DEL]      -4    adc_perf
  [DEL]      -4    brightness.7535
  [DEL]      -4    brightness_counter.7536
  [DEL]      -4    c_gather_dsm
  [DEL]      -4    c_gather_ppm
  [DEL]      -4    c_gather_sbus
  [DEL]      -4    counter.7534
  [DEL]      -4    last_count.7339
  [DEL]      -4    new_channel_count.7316
  [DEL]      -4    new_channel_holdoff.7317
  [DEL]      -4    on_counter.7537
  [DEL]      -4    pc_badidle
  [DEL]      -4    pc_crcerr
  [DEL]      -4    pc_errors
  [DEL]      -4    pc_fe
  [DEL]      -4    pc_idle
  [DEL]      -4    pc_ne
  [DEL]      -4    pc_ore
  [DEL]      -4    pc_regerr
  [DEL]      -4    pc_txns
  -5.9%      -8    adc_init
  [DEL]      -8    base_time.7338
  [DEL]      -8    last_mem_time.7523
  [DEL]     -12    channels_cache.7446
  [DEL]     -22    perf_begin
 -19.4%     -28    controls_init
 -25.8%     -32    adc_measure
 -14.8%     -48    rx_dma_callback
  [DEL]     -50    perf_count
  -5.8%     -60    user_start
 -35.3%     -72    interface_init
  -5.0%     -80    controls_tick
 -40.4%     -84    serial_interrupt
  [DEL]    -196    perf_end
  [DEL]    -216    perf_count_interval
  -1.4%    -952    TOTAL

@dagar
Copy link
Member Author

dagar commented Feb 9, 2020

I'm not even sure when perf counters last worked here as perf_alloc requires pthread_mutex_lock, which isn't even available in the px4_io-v2 build. I suppose it's fine to leave it like this for now and someone can fix it in the future if actually needed.

@dagar dagar marked this pull request as ready for review February 9, 2020 19:56
@dagar
Copy link
Member Author

dagar commented Feb 9, 2020

We should also take a pass to resize the stacks.

CONFIG_IDLETHREAD_STACKSIZE=400
CONFIG_USERMAIN_STACKSIZE=1132

Update: let's review that next. #14129

/* latency histogram */
const uint16_t latency_bucket_count = LATENCY_BUCKET_COUNT;
const uint16_t latency_buckets[LATENCY_BUCKET_COUNT] = { 1, 2, 5, 10, 20, 50, 100, 1000 };
__EXPORT uint32_t latency_counters[LATENCY_BUCKET_COUNT + 1];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why + 1?

Copy link
Contributor

@sfuhrer sfuhrer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can confirm that this PR makes enough room on the IO for the convergence mixer. 40 bytes free. Thanks @dagar !

@julianoes julianoes merged commit 0d36e50 into master Feb 10, 2020
@julianoes julianoes deleted the pr-px4io_perf branch February 10, 2020 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants