Commit 887eaa94 authored by Teng Qin's avatar Teng Qin

Close all opened CPU perf buffer (not only currently online ones)

parent db4d4267
...@@ -114,7 +114,10 @@ StatusTuple BPFPerfBuffer::close_on_cpu(int cpu) { ...@@ -114,7 +114,10 @@ StatusTuple BPFPerfBuffer::close_on_cpu(int cpu) {
StatusTuple BPFPerfBuffer::close_all_cpu() { StatusTuple BPFPerfBuffer::close_all_cpu() {
std::string errors; std::string errors;
bool has_error = false; bool has_error = false;
for (int i: get_online_cpus()) { std::vector<int> opened_cpus;
for (auto it : cpu_readers_)
opened_cpus.push_back(it.first);
for (int i : opened_cpus) {
auto res = close_on_cpu(i); auto res = close_on_cpu(i);
if (res.code() != 0) { if (res.code() != 0) {
errors += "Failed to close CPU" + std::to_string(i) + " perf buffer: "; errors += "Failed to close CPU" + std::to_string(i) + " perf buffer: ";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment