Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Unified Diff: src/base/accounting-allocator.h

Issue 2050173002: [DoNotSubmit] Added peak_memory_size to accounting-allocator. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.cc ('k') | src/base/accounting-allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/base/accounting-allocator.h
diff --git a/src/base/accounting-allocator.h b/src/base/accounting-allocator.h
index ce67f3790ef846a02f09b12101cfbf9fbcd29f59..1f26529b097af4fab2bc644f0f0be05f45b9b102 100644
--- a/src/base/accounting-allocator.h
+++ b/src/base/accounting-allocator.h
@@ -5,6 +5,7 @@
#ifndef V8_BASE_ACCOUNTING_ALLOCATOR_H_
#define V8_BASE_ACCOUNTING_ALLOCATOR_H_
+#include "src/base/platform/mutex.h"
#include "src/base/atomicops.h"
#include "src/base/macros.h"
@@ -13,17 +14,20 @@ namespace base {
class AccountingAllocator final {
public:
- AccountingAllocator() = default;
- ~AccountingAllocator() = default;
+ AccountingAllocator() {}
+ ~AccountingAllocator() {}
// Returns nullptr on failed allocation.
void* Allocate(size_t bytes);
void Free(void* memory, size_t bytes);
size_t GetCurrentMemoryUsage() const;
+ size_t GetPeakMemoryUsage() const;
private:
- AtomicWord current_memory_usage_ = 0;
+ size_t current_memory_usage_ = 0;
+ size_t peak_memory_usage_ = 0;
+ Mutex mutex_;
DISALLOW_COPY_AND_ASSIGN(AccountingAllocator);
};
« no previous file with comments | « src/api.cc ('k') | src/base/accounting-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698