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

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

Issue 1301463002: Conditionally bail out earlier in Heap::reportMemoryUsageForTracing() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 | no next file » | 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 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2393 if (sizeInMB > observedMaxSizeInMB) { 2393 if (sizeInMB > observedMaxSizeInMB) {
2394 // Send a UseCounter only when we see the highest memory usage 2394 // Send a UseCounter only when we see the highest memory usage
2395 // we've ever seen. 2395 // we've ever seen.
2396 Platform::current()->histogramEnumeration("BlinkGC.CommittedSize", sizeI nMB, supportedMaxSizeInMB); 2396 Platform::current()->histogramEnumeration("BlinkGC.CommittedSize", sizeI nMB, supportedMaxSizeInMB);
2397 observedMaxSizeInMB = sizeInMB; 2397 observedMaxSizeInMB = sizeInMB;
2398 } 2398 }
2399 } 2399 }
2400 2400
2401 void Heap::reportMemoryUsageForTracing() 2401 void Heap::reportMemoryUsageForTracing()
2402 { 2402 {
2403 bool gcTracingEnabled;
2404 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink_gc", &gcTracingEnabled);
2405 if (!gcTracingEnabled)
2406 return;
2407
2403 // These values are divided by 1024 to avoid overflow in practical cases (TR ACE_COUNTER values are 32-bit ints). 2408 // These values are divided by 1024 to avoid overflow in practical cases (TR ACE_COUNTER values are 32-bit ints).
2404 // They are capped to INT_MAX just in case. 2409 // They are capped to INT_MAX just in case.
2405 TRACE_COUNTER1("blink_gc", "Heap::allocatedObjectSizeKB", std::min(Heap::all ocatedObjectSize() / 1024, static_cast<size_t>(INT_MAX))); 2410 TRACE_COUNTER1("blink_gc", "Heap::allocatedObjectSizeKB", std::min(Heap::all ocatedObjectSize() / 1024, static_cast<size_t>(INT_MAX)));
2406 TRACE_COUNTER1("blink_gc", "Heap::markedObjectSizeKB", std::min(Heap::marked ObjectSize() / 1024, static_cast<size_t>(INT_MAX))); 2411 TRACE_COUNTER1("blink_gc", "Heap::markedObjectSizeKB", std::min(Heap::marked ObjectSize() / 1024, static_cast<size_t>(INT_MAX)));
2407 TRACE_COUNTER1("blink_gc", "Heap::allocatedSpaceKB", std::min(Heap::allocate dSpace() / 1024, static_cast<size_t>(INT_MAX))); 2412 TRACE_COUNTER1("blink_gc", "Heap::allocatedSpaceKB", std::min(Heap::allocate dSpace() / 1024, static_cast<size_t>(INT_MAX)));
2408 TRACE_COUNTER1("blink_gc", "Heap::objectSizeAtLastGCKB", std::min(Heap::obje ctSizeAtLastGC() / 1024, static_cast<size_t>(INT_MAX))); 2413 TRACE_COUNTER1("blink_gc", "Heap::objectSizeAtLastGCKB", std::min(Heap::obje ctSizeAtLastGC() / 1024, static_cast<size_t>(INT_MAX)));
2409 TRACE_COUNTER1("blink_gc", "Heap::persistentCount", std::min(Heap::persisten tCount(), static_cast<size_t>(INT_MAX))); 2414 TRACE_COUNTER1("blink_gc", "Heap::persistentCount", std::min(Heap::persisten tCount(), static_cast<size_t>(INT_MAX)));
2410 TRACE_COUNTER1("blink_gc", "Heap::persistentCountAtLastGC", std::min(Heap::p ersistentCountAtLastGC(), static_cast<size_t>(INT_MAX))); 2415 TRACE_COUNTER1("blink_gc", "Heap::persistentCountAtLastGC", std::min(Heap::p ersistentCountAtLastGC(), static_cast<size_t>(INT_MAX)));
2411 TRACE_COUNTER1("blink_gc", "Heap::collectedPersistentCount", std::min(Heap:: collectedPersistentCount(), static_cast<size_t>(INT_MAX))); 2416 TRACE_COUNTER1("blink_gc", "Heap::collectedPersistentCount", std::min(Heap:: collectedPersistentCount(), static_cast<size_t>(INT_MAX)));
2412 TRACE_COUNTER1("blink_gc", "Heap::heapSizePerPersistent", std::min(Heap::hea pSizePerPersistent(), static_cast<size_t>(INT_MAX))); 2417 TRACE_COUNTER1("blink_gc", "Heap::heapSizePerPersistent", std::min(Heap::hea pSizePerPersistent(), static_cast<size_t>(INT_MAX)));
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2548 size_t Heap::s_objectSizeAtLastGC = 0; 2553 size_t Heap::s_objectSizeAtLastGC = 0;
2549 size_t Heap::s_markedObjectSize = 0; 2554 size_t Heap::s_markedObjectSize = 0;
2550 size_t Heap::s_persistentCount = 0; 2555 size_t Heap::s_persistentCount = 0;
2551 size_t Heap::s_persistentCountAtLastGC = 0; 2556 size_t Heap::s_persistentCountAtLastGC = 0;
2552 size_t Heap::s_collectedPersistentCount = 0; 2557 size_t Heap::s_collectedPersistentCount = 0;
2553 size_t Heap::s_partitionAllocSizeAtLastGC = 0; 2558 size_t Heap::s_partitionAllocSizeAtLastGC = 0;
2554 size_t Heap::s_heapSizePerPersistent = 0; 2559 size_t Heap::s_heapSizePerPersistent = 0;
2555 double Heap::s_estimatedMarkingTimePerByte = 0.0; 2560 double Heap::s_estimatedMarkingTimePerByte = 0.0;
2556 2561
2557 } // namespace blink 2562 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698