blob: 5ccc69487e6ed86b4b6df5a954a1950fb1b4195a [file] [log] [blame]
Darin Petkov65b01462010-04-14 13:32:20 -07001// 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
3// found in the LICENSE file.
4
5#include "metrics_daemon.h"
Darin Petkov65b01462010-04-14 13:32:20 -07006
Darin Petkov703ec972010-04-27 11:02:18 -07007#include <dbus/dbus-glib-lowlevel.h>
Darin Petkov41e06232010-05-03 16:45:37 -07008#include <sys/file.h>
Darin Petkov65b01462010-04-14 13:32:20 -07009
Darin Petkov41e06232010-05-03 16:45:37 -070010#include <base/eintr_wrapper.h>
Darin Petkov65b01462010-04-14 13:32:20 -070011#include <base/logging.h>
12
Darin Petkovf27f0362010-06-04 13:14:19 -070013using base::Time;
14using base::TimeDelta;
15using base::TimeTicks;
16
Darin Petkov703ec972010-04-27 11:02:18 -070017#define SAFE_MESSAGE(e) (e.message ? e.message : "unknown error")
Darin Petkove3348402010-06-04 14:07:41 -070018#define DBUS_IFACE_FLIMFLAM_MANAGER "org.chromium.flimflam.Manager"
David James6bf6e252010-06-06 18:52:40 -070019#define DBUS_IFACE_POWER_MANAGER "org.chromium.PowerManager"
Darin Petkov41e06232010-05-03 16:45:37 -070020#define DBUS_IFACE_SESSION_MANAGER "org.chromium.SessionManagerInterface"
21
22// File to aggregate daily usage before sending to UMA.
23// TODO(petkov): This file should probably live in a user-specific stateful
24// location, e.g., /home/chronos/user.
25static const char kDailyUseRecordFile[] = "/var/log/metrics/daily-usage";
26
27static const int kSecondsPerMinute = 60;
28static const int kMinutesPerHour = 60;
29static const int kHoursPerDay = 24;
30static const int kMinutesPerDay = kHoursPerDay * kMinutesPerHour;
Darin Petkov41e06232010-05-03 16:45:37 -070031
32// The daily use monitor is scheduled to a 1-minute interval after
33// initial user activity and then it's exponentially backed off to
34// 10-minute intervals. Although not required, the back off is
35// implemented because the histogram buckets are spaced exponentially
36// anyway and to avoid too frequent metrics daemon process wake-ups
37// and file I/O.
38static const int kUseMonitorIntervalInit = 1 * kSecondsPerMinute;
39static const int kUseMonitorIntervalMax = 10 * kSecondsPerMinute;
Darin Petkov65b01462010-04-14 13:32:20 -070040
Darin Petkov2ccef012010-05-05 16:06:37 -070041// static metrics parameters.
42const char MetricsDaemon::kMetricDailyUseTimeName[] =
43 "Logging.DailyUseTime";
44const int MetricsDaemon::kMetricDailyUseTimeMin = 1;
45const int MetricsDaemon::kMetricDailyUseTimeMax = kMinutesPerDay;
46const int MetricsDaemon::kMetricDailyUseTimeBuckets = 50;
47
48const char MetricsDaemon::kMetricTimeToNetworkDropName[] =
49 "Network.TimeToDrop";
50const int MetricsDaemon::kMetricTimeToNetworkDropMin = 1;
51const int MetricsDaemon::kMetricTimeToNetworkDropMax =
52 8 /* hours */ * kMinutesPerHour * kSecondsPerMinute;
53const int MetricsDaemon::kMetricTimeToNetworkDropBuckets = 50;
54
Darin Petkov703ec972010-04-27 11:02:18 -070055// static
Darin Petkov41e06232010-05-03 16:45:37 -070056const char* MetricsDaemon::kDBusMatches_[] = {
Darin Petkov703ec972010-04-27 11:02:18 -070057 "type='signal',"
Darin Petkove3348402010-06-04 14:07:41 -070058 "sender='org.chromium.flimflam',"
59 "interface='" DBUS_IFACE_FLIMFLAM_MANAGER "',"
Darin Petkov703ec972010-04-27 11:02:18 -070060 "path='/',"
61 "member='StateChanged'",
62
63 "type='signal',"
64 "interface='" DBUS_IFACE_POWER_MANAGER "',"
David James6bf6e252010-06-06 18:52:40 -070065 "path='/'"
Darin Petkov41e06232010-05-03 16:45:37 -070066
67 "type='signal',"
68 "sender='org.chromium.SessionManager',"
69 "interface='" DBUS_IFACE_SESSION_MANAGER "',"
70 "path='/org/chromium/SessionManager',"
71 "member='SessionStateChanged'",
Darin Petkov703ec972010-04-27 11:02:18 -070072};
73
74// static
Darin Petkov41e06232010-05-03 16:45:37 -070075const char* MetricsDaemon::kNetworkStates_[] = {
Darin Petkov703ec972010-04-27 11:02:18 -070076#define STATE(name, capname) #name,
Darin Petkov65b01462010-04-14 13:32:20 -070077#include "network_states.h"
78};
79
Darin Petkov703ec972010-04-27 11:02:18 -070080// static
Darin Petkov41e06232010-05-03 16:45:37 -070081const char* MetricsDaemon::kPowerStates_[] = {
Darin Petkov703ec972010-04-27 11:02:18 -070082#define STATE(name, capname) #name,
83#include "power_states.h"
84};
85
Darin Petkov41e06232010-05-03 16:45:37 -070086// static
Darin Petkov41e06232010-05-03 16:45:37 -070087const char* MetricsDaemon::kSessionStates_[] = {
88#define STATE(name, capname) #name,
89#include "session_states.h"
90};
91
Darin Petkov2ccef012010-05-05 16:06:37 -070092void MetricsDaemon::Run(bool run_as_daemon) {
Darin Petkov65b01462010-04-14 13:32:20 -070093 if (!run_as_daemon || daemon(0, 0) == 0) {
94 Loop();
95 }
96}
97
Darin Petkovfc91b422010-05-12 13:05:45 -070098void MetricsDaemon::Init(bool testing, MetricsLibraryInterface* metrics_lib) {
Darin Petkov65b01462010-04-14 13:32:20 -070099 testing_ = testing;
Darin Petkovfc91b422010-05-12 13:05:45 -0700100 DCHECK(metrics_lib != NULL);
101 metrics_lib_ = metrics_lib;
Darin Petkov2ccef012010-05-05 16:06:37 -0700102 daily_use_record_file_ = kDailyUseRecordFile;
103
104 // Don't setup D-Bus and GLib in test mode.
105 if (testing)
106 return;
Darin Petkov65b01462010-04-14 13:32:20 -0700107
Darin Petkov703ec972010-04-27 11:02:18 -0700108 g_thread_init(NULL);
109 g_type_init();
110 dbus_g_thread_init();
Darin Petkov65b01462010-04-14 13:32:20 -0700111
Darin Petkov703ec972010-04-27 11:02:18 -0700112 DBusError error;
113 dbus_error_init(&error);
Darin Petkov65b01462010-04-14 13:32:20 -0700114
David James3b3add52010-06-04 15:01:19 -0700115 DBusConnection* connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
Darin Petkov703ec972010-04-27 11:02:18 -0700116 LOG_IF(FATAL, dbus_error_is_set(&error)) <<
117 "No D-Bus connection: " << SAFE_MESSAGE(error);
Darin Petkov65b01462010-04-14 13:32:20 -0700118
Darin Petkov703ec972010-04-27 11:02:18 -0700119 dbus_connection_setup_with_g_main(connection, NULL);
Darin Petkov65b01462010-04-14 13:32:20 -0700120
Darin Petkov703ec972010-04-27 11:02:18 -0700121 // Registers D-Bus matches for the signals we would like to catch.
David James3b3add52010-06-04 15:01:19 -0700122 for (unsigned int m = 0; m < sizeof(kDBusMatches_) / sizeof(char*); m++) {
Darin Petkov41e06232010-05-03 16:45:37 -0700123 const char* match = kDBusMatches_[m];
124 DLOG(INFO) << "adding dbus match: " << match;
Darin Petkov703ec972010-04-27 11:02:18 -0700125 dbus_bus_add_match(connection, match, &error);
126 LOG_IF(FATAL, dbus_error_is_set(&error)) <<
127 "unable to add a match: " << SAFE_MESSAGE(error);
128 }
129
130 // Adds the D-Bus filter routine to be called back whenever one of
131 // the registered D-Bus matches is successful. The daemon is not
132 // activated for D-Bus messages that don't match.
133 CHECK(dbus_connection_add_filter(connection, MessageFilter, this, NULL));
Darin Petkov65b01462010-04-14 13:32:20 -0700134}
135
136void MetricsDaemon::Loop() {
Darin Petkov703ec972010-04-27 11:02:18 -0700137 GMainLoop* loop = g_main_loop_new(NULL, false);
138 g_main_loop_run(loop);
Darin Petkov65b01462010-04-14 13:32:20 -0700139}
140
Darin Petkov703ec972010-04-27 11:02:18 -0700141// static
142DBusHandlerResult MetricsDaemon::MessageFilter(DBusConnection* connection,
143 DBusMessage* message,
144 void* user_data) {
Darin Petkovf27f0362010-06-04 13:14:19 -0700145 Time now = Time::Now();
146 TimeTicks ticks = TimeTicks::Now();
147 DLOG(INFO) << "message intercepted @ " << now.ToInternalValue();
Darin Petkov703ec972010-04-27 11:02:18 -0700148
149 int message_type = dbus_message_get_type(message);
150 if (message_type != DBUS_MESSAGE_TYPE_SIGNAL) {
Darin Petkov41e06232010-05-03 16:45:37 -0700151 DLOG(WARNING) << "unexpected message type " << message_type;
Darin Petkov703ec972010-04-27 11:02:18 -0700152 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
153 }
154
155 // Signal messages always have interfaces.
156 const char* interface = dbus_message_get_interface(message);
157 CHECK(interface != NULL);
158
159 MetricsDaemon* daemon = static_cast<MetricsDaemon*>(user_data);
160
161 DBusMessageIter iter;
162 dbus_message_iter_init(message, &iter);
Darin Petkove3348402010-06-04 14:07:41 -0700163 if (strcmp(interface, DBUS_IFACE_FLIMFLAM_MANAGER) == 0) {
Darin Petkov41e06232010-05-03 16:45:37 -0700164 CHECK(strcmp(dbus_message_get_member(message),
165 "StateChanged") == 0);
Darin Petkov703ec972010-04-27 11:02:18 -0700166
David James3b3add52010-06-04 15:01:19 -0700167 char* state_name;
Darin Petkov703ec972010-04-27 11:02:18 -0700168 dbus_message_iter_get_basic(&iter, &state_name);
Darin Petkovf27f0362010-06-04 13:14:19 -0700169 daemon->NetStateChanged(state_name, ticks);
Darin Petkov703ec972010-04-27 11:02:18 -0700170 } else if (strcmp(interface, DBUS_IFACE_POWER_MANAGER) == 0) {
David James6bf6e252010-06-06 18:52:40 -0700171 const char* member = dbus_message_get_member(message);
172 if (strcmp(member, "ScreenIsLocked") == 0) {
173 daemon->SetUserActiveState(false, now);
174 } else if (strcmp(member, "ScreenIsUnlocked") == 0) {
175 daemon->SetUserActiveState(true, now);
176 } else if (strcmp(member, "PowerStateChanged") == 0) {
177 char* state_name;
178 dbus_message_iter_get_basic(&iter, &state_name);
179 daemon->PowerStateChanged(state_name, now);
180 }
Darin Petkov41e06232010-05-03 16:45:37 -0700181 } else if (strcmp(interface, DBUS_IFACE_SESSION_MANAGER) == 0) {
182 CHECK(strcmp(dbus_message_get_member(message),
183 "SessionStateChanged") == 0);
184
David James3b3add52010-06-04 15:01:19 -0700185 char* state_name;
Darin Petkov41e06232010-05-03 16:45:37 -0700186 dbus_message_iter_get_basic(&iter, &state_name);
187 daemon->SessionStateChanged(state_name, now);
Darin Petkov703ec972010-04-27 11:02:18 -0700188 } else {
Darin Petkov41e06232010-05-03 16:45:37 -0700189 DLOG(WARNING) << "unexpected interface: " << interface;
Darin Petkov703ec972010-04-27 11:02:18 -0700190 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
191 }
192
193 return DBUS_HANDLER_RESULT_HANDLED;
Darin Petkov65b01462010-04-14 13:32:20 -0700194}
195
Darin Petkovf27f0362010-06-04 13:14:19 -0700196void MetricsDaemon::NetStateChanged(const char* state_name, TimeTicks ticks) {
Darin Petkov41e06232010-05-03 16:45:37 -0700197 DLOG(INFO) << "network state: " << state_name;
Darin Petkov703ec972010-04-27 11:02:18 -0700198
Darin Petkov703ec972010-04-27 11:02:18 -0700199 NetworkState state = LookupNetworkState(state_name);
200
201 // Logs the time in seconds between the network going online to
Darin Petkov2ccef012010-05-05 16:06:37 -0700202 // going offline (or, more precisely, going not online) in order to
203 // measure the mean time to network dropping. Going offline as part
204 // of suspend-to-RAM is not logged as network drop -- the assumption
205 // is that the message for suspend-to-RAM comes before the network
206 // offline message which seems to and should be the case.
207 if (state != kNetworkStateOnline &&
Darin Petkov703ec972010-04-27 11:02:18 -0700208 network_state_ == kNetworkStateOnline &&
209 power_state_ != kPowerStateMem) {
Darin Petkovf27f0362010-06-04 13:14:19 -0700210 TimeDelta since_online = ticks - network_state_last_;
211 int online_time = static_cast<int>(since_online.InSeconds());
Darin Petkov11b8eb32010-05-18 11:00:59 -0700212 SendMetric(kMetricTimeToNetworkDropName, online_time,
213 kMetricTimeToNetworkDropMin,
214 kMetricTimeToNetworkDropMax,
215 kMetricTimeToNetworkDropBuckets);
Darin Petkov65b01462010-04-14 13:32:20 -0700216 }
217
Darin Petkov703ec972010-04-27 11:02:18 -0700218 network_state_ = state;
Darin Petkovf27f0362010-06-04 13:14:19 -0700219 network_state_last_ = ticks;
Darin Petkov65b01462010-04-14 13:32:20 -0700220}
221
Darin Petkov703ec972010-04-27 11:02:18 -0700222MetricsDaemon::NetworkState
223MetricsDaemon::LookupNetworkState(const char* state_name) {
Darin Petkov65b01462010-04-14 13:32:20 -0700224 for (int i = 0; i < kNumberNetworkStates; i++) {
Darin Petkov41e06232010-05-03 16:45:37 -0700225 if (strcmp(state_name, kNetworkStates_[i]) == 0) {
Darin Petkov703ec972010-04-27 11:02:18 -0700226 return static_cast<NetworkState>(i);
Darin Petkov65b01462010-04-14 13:32:20 -0700227 }
228 }
Darin Petkov41e06232010-05-03 16:45:37 -0700229 DLOG(WARNING) << "unknown network connection state: " << state_name;
Darin Petkov703ec972010-04-27 11:02:18 -0700230 return kUnknownNetworkState;
231}
232
Darin Petkovf27f0362010-06-04 13:14:19 -0700233void MetricsDaemon::PowerStateChanged(const char* state_name, Time now) {
Darin Petkov41e06232010-05-03 16:45:37 -0700234 DLOG(INFO) << "power state: " << state_name;
Darin Petkov703ec972010-04-27 11:02:18 -0700235 power_state_ = LookupPowerState(state_name);
Darin Petkov41e06232010-05-03 16:45:37 -0700236
237 if (power_state_ != kPowerStateOn)
238 SetUserActiveState(false, now);
Darin Petkov703ec972010-04-27 11:02:18 -0700239}
240
241MetricsDaemon::PowerState
242MetricsDaemon::LookupPowerState(const char* state_name) {
243 for (int i = 0; i < kNumberPowerStates; i++) {
Darin Petkov41e06232010-05-03 16:45:37 -0700244 if (strcmp(state_name, kPowerStates_[i]) == 0) {
Darin Petkov703ec972010-04-27 11:02:18 -0700245 return static_cast<PowerState>(i);
246 }
247 }
Darin Petkov41e06232010-05-03 16:45:37 -0700248 DLOG(WARNING) << "unknown power state: " << state_name;
Darin Petkov703ec972010-04-27 11:02:18 -0700249 return kUnknownPowerState;
Darin Petkov65b01462010-04-14 13:32:20 -0700250}
251
Darin Petkovf27f0362010-06-04 13:14:19 -0700252void MetricsDaemon::SessionStateChanged(const char* state_name, Time now) {
Darin Petkov41e06232010-05-03 16:45:37 -0700253 DLOG(INFO) << "user session state: " << state_name;
254 session_state_ = LookupSessionState(state_name);
255 SetUserActiveState(session_state_ == kSessionStateStarted, now);
256}
257
258MetricsDaemon::SessionState
259MetricsDaemon::LookupSessionState(const char* state_name) {
260 for (int i = 0; i < kNumberSessionStates; i++) {
261 if (strcmp(state_name, kSessionStates_[i]) == 0) {
262 return static_cast<SessionState>(i);
263 }
264 }
265 DLOG(WARNING) << "unknown user session state: " << state_name;
266 return kUnknownSessionState;
267}
268
Darin Petkovf27f0362010-06-04 13:14:19 -0700269void MetricsDaemon::SetUserActiveState(bool active, Time now) {
Darin Petkov41e06232010-05-03 16:45:37 -0700270 DLOG(INFO) << "user: " << (active ? "active" : "inactive");
271
272 // Calculates the seconds of active use since the last update and
Darin Petkovf27f0362010-06-04 13:14:19 -0700273 // the day since Epoch, and logs the usage data. Guards against the
274 // time jumping back and forth due to the user changing it by
275 // discarding the new use time.
276 int seconds = 0;
277 if (user_active_ && now > user_active_last_) {
278 TimeDelta since_active = now - user_active_last_;
279 if (since_active < TimeDelta::FromSeconds(
280 kUseMonitorIntervalMax + kSecondsPerMinute)) {
281 seconds = static_cast<int>(since_active.InSeconds());
282 }
283 }
284 TimeDelta since_epoch = now - Time();
285 int day = since_epoch.InDays();
Darin Petkov41e06232010-05-03 16:45:37 -0700286 LogDailyUseRecord(day, seconds);
287
288 // Schedules a use monitor on inactive->active transitions and
289 // unschedules it on active->inactive transitions.
290 if (!user_active_ && active)
291 ScheduleUseMonitor(kUseMonitorIntervalInit, /* backoff */ false);
292 else if (user_active_ && !active)
293 UnscheduleUseMonitor();
294
295 // Remembers the current active state and the time of the last
296 // activity update.
297 user_active_ = active;
298 user_active_last_ = now;
299}
300
301void MetricsDaemon::LogDailyUseRecord(int day, int seconds) {
302 // If there's no new active use today and the last record in the
303 // usage aggregation file is today, there's nothing to do.
304 if (seconds == 0 && day == daily_use_day_last_)
305 return;
306
307 DLOG(INFO) << "day: " << day << " usage: " << seconds << " seconds";
Darin Petkov2ccef012010-05-05 16:06:37 -0700308 int fd = HANDLE_EINTR(open(daily_use_record_file_,
Darin Petkov41e06232010-05-03 16:45:37 -0700309 O_RDWR | O_CREAT,
310 S_IRUSR | S_IWUSR));
311 if (fd < 0) {
Darin Petkov2ccef012010-05-05 16:06:37 -0700312 PLOG(WARNING) << "Unable to open the daily use file";
Darin Petkov41e06232010-05-03 16:45:37 -0700313 return;
314 }
315
316 bool same_day = false;
317 UseRecord record;
318 if (HANDLE_EINTR(read(fd, &record, sizeof(record))) == sizeof(record)) {
319 if (record.day_ == day) {
320 // If there's an existing record for today, aggregates the usage
321 // time.
322 same_day = true;
323 record.seconds_ += seconds;
324 } else {
325 // If there's an existing record for a day in the past, rounds
326 // the usage to the nearest minute and sends it to UMA.
327 int minutes =
328 (record.seconds_ + kSecondsPerMinute / 2) / kSecondsPerMinute;
Darin Petkov11b8eb32010-05-18 11:00:59 -0700329 SendMetric(kMetricDailyUseTimeName, minutes,
330 kMetricDailyUseTimeMin,
331 kMetricDailyUseTimeMax,
332 kMetricDailyUseTimeBuckets);
Darin Petkov41e06232010-05-03 16:45:37 -0700333
334 // Truncates the usage file to ensure that no duplicate usage is
335 // sent to UMA.
Darin Petkov2ccef012010-05-05 16:06:37 -0700336 PLOG_IF(WARNING, HANDLE_EINTR(ftruncate(fd, 0)) != 0);
Darin Petkov41e06232010-05-03 16:45:37 -0700337 }
338 }
339
340 // Updates the use record in the daily usage file if there's new
341 // usage today.
342 if (seconds > 0) {
343 if (!same_day) {
344 record.day_ = day;
345 record.seconds_ = seconds;
346 }
347 // else an already existing record for the same day will be
348 // overwritten with updated usage below.
349
Darin Petkov2ccef012010-05-05 16:06:37 -0700350 PLOG_IF(WARNING, HANDLE_EINTR(lseek(fd, 0, SEEK_SET)) != 0);
351 PLOG_IF(WARNING,
352 HANDLE_EINTR(write(fd, &record, sizeof(record))) !=
353 sizeof(record));
Darin Petkov41e06232010-05-03 16:45:37 -0700354 }
355
356 HANDLE_EINTR(close(fd));
357
358 // Remembers the day of the use record in the usage aggregation file
359 // to reduce file I/O. This is not really useful now but potentially
360 // allows frequent LogDailyUseRecord calls with no unnecessary I/O
361 // overhead.
362 daily_use_day_last_ = day;
363}
364
365// static
366gboolean MetricsDaemon::UseMonitorStatic(gpointer data) {
367 return static_cast<MetricsDaemon*>(data)->UseMonitor() ? TRUE : FALSE;
368}
369
370bool MetricsDaemon::UseMonitor() {
Darin Petkovf27f0362010-06-04 13:14:19 -0700371 SetUserActiveState(user_active_, Time::Now());
Darin Petkov41e06232010-05-03 16:45:37 -0700372
373 // If a new monitor source/instance is scheduled, returns false to
374 // tell GLib to destroy this monitor source/instance. Returns true
375 // otherwise to keep calling back this monitor.
376 return !ScheduleUseMonitor(usemon_interval_ * 2, /* backoff */ true);
377}
378
379bool MetricsDaemon::ScheduleUseMonitor(int interval, bool backoff)
380{
Darin Petkov2ccef012010-05-05 16:06:37 -0700381 if (testing_)
382 return false;
383
Darin Petkov41e06232010-05-03 16:45:37 -0700384 // Caps the interval -- the bigger the interval, the more active use
385 // time will be potentially dropped on system shutdown.
386 if (interval > kUseMonitorIntervalMax)
387 interval = kUseMonitorIntervalMax;
388
389 if (backoff) {
390 // Back-off mode is used by the use monitor to reschedule itself
391 // with exponential back-off in time. This mode doesn't create a
392 // new timeout source if the new interval is the same as the old
393 // one. Also, if a new timeout source is created, the old one is
394 // not destroyed explicitly here -- it will be destroyed by GLib
395 // when the monitor returns FALSE (see UseMonitor and
396 // UseMonitorStatic).
397 if (interval == usemon_interval_)
398 return false;
399 } else {
400 UnscheduleUseMonitor();
401 }
402
403 // Schedules a new use monitor for |interval| seconds from now.
404 DLOG(INFO) << "scheduling use monitor in " << interval << " seconds";
405 usemon_source_ = g_timeout_source_new_seconds(interval);
406 g_source_set_callback(usemon_source_, UseMonitorStatic, this,
407 NULL); // No destroy notification.
408 g_source_attach(usemon_source_,
409 NULL); // Default context.
410 usemon_interval_ = interval;
411 return true;
412}
413
414void MetricsDaemon::UnscheduleUseMonitor() {
415 // If there's a use monitor scheduled already, destroys it.
416 if (usemon_source_ == NULL)
417 return;
418
419 DLOG(INFO) << "destroying use monitor";
420 g_source_destroy(usemon_source_);
421 usemon_source_ = NULL;
422 usemon_interval_ = 0;
423}
424
Darin Petkov11b8eb32010-05-18 11:00:59 -0700425void MetricsDaemon::SendMetric(const std::string& name, int sample,
426 int min, int max, int nbuckets) {
Darin Petkovfc91b422010-05-12 13:05:45 -0700427 DLOG(INFO) << "received metric: " << name << " " << sample << " "
428 << min << " " << max << " " << nbuckets;
429 metrics_lib_->SendToUMA(name, sample, min, max, nbuckets);
Darin Petkov65b01462010-04-14 13:32:20 -0700430}