OLD | NEW |
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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 msg.Append('\n'); | 836 msg.Append('\n'); |
837 msg.WriteToLogFile(); | 837 msg.WriteToLogFile(); |
838 #endif | 838 #endif |
839 } | 839 } |
840 | 840 |
841 | 841 |
842 void Logger::HeapSampleBeginEvent(const char* space, const char* kind) { | 842 void Logger::HeapSampleBeginEvent(const char* space, const char* kind) { |
843 #ifdef ENABLE_LOGGING_AND_PROFILING | 843 #ifdef ENABLE_LOGGING_AND_PROFILING |
844 if (!Log::IsEnabled() || !FLAG_log_gc) return; | 844 if (!Log::IsEnabled() || !FLAG_log_gc) return; |
845 LogMessageBuilder msg; | 845 LogMessageBuilder msg; |
846 msg.Append("heap-sample-begin,\"%s\",\"%s\"", space, kind); | 846 // Using non-relative system time in order to be able to synchronize with |
847 uint32_t sec, usec; | 847 // external memory profiling events (e.g. DOM memory size). |
848 if (OS::GetUserTime(&sec, &usec) != -1) { | 848 msg.Append("heap-sample-begin,\"%s\",\"%s\",%.0f\n", |
849 msg.Append(",%d,%d", sec, usec); | 849 space, kind, OS::TimeCurrentMillis()); |
850 } | |
851 msg.Append('\n'); | |
852 msg.WriteToLogFile(); | 850 msg.WriteToLogFile(); |
853 #endif | 851 #endif |
854 } | 852 } |
| 853 |
| 854 |
| 855 void Logger::HeapSampleStats(const char* space, const char* kind, |
| 856 int capacity, int used) { |
| 857 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 858 if (!Log::IsEnabled() || !FLAG_log_gc) return; |
| 859 LogMessageBuilder msg; |
| 860 msg.Append("heap-sample-stats,\"%s\",\"%s\",%d,%d\n", |
| 861 space, kind, capacity, used); |
| 862 msg.WriteToLogFile(); |
| 863 #endif |
| 864 } |
855 | 865 |
856 | 866 |
857 void Logger::HeapSampleEndEvent(const char* space, const char* kind) { | 867 void Logger::HeapSampleEndEvent(const char* space, const char* kind) { |
858 #ifdef ENABLE_LOGGING_AND_PROFILING | 868 #ifdef ENABLE_LOGGING_AND_PROFILING |
859 if (!Log::IsEnabled() || !FLAG_log_gc) return; | 869 if (!Log::IsEnabled() || !FLAG_log_gc) return; |
860 LogMessageBuilder msg; | 870 LogMessageBuilder msg; |
861 msg.Append("heap-sample-end,\"%s\",\"%s\"\n", space, kind); | 871 msg.Append("heap-sample-end,\"%s\",\"%s\"\n", space, kind); |
862 msg.WriteToLogFile(); | 872 msg.WriteToLogFile(); |
863 #endif | 873 #endif |
864 } | 874 } |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 // Otherwise, if the sliding state window computation has not been | 1210 // Otherwise, if the sliding state window computation has not been |
1201 // started we do it now. | 1211 // started we do it now. |
1202 if (sliding_state_window_ == NULL) { | 1212 if (sliding_state_window_ == NULL) { |
1203 sliding_state_window_ = new SlidingStateWindow(); | 1213 sliding_state_window_ = new SlidingStateWindow(); |
1204 } | 1214 } |
1205 #endif | 1215 #endif |
1206 } | 1216 } |
1207 | 1217 |
1208 | 1218 |
1209 } } // namespace v8::internal | 1219 } } // namespace v8::internal |
OLD | NEW |