profiling: Add FreePage.
Change-Id: If77bdfd16fdba39acf532706a9e8b621d88a4c96
diff --git a/src/profiling/memory/client.h b/src/profiling/memory/client.h
index a3aa5c6..7a4e459 100644
--- a/src/profiling/memory/client.h
+++ b/src/profiling/memory/client.h
@@ -18,6 +18,7 @@
#define SRC_PROFILING_MEMORY_CLIENT_H_
#include <stddef.h>
+
#include <mutex>
#include <vector>
@@ -27,6 +28,22 @@
class SocketPool;
+class FreePage {
+ public:
+ FreePage();
+
+ // Can be called from any thread. Must not hold mtx_.`
+ void Add(const uint64_t addr, SocketPool* pool);
+
+ private:
+ // Needs to be called holding mtx_.
+ void Flush(SocketPool* pool);
+
+ std::vector<uint64_t> free_page_;
+ std::mutex mtx_;
+ size_t offset_;
+};
+
class BorrowedSocket {
public:
BorrowedSocket(const BorrowedSocket&) = delete;
@@ -61,6 +78,7 @@
std::condition_variable cv_;
std::vector<base::ScopedFile> sockets_;
size_t available_sockets_;
+ size_t dead_sockets_ = 0;
};
} // namespace perfetto