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

Side by Side Diff: base/trace_event/trace_event_system_stats_monitor.h

Issue 869043008: Reland of Move tracing namespace from base::debug to base::trace_event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Fix suppressions Created 5 years, 10 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
OLDNEW
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 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_SYSTEM_STATS_MONITOR_H_ 5 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_SYSTEM_STATS_MONITOR_H_
6 #define BASE_TRACE_EVENT_TRACE_EVENT_SYSTEM_STATS_MONITOR_H_ 6 #define BASE_TRACE_EVENT_TRACE_EVENT_SYSTEM_STATS_MONITOR_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/process/process_metrics.h" 12 #include "base/process/process_metrics.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "base/trace_event/trace_event_impl.h" 14 #include "base/trace_event/trace_event_impl.h"
15 15
16 namespace base { 16 namespace base {
17 17
18 class SingleThreadTaskRunner; 18 class SingleThreadTaskRunner;
19 19
20 namespace debug { 20 namespace trace_event {
21 21
22 // Watches for chrome://tracing to be enabled or disabled. When tracing is 22 // Watches for chrome://tracing to be enabled or disabled. When tracing is
23 // enabled, also enables system events profiling. This class is the preferred 23 // enabled, also enables system events profiling. This class is the preferred
24 // way to turn system tracing on and off. 24 // way to turn system tracing on and off.
25 class BASE_EXPORT TraceEventSystemStatsMonitor 25 class BASE_EXPORT TraceEventSystemStatsMonitor
26 : public TraceLog::EnabledStateObserver { 26 : public TraceLog::EnabledStateObserver {
27 public: 27 public:
28 // Length of time interval between stat profiles. 28 // Length of time interval between stat profiles.
29 static const int kSamplingIntervalMilliseconds = 2000; 29 static const int kSamplingIntervalMilliseconds = 2000;
30 30
31 // |task_runner| must be the primary thread for the client 31 // |task_runner| must be the primary thread for the client
32 // process, e.g. the UI thread in a browser. 32 // process, e.g. the UI thread in a browser.
33 explicit TraceEventSystemStatsMonitor( 33 explicit TraceEventSystemStatsMonitor(
34 scoped_refptr<SingleThreadTaskRunner> task_runner); 34 scoped_refptr<SingleThreadTaskRunner> task_runner);
35 35
36 virtual ~TraceEventSystemStatsMonitor(); 36 virtual ~TraceEventSystemStatsMonitor();
37 37
38 // base::debug::TraceLog::EnabledStateChangedObserver overrides: 38 // base::trace_event::TraceLog::EnabledStateChangedObserver overrides:
39 void OnTraceLogEnabled() override; 39 void OnTraceLogEnabled() override;
40 void OnTraceLogDisabled() override; 40 void OnTraceLogDisabled() override;
41 41
42 // Retrieves system profiling at the current time. 42 // Retrieves system profiling at the current time.
43 void DumpSystemStats(); 43 void DumpSystemStats();
44 44
45 private: 45 private:
46 FRIEND_TEST_ALL_PREFIXES(TraceSystemStatsMonitorTest, 46 FRIEND_TEST_ALL_PREFIXES(TraceSystemStatsMonitorTest,
47 TraceEventSystemStatsMonitor); 47 TraceEventSystemStatsMonitor);
48 48
(...skipping 13 matching lines...) Expand all
62 62
63 DISALLOW_COPY_AND_ASSIGN(TraceEventSystemStatsMonitor); 63 DISALLOW_COPY_AND_ASSIGN(TraceEventSystemStatsMonitor);
64 }; 64 };
65 65
66 // Converts system memory profiling stats in |input| to 66 // Converts system memory profiling stats in |input| to
67 // trace event compatible JSON and appends to |output|. Visible for testing. 67 // trace event compatible JSON and appends to |output|. Visible for testing.
68 BASE_EXPORT void AppendSystemProfileAsTraceFormat(const SystemMetrics& 68 BASE_EXPORT void AppendSystemProfileAsTraceFormat(const SystemMetrics&
69 system_stats, 69 system_stats,
70 std::string* output); 70 std::string* output);
71 71
72 } // namespace debug 72 } // namespace trace_event
73 } // namespace base 73 } // namespace base
74 74
75 #endif // BASE_TRACE_EVENT_TRACE_EVENT_SYSTEM_STATS_MONITOR_H_ 75 #endif // BASE_TRACE_EVENT_TRACE_EVENT_SYSTEM_STATS_MONITOR_H_
OLDNEW
« no previous file with comments | « base/trace_event/trace_event_synthetic_delay_unittest.cc ('k') | base/trace_event/trace_event_system_stats_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698