need advice to implement blocking ring buffer

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: need advice to implement blocking ring buffer

Post by Giovanni »

... there are still problems, I need to rethink the approach.

Giovanni
User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

Re: need advice to implement blocking ring buffer

Post by alex31 »

... there are still problems, I need to rethink the approach.


I just connect to the forum to say that it was working for me now, but apparently, not completely ...

what kind of problems have you detected with the present code ?

Alexandre
User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

Re: need advice to implement blocking ring buffer

Post by alex31 »

Only problem that i see for now is a performance problem, using 32 bytes buffers, random length read write, i bench 250kb/s witch chPipes, and 350 kb/s with mine on stm32f4 (-O0, -g) , otherwise, seems to work.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: need advice to implement blocking ring buffer

Post by Giovanni »

Hi,

I already made changes, you probably tested the latest code which corrected the problem I mentioned.

It still requires better tests, good to know it is working on your side anyway.

Performance may benefit from a larger buffer, it is mostly memcpy() anyway. It could improve by using critical zones instead of mutexes but that would have other undesirable side effects.

Giovanni
Post Reply