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

Side by Side Diff: src/platform/metrics_daemon/metrics_daemon.h

Issue 500117: Daemonize (fork()) and install metrics_daemon in the image for execution. (Closed)
Patch Set: rename do_fork to run_as_daemon Created 11 years 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
« no previous file with comments | « src/platform/metrics_daemon/make_pkg.sh ('k') | src/platform/metrics_daemon/metrics_daemon.cc » ('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 (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS 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 METRICS_DAEMON_H_ 5 #ifndef METRICS_DAEMON_H_
6 #define METRICS_DAEMON_H_ 6 #define METRICS_DAEMON_H_
7 7
8 #include <dbus/dbus-glib.h> 8 #include <dbus/dbus-glib.h>
9 #include <sys/time.h> 9 #include <sys/time.h>
10 #include <time.h> 10 #include <time.h>
11 11
12 class MetricsDaemon { 12 class MetricsDaemon {
13 13
14 public: 14 public:
15 MetricsDaemon() 15 MetricsDaemon()
16 : network_state_id_(kUnknownNetworkStateId), metrics_fd_(-1) { 16 : network_state_id_(kUnknownNetworkStateId), metrics_fd_(-1) {
17 } 17 }
18 ~MetricsDaemon() {} 18 ~MetricsDaemon() {}
19 19
20 // Does all the work. If |testing| is true, log the stats instead of sending 20 // Does all the work. If |run_as_daemon| is true, daemonize by forking. If
21 // them to Chrome. 21 // |testing| is true, log the stats instead of sending them to Chrome.
22 void Run(bool testing); 22 void Run(bool run_as_daemon, bool testing);
23 23
24 private: 24 private:
25 // Shared with Chrome for transport. 25 // Shared with Chrome for transport.
26 static const char* kMetricsFilePath; 26 static const char* kMetricsFilePath;
27 static const int kMetricsMessageMaxLength = 4096; 27 static const int kMetricsMessageMaxLength = 4096;
28 28
29 // The network states. See network_states.h. 29 // The network states. See network_states.h.
30 typedef enum { 30 typedef enum {
31 // Initial/unknown network state id. 31 // Initial/unknown network state id.
32 kUnknownNetworkStateId = -1, 32 kUnknownNetworkStateId = -1,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Array of network states of interest. 80 // Array of network states of interest.
81 static NetworkState network_states_[kNumberNetworkStates]; 81 static NetworkState network_states_[kNumberNetworkStates];
82 82
83 bool testing_; // just testing 83 bool testing_; // just testing
84 NetworkStateId network_state_id_; // id of current state 84 NetworkStateId network_state_id_; // id of current state
85 struct timeval network_state_start_; // when current state was entered 85 struct timeval network_state_start_; // when current state was entered
86 int metrics_fd_; // for Chrome transport 86 int metrics_fd_; // for Chrome transport
87 }; 87 };
88 88
89 #endif // METRICS_DAEMON_H_ 89 #endif // METRICS_DAEMON_H_
OLDNEW
« no previous file with comments | « src/platform/metrics_daemon/make_pkg.sh ('k') | src/platform/metrics_daemon/metrics_daemon.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698