mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Clear ringbuffer after dumping to file
Clear the in-memory ringbuffer after writing to file. Bug: 193007899 Test: Manually verified ringbuffers are cleared with command "adb shell lshal debug android.hardware.wifi@1.5::IWifi" Change-Id: Icfa08634e948d7155e231458edd394a4d699fbaa
This commit is contained in:
@@ -47,6 +47,11 @@ const std::list<std::vector<uint8_t>>& Ringbuffer::getData() const {
|
||||
return data_;
|
||||
}
|
||||
|
||||
void Ringbuffer::clear() {
|
||||
data_.clear();
|
||||
size_ = 0;
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_5
|
||||
} // namespace wifi
|
||||
|
||||
@@ -37,6 +37,7 @@ class Ringbuffer {
|
||||
// within |maxSize_|.
|
||||
void append(const std::vector<uint8_t>& input);
|
||||
const std::list<std::vector<uint8_t>>& getData() const;
|
||||
void clear();
|
||||
|
||||
private:
|
||||
std::list<std::vector<uint8_t>> data_;
|
||||
|
||||
@@ -1940,8 +1940,8 @@ bool WifiChip::writeRingbufferFilesInternal() {
|
||||
// write ringbuffers to file
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(lock_t);
|
||||
for (const auto& item : ringbuffer_map_) {
|
||||
const Ringbuffer& cur_buffer = item.second;
|
||||
for (auto& item : ringbuffer_map_) {
|
||||
Ringbuffer& cur_buffer = item.second;
|
||||
if (cur_buffer.getData().empty()) {
|
||||
continue;
|
||||
}
|
||||
@@ -1959,6 +1959,7 @@ bool WifiChip::writeRingbufferFilesInternal() {
|
||||
PLOG(ERROR) << "Error writing to file";
|
||||
}
|
||||
}
|
||||
cur_buffer.clear();
|
||||
}
|
||||
// unique_lock unlocked here
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user