| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 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> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 // This is called at each network state change. The new state is identified | 57 // This is called at each network state change. The new state is identified |
| 58 // by the string @newstate. As a side effect, this method ships to Chrome | 58 // by the string @newstate. As a side effect, this method ships to Chrome |
| 59 // (or prints to stdout when testing) the name and duration of the state | 59 // (or prints to stdout when testing) the name and duration of the state |
| 60 // that has ended. | 60 // that has ended. |
| 61 void LogNetworkStateChange(const char* newstate); | 61 void LogNetworkStateChange(const char* newstate); |
| 62 | 62 |
| 63 // Given a string with the name of a state, returns the id for the state. | 63 // Given a string with the name of a state, returns the id for the state. |
| 64 NetworkStateId GetNetworkStateId(const char* state_name); | 64 NetworkStateId GetNetworkStateId(const char* state_name); |
| 65 | 65 |
| 66 // Sends a stat to Chrome for transport to UMA. | 66 // Sends a stat to Chrome for transport to UMA (or prints it for |
| 67 void ChromePublishMetric(const char* name, int value); | 67 // testing). See MetricsLibrary::SendToChrome in metrics_library.h |
| 68 | 68 // for a description of the arguments. |
| 69 // Prints a stat for testing. | 69 void PublishMetric(const char* name, int sample, |
| 70 void TestPublishMetric(const char* name, int value); | 70 int min, int max, int nbuckets); |
| 71 | 71 |
| 72 #if 0 | 72 #if 0 |
| 73 // Fetches a name-value hash table from DBus. | 73 // Fetches a name-value hash table from DBus. |
| 74 bool GetProperties(::DBusGProxy* proxy, ::GHashTable** table); | 74 bool GetProperties(::DBusGProxy* proxy, ::GHashTable** table); |
| 75 | 75 |
| 76 // The type descriptor for a glib hash table. | 76 // The type descriptor for a glib hash table. |
| 77 GType hashtable_gtype; | 77 GType hashtable_gtype; |
| 78 #endif | 78 #endif |
| 79 | 79 |
| 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 }; | 86 }; |
| 87 | 87 |
| 88 #endif // METRICS_DAEMON_H_ | 88 #endif // METRICS_DAEMON_H_ |
| OLD | NEW |