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

Side by Side Diff: src/log.cc

Issue 214051: Pushed 1.3.12 to trunk. (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 11 years, 2 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 | « src/log.h ('k') | src/log-utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 msg.WriteToLogFile(); 882 msg.WriteToLogFile();
883 #endif 883 #endif
884 } 884 }
885 885
886 886
887 void Logger::HeapSampleJSConstructorEvent(const char* constructor, 887 void Logger::HeapSampleJSConstructorEvent(const char* constructor,
888 int number, int bytes) { 888 int number, int bytes) {
889 #ifdef ENABLE_LOGGING_AND_PROFILING 889 #ifdef ENABLE_LOGGING_AND_PROFILING
890 if (!Log::IsEnabled() || !FLAG_log_gc) return; 890 if (!Log::IsEnabled() || !FLAG_log_gc) return;
891 LogMessageBuilder msg; 891 LogMessageBuilder msg;
892 msg.Append("heap-js-cons-item,%s,%d,%d\n", 892 msg.Append("heap-js-cons-item,%s,%d,%d\n", constructor, number, bytes);
893 constructor[0] != '\0' ? constructor : "(anonymous)",
894 number, bytes);
895 msg.WriteToLogFile(); 893 msg.WriteToLogFile();
896 #endif 894 #endif
897 } 895 }
898 896
899 897
898 void Logger::HeapSampleJSRetainersEvent(
899 const char* constructor, const char* event) {
900 #ifdef ENABLE_LOGGING_AND_PROFILING
901 if (!Log::IsEnabled() || !FLAG_log_gc) return;
902 // Event starts with comma, so we don't have it in the format string.
903 static const char* event_text = "heap-js-ret-item,%s";
904 // We take placeholder strings into account, but it's OK to be conservative.
905 static const int event_text_len = strlen(event_text);
906 const int cons_len = strlen(constructor), event_len = strlen(event);
907 int pos = 0;
908 // Retainer lists can be long. We may need to split them into multiple events.
909 do {
910 LogMessageBuilder msg;
911 msg.Append(event_text, constructor);
912 int to_write = event_len - pos;
913 if (to_write > Log::kMessageBufferSize - (cons_len + event_text_len)) {
914 int cut_pos = pos + Log::kMessageBufferSize - (cons_len + event_text_len);
915 ASSERT(cut_pos < event_len);
916 while (cut_pos > pos && event[cut_pos] != ',') --cut_pos;
917 if (event[cut_pos] != ',') {
918 // Crash in debug mode, skip in release mode.
919 ASSERT(false);
920 return;
921 }
922 // Append a piece of event that fits, without trailing comma.
923 msg.AppendStringPart(event + pos, cut_pos - pos);
924 // Start next piece with comma.
925 pos = cut_pos;
926 } else {
927 msg.Append("%s", event + pos);
928 pos += event_len;
929 }
930 msg.Append('\n');
931 msg.WriteToLogFile();
932 } while (pos < event_len);
933 #endif
934 }
935
936
900 void Logger::DebugTag(const char* call_site_tag) { 937 void Logger::DebugTag(const char* call_site_tag) {
901 #ifdef ENABLE_LOGGING_AND_PROFILING 938 #ifdef ENABLE_LOGGING_AND_PROFILING
902 if (!Log::IsEnabled() || !FLAG_log) return; 939 if (!Log::IsEnabled() || !FLAG_log) return;
903 LogMessageBuilder msg; 940 LogMessageBuilder msg;
904 msg.Append("debug-tag,%s\n", call_site_tag); 941 msg.Append("debug-tag,%s\n", call_site_tag);
905 msg.WriteToLogFile(); 942 msg.WriteToLogFile();
906 #endif 943 #endif
907 } 944 }
908 945
909 946
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 // Otherwise, if the sliding state window computation has not been 1285 // Otherwise, if the sliding state window computation has not been
1249 // started we do it now. 1286 // started we do it now.
1250 if (sliding_state_window_ == NULL) { 1287 if (sliding_state_window_ == NULL) {
1251 sliding_state_window_ = new SlidingStateWindow(); 1288 sliding_state_window_ = new SlidingStateWindow();
1252 } 1289 }
1253 #endif 1290 #endif
1254 } 1291 }
1255 1292
1256 1293
1257 } } // namespace v8::internal 1294 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.h ('k') | src/log-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698