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 Jul 12, 2021
1 parent f86d3b8 commit 49f9b9f
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 @@ -56,6 +56,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 @@ -99,6 +99,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 49f9b9f

Please sign in to comment.