Skip to content

Commit

Permalink
AP_HAL: add statistics to RingBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Mar 25, 2024
1 parent cdd6b68 commit f94c335
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions libraries/AP_HAL/utility/RingBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ uint32_t ByteBuffer::available(void) const
void ByteBuffer::clear(void)
{
head = tail = 0;
// stats.clear(0);
}

uint32_t ByteBuffer::space(void) const
Expand Down
12 changes: 12 additions & 0 deletions libraries/AP_HAL/utility/RingBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ class ByteBuffer {
std::atomic<uint32_t> tail{0}; // where to write data

bool external_buf;

// struct Stats {
// void clear(uint32_t _available) {
// written = 0;
// read = 0;
// size_min = size_max = _available;
// }
// uint32_t size_min;
// uint32_t size_max;
// uint32_t written;
// uint32_t read;
// } stats;
};

/*
Expand Down

0 comments on commit f94c335

Please sign in to comment.