Speed profiling using hal_serial_usb Topic is solved

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
sabdulqadir
Posts: 12
Joined: Fri Mar 23, 2018 7:29 pm
Has thanked: 6 times
Been thanked: 2 times

Speed profiling using hal_serial_usb  Topic is solved

Postby sabdulqadir » Wed Nov 07, 2018 7:54 pm

Hi All,
I have been testing the speed on hal_serial_usb, testing with different size for SERIAL_USB_BUFFERS_SIZE, SERIAL_USB_BUFFERS_NUMBER and the size of buffer which goes in chnWrite(&SDU2, (const uint8_t *)&test_buff, TEST_BUFFER_SIZE).
I realized what matters most is SERIAL_USB_BUFFERS_SIZE. I was able to squeeze 19MB/s from running the driver alone on STM32F723.

But there was one more parameter which changed the speed substantially to 29MB/s. That was increasing the size check in obqWriteTimeout() [hal_buffers.c]

Code: Select all

    /* Smaller chunks in order to not make the critical zone too long,
       this impacts throughput however.*/
    if (size > 64U) {
      /* Giving the compiler a chance to optimize for a fixed size move.*/
      memcpy(obqp->ptr, bp, 64U);
      bp        += 64U;
      obqp->ptr += 64U;
      w         += 64U;
    }

Do you guys think this parameter should be exposed so that it can be fine-tuned?

Thanks,
AQ
Last edited by sabdulqadir on Wed Nov 07, 2018 8:57 pm, edited 4 times in total.

User avatar
Giovanni
Site Admin
Posts: 11476
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 451 times
Been thanked: 375 times
Contact:

Re: Speed profiling using hal_serial_usb

Postby Giovanni » Wed Nov 07, 2018 8:27 pm

Hi,

Thanks for testing, probably yes, it should be exposed, moving this topic in "change request".

Giovanni

User avatar
Giovanni
Site Admin
Posts: 11476
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 451 times
Been thanked: 375 times
Contact:

Re: Speed profiling using hal_serial_usb

Postby Giovanni » Sun Dec 02, 2018 4:08 pm

Hi,

A new setting has been added: BUFFERS_CHUNKS_SIZE. It applies to both obqWriteTimeout() and ibqReadTimeout(). The default is still 64.

Giovanni

sabdulqadir
Posts: 12
Joined: Fri Mar 23, 2018 7:29 pm
Has thanked: 6 times
Been thanked: 2 times

Re: Speed profiling using hal_serial_usb

Postby sabdulqadir » Fri Dec 14, 2018 10:24 pm

Thanks Giovanni,
I do have a concern though. Should this change be pulled out to the configuration files? That way, the application would be able to fine tune this parameter.

Thanks,
AQ

User avatar
Giovanni
Site Admin
Posts: 11476
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 451 times
Been thanked: 375 times
Contact:

Re: Speed profiling using hal_serial_usb

Postby Giovanni » Sat Dec 15, 2018 7:47 am

Hi,

You can put that definition in halconf.h, uncommon settings are not usually present in configuration files in order to keep those not too complex. You may recommend different defaults after your testing.

Giovanni


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 1 guest