Index: third_party/protobuf/src/google/protobuf/arena.cc |
diff --git a/third_party/protobuf/src/google/protobuf/arena.cc b/third_party/protobuf/src/google/protobuf/arena.cc |
index cd0b21a7f85e79b5cf9326261723a90ebd2496cc..613e5897144151967594abc84da94bc610cb0ce2 100755 |
--- a/third_party/protobuf/src/google/protobuf/arena.cc |
+++ b/third_party/protobuf/src/google/protobuf/arena.cc |
@@ -30,6 +30,7 @@ |
#include <google/protobuf/arena.h> |
+ |
#ifdef ADDRESS_SANITIZER |
#include <sanitizer/asan_interface.h> |
#endif |
@@ -37,6 +38,7 @@ |
namespace google { |
namespace protobuf { |
+ |
google::protobuf::internal::SequenceNumber Arena::lifecycle_id_generator_; |
#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) |
Arena::ThreadCache& Arena::thread_cache() { |
@@ -247,6 +249,19 @@ uint64 Arena::SpaceUsed() const { |
return space_used; |
} |
+pair<uint64, uint64> Arena::SpaceAllocatedAndUsed() const { |
+ uint64 allocated = 0; |
+ uint64 used = 0; |
+ |
+ Block* b = reinterpret_cast<Block*>(google::protobuf::internal::NoBarrier_Load(&blocks_)); |
+ while (b != NULL) { |
+ allocated += b->size; |
+ used += (b->pos - kHeaderSize); |
+ b = b->next; |
+ } |
+ return std::make_pair(allocated, used); |
+} |
+ |
uint64 Arena::FreeBlocks() { |
uint64 space_allocated = 0; |
Block* b = reinterpret_cast<Block*>(google::protobuf::internal::NoBarrier_Load(&blocks_)); |