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

Side by Side Diff: Source/platform/heap/Heap.h

Issue 1053793004: Add a UseCounter that measures the amount of memory used in PartitionAlloc (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/platform/heap/Heap.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 const GCInfo* info = s_gcInfoTable[gcInfoIndex]; 1011 const GCInfo* info = s_gcInfoTable[gcInfoIndex];
1012 ASSERT(info); 1012 ASSERT(info);
1013 return info; 1013 return info;
1014 } 1014 }
1015 1015
1016 static void increaseAllocatedObjectSize(size_t delta) { atomicAdd(&s_allocat edObjectSize, static_cast<long>(delta)); } 1016 static void increaseAllocatedObjectSize(size_t delta) { atomicAdd(&s_allocat edObjectSize, static_cast<long>(delta)); }
1017 static void decreaseAllocatedObjectSize(size_t delta) { atomicSubtract(&s_al locatedObjectSize, static_cast<long>(delta)); } 1017 static void decreaseAllocatedObjectSize(size_t delta) { atomicSubtract(&s_al locatedObjectSize, static_cast<long>(delta)); }
1018 static size_t allocatedObjectSize() { return acquireLoad(&s_allocatedObjectS ize); } 1018 static size_t allocatedObjectSize() { return acquireLoad(&s_allocatedObjectS ize); }
1019 static void increaseMarkedObjectSize(size_t delta) { atomicAdd(&s_markedObje ctSize, static_cast<long>(delta)); } 1019 static void increaseMarkedObjectSize(size_t delta) { atomicAdd(&s_markedObje ctSize, static_cast<long>(delta)); }
1020 static size_t markedObjectSize() { return acquireLoad(&s_markedObjectSize); } 1020 static size_t markedObjectSize() { return acquireLoad(&s_markedObjectSize); }
1021 static void increaseAllocatedSpace(size_t delta) 1021 static void increaseAllocatedSpace(size_t delta) { atomicAdd(&s_allocatedSpa ce, static_cast<long>(delta)); }
1022 { 1022 static void decreaseAllocatedSpace(size_t delta) { atomicSubtract(&s_allocat edSpace, static_cast<long>(delta)); }
1023 atomicAdd(&s_allocatedSpace, static_cast<long>(delta));
1024 Heap::reportMemoryUsage();
1025 }
1026 static void decreaseAllocatedSpace(size_t delta)
1027 {
1028 atomicSubtract(&s_allocatedSpace, static_cast<long>(delta));
1029 // We don't need to report memory usage here because we report the usage
1030 // only when we see the highest memory usage we've ever seen.
1031 }
1032 static size_t allocatedSpace() { return acquireLoad(&s_allocatedSpace); } 1023 static size_t allocatedSpace() { return acquireLoad(&s_allocatedSpace); }
1033 static size_t estimatedLiveObjectSize() { return acquireLoad(&s_estimatedLiv eObjectSize); } 1024 static size_t estimatedLiveObjectSize() { return acquireLoad(&s_estimatedLiv eObjectSize); }
1034 static void setEstimatedLiveObjectSize(size_t size) { releaseStore(&s_estima tedLiveObjectSize, size); } 1025 static void setEstimatedLiveObjectSize(size_t size) { releaseStore(&s_estima tedLiveObjectSize, size); }
1035 1026
1036 static double estimatedMarkingTime(); 1027 static double estimatedMarkingTime();
1037 static void reportMemoryUsage(); 1028 static void reportMemoryUsageHistogram();
1038 1029
1039 // On object allocation, register the object's externally allocated memory. 1030 // On object allocation, register the object's externally allocated memory.
1040 static void increaseExternallyAllocatedBytes(size_t); 1031 static void increaseExternallyAllocatedBytes(size_t);
1041 static size_t externallyAllocatedBytes() { return acquireLoad(&s_externallyA llocatedBytes); } 1032 static size_t externallyAllocatedBytes() { return acquireLoad(&s_externallyA llocatedBytes); }
1042 1033
1043 // On object tracing, register the object's externally allocated memory (as still live.) 1034 // On object tracing, register the object's externally allocated memory (as still live.)
1044 static void increaseExternallyAllocatedBytesAlive(size_t delta) 1035 static void increaseExternallyAllocatedBytesAlive(size_t delta)
1045 { 1036 {
1046 ASSERT(ThreadState::current()->isInGC()); 1037 ASSERT(ThreadState::current()->isInGC());
1047 s_externallyAllocatedBytesAlive += delta; 1038 s_externallyAllocatedBytesAlive += delta;
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2551 template<typename T, size_t inlineCapacity> 2542 template<typename T, size_t inlineCapacity>
2552 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T, inlineCapacity, HeapAllocator>> { }; 2543 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T, inlineCapacity, HeapAllocator>> { };
2553 template<typename T, size_t inlineCapacity> 2544 template<typename T, size_t inlineCapacity>
2554 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i nlineCapacity, HeapAllocator>> { }; 2545 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i nlineCapacity, HeapAllocator>> { };
2555 template<typename T, typename U, typename V> 2546 template<typename T, typename U, typename V>
2556 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted Set<T, U, V, HeapAllocator>> { }; 2547 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted Set<T, U, V, HeapAllocator>> { };
2557 2548
2558 } // namespace blink 2549 } // namespace blink
2559 2550
2560 #endif // Heap_h 2551 #endif // Heap_h
OLDNEW
« no previous file with comments | « no previous file | Source/platform/heap/Heap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698