Merge "Clear ringbuffer after dumping to file" into sc-dev
This commit is contained in:
commit
45cb33bf7a
3 changed files with 9 additions and 2 deletions
|
@ -47,6 +47,11 @@ const std::list<std::vector<uint8_t>>& Ringbuffer::getData() const {
|
||||||
return data_;
|
return data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ringbuffer::clear() {
|
||||||
|
data_.clear();
|
||||||
|
size_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace implementation
|
} // namespace implementation
|
||||||
} // namespace V1_5
|
} // namespace V1_5
|
||||||
} // namespace wifi
|
} // namespace wifi
|
||||||
|
|
|
@ -37,6 +37,7 @@ class Ringbuffer {
|
||||||
// within |maxSize_|.
|
// within |maxSize_|.
|
||||||
void append(const std::vector<uint8_t>& input);
|
void append(const std::vector<uint8_t>& input);
|
||||||
const std::list<std::vector<uint8_t>>& getData() const;
|
const std::list<std::vector<uint8_t>>& getData() const;
|
||||||
|
void clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::list<std::vector<uint8_t>> data_;
|
std::list<std::vector<uint8_t>> data_;
|
||||||
|
|
|
@ -1948,8 +1948,8 @@ bool WifiChip::writeRingbufferFilesInternal() {
|
||||||
// write ringbuffers to file
|
// write ringbuffers to file
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lk(lock_t);
|
std::unique_lock<std::mutex> lk(lock_t);
|
||||||
for (const auto& item : ringbuffer_map_) {
|
for (auto& item : ringbuffer_map_) {
|
||||||
const Ringbuffer& cur_buffer = item.second;
|
Ringbuffer& cur_buffer = item.second;
|
||||||
if (cur_buffer.getData().empty()) {
|
if (cur_buffer.getData().empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1967,6 +1967,7 @@ bool WifiChip::writeRingbufferFilesInternal() {
|
||||||
PLOG(ERROR) << "Error writing to file";
|
PLOG(ERROR) << "Error writing to file";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cur_buffer.clear();
|
||||||
}
|
}
|
||||||
// unique_lock unlocked here
|
// unique_lock unlocked here
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue