| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/debug/trace_event_system_stats_monitor.h" | 5 #include "base/debug/trace_event_system_stats_monitor.h" |
| 6 | 6 |
| 7 #include "base/debug/leak_annotations.h" | 7 #include "base/debug/leak_annotations.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Holds profiled system stats until the tracing system needs to serialize it. | 24 // Holds profiled system stats until the tracing system needs to serialize it. |
| 25 class SystemStatsHolder : public base::debug::ConvertableToTraceFormat { | 25 class SystemStatsHolder : public base::debug::ConvertableToTraceFormat { |
| 26 public: | 26 public: |
| 27 SystemStatsHolder() { } | 27 SystemStatsHolder() { } |
| 28 | 28 |
| 29 // Fills system_metrics_ with profiled system memory and disk stats. | 29 // Fills system_metrics_ with profiled system memory and disk stats. |
| 30 // Uses the previous stats to compute rates if this is not the first profile. | 30 // Uses the previous stats to compute rates if this is not the first profile. |
| 31 void GetSystemProfilingStats(); | 31 void GetSystemProfilingStats(); |
| 32 | 32 |
| 33 // base::debug::ConvertableToTraceFormat overrides: | 33 // base::debug::ConvertableToTraceFormat overrides: |
| 34 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE { | 34 void AppendAsTraceFormat(std::string* out) const override { |
| 35 AppendSystemProfileAsTraceFormat(system_stats_, out); | 35 AppendSystemProfileAsTraceFormat(system_stats_, out); |
| 36 } | 36 } |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 virtual ~SystemStatsHolder() { } | 39 virtual ~SystemStatsHolder() { } |
| 40 | 40 |
| 41 SystemMetrics system_stats_; | 41 SystemMetrics system_stats_; |
| 42 | 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(SystemStatsHolder); | 43 DISALLOW_COPY_AND_ASSIGN(SystemStatsHolder); |
| 44 }; | 44 }; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 void AppendSystemProfileAsTraceFormat(const SystemMetrics& system_metrics, | 125 void AppendSystemProfileAsTraceFormat(const SystemMetrics& system_metrics, |
| 126 std::string* output) { | 126 std::string* output) { |
| 127 std::string tmp; | 127 std::string tmp; |
| 128 base::JSONWriter::Write(system_metrics.ToValue().get(), &tmp); | 128 base::JSONWriter::Write(system_metrics.ToValue().get(), &tmp); |
| 129 *output += tmp; | 129 *output += tmp; |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace debug | 132 } // namespace debug |
| 133 } // namespace base | 133 } // namespace base |
| OLD | NEW |