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

Unified Diff: src/log.cc

Issue 155764: Heap profiling: add logging of heap memory stats (capacity, used) under 'log-gc' flag. (Closed)
Patch Set: Created 11 years, 5 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/log.h ('k') | tools/process-heap-prof.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/log.cc
diff --git a/src/log.cc b/src/log.cc
index 16f3fb5bf81044be2147322d2442fd90291be6cf..33cf8e271affd4dcb6bd2ae6d3e53ad1ff1e8005 100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -843,12 +843,22 @@ void Logger::HeapSampleBeginEvent(const char* space, const char* kind) {
#ifdef ENABLE_LOGGING_AND_PROFILING
if (!Log::IsEnabled() || !FLAG_log_gc) return;
LogMessageBuilder msg;
- msg.Append("heap-sample-begin,\"%s\",\"%s\"", space, kind);
- uint32_t sec, usec;
- if (OS::GetUserTime(&sec, &usec) != -1) {
- msg.Append(",%d,%d", sec, usec);
- }
- msg.Append('\n');
+ // Using non-relative system time in order to be able to synchronize with
+ // external memory profiling events (e.g. DOM memory size).
+ msg.Append("heap-sample-begin,\"%s\",\"%s\",%.0f\n",
+ space, kind, OS::TimeCurrentMillis());
+ msg.WriteToLogFile();
+#endif
+}
+
+
+void Logger::HeapSampleStats(const char* space, const char* kind,
+ int capacity, int used) {
+#ifdef ENABLE_LOGGING_AND_PROFILING
+ if (!Log::IsEnabled() || !FLAG_log_gc) return;
+ LogMessageBuilder msg;
+ msg.Append("heap-sample-stats,\"%s\",\"%s\",%d,%d\n",
+ space, kind, capacity, used);
msg.WriteToLogFile();
#endif
}
« no previous file with comments | « src/log.h ('k') | tools/process-heap-prof.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698