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

Side by Side Diff: update_attempter.cc

Issue 2868061: Measure and send update time to UMA. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: Created 10 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « update_attempter.h ('k') | no next file » | 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) 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 #include "update_engine/update_attempter.h" 5 #include "update_engine/update_attempter.h"
6 6
7 // From 'man clock_gettime': feature test macro: _POSIX_C_SOURCE >= 199309L 7 // From 'man clock_gettime': feature test macro: _POSIX_C_SOURCE >= 199309L
8 #ifndef _POSIX_C_SOURCE 8 #ifndef _POSIX_C_SOURCE
9 #define _POSIX_C_SOURCE 199309L 9 #define _POSIX_C_SOURCE 199309L
10 #endif // _POSIX_C_SOURCE 10 #endif // _POSIX_C_SOURCE
11 #include <time.h> 11 #include <time.h>
12 12
13 #include <tr1/memory> 13 #include <tr1/memory>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16
16 #include <glib.h> 17 #include <glib.h>
18
19 #include "metrics/metrics_library.h"
17 #include "update_engine/dbus_service.h" 20 #include "update_engine/dbus_service.h"
18 #include "update_engine/download_action.h" 21 #include "update_engine/download_action.h"
19 #include "update_engine/filesystem_copier_action.h" 22 #include "update_engine/filesystem_copier_action.h"
20 #include "update_engine/libcurl_http_fetcher.h" 23 #include "update_engine/libcurl_http_fetcher.h"
21 #include "update_engine/omaha_request_action.h" 24 #include "update_engine/omaha_request_action.h"
22 #include "update_engine/omaha_request_params.h" 25 #include "update_engine/omaha_request_params.h"
23 #include "update_engine/omaha_response_handler_action.h" 26 #include "update_engine/omaha_response_handler_action.h"
24 #include "update_engine/postinstall_runner_action.h" 27 #include "update_engine/postinstall_runner_action.h"
25 #include "update_engine/set_bootable_flag_action.h" 28 #include "update_engine/set_bootable_flag_action.h"
26 29
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 201
199 // Delegate methods: 202 // Delegate methods:
200 void UpdateAttempter::ProcessingDone(const ActionProcessor* processor, 203 void UpdateAttempter::ProcessingDone(const ActionProcessor* processor,
201 ActionExitCode code) { 204 ActionExitCode code) {
202 CHECK(response_handler_action_); 205 CHECK(response_handler_action_);
203 LOG(INFO) << "Processing Done."; 206 LOG(INFO) << "Processing Done.";
204 actions_.clear(); 207 actions_.clear();
205 if (code == kActionCodeSuccess) { 208 if (code == kActionCodeSuccess) {
206 SetStatusAndNotify(UPDATE_STATUS_UPDATED_NEED_REBOOT); 209 SetStatusAndNotify(UPDATE_STATUS_UPDATED_NEED_REBOOT);
207 utils::WriteFile(kUpdateCompletedMarker, "", 0); 210 utils::WriteFile(kUpdateCompletedMarker, "", 0);
211
212 // Report the time it took to update the system.
213 int64_t update_time = time(NULL) - last_checked_time_;
214 metrics_lib_->SendToUMA("Installer.UpdateTime",
adlr 2010/07/20 00:08:57 s/Installer/UpdateEngine/?
petkov 2010/07/20 00:19:44 The convention we've been trying to follow is to k
215 static_cast<int>(update_time), // sample
216 1, // min = 1 second
217 20 * 60, // max = 20 minutes
adlr 2010/07/20 00:08:57 i could definitely see the long tail of updates ta
petkov 2010/07/20 00:19:44 The default histogram layout is exponential -- sma
218 50); // buckets
208 } else { 219 } else {
209 LOG(INFO) << "Update failed."; 220 LOG(INFO) << "Update failed.";
210 SetStatusAndNotify(UPDATE_STATUS_IDLE); 221 SetStatusAndNotify(UPDATE_STATUS_IDLE);
211 } 222 }
212 } 223 }
213 224
214 void UpdateAttempter::ProcessingStopped(const ActionProcessor* processor) { 225 void UpdateAttempter::ProcessingStopped(const ActionProcessor* processor) {
215 download_progress_ = 0.0; 226 download_progress_ = 0.0;
216 SetStatusAndNotify(UPDATE_STATUS_IDLE); 227 SetStatusAndNotify(UPDATE_STATUS_IDLE);
217 actions_.clear(); 228 actions_.clear();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 update_engine_service_emit_status_update( 308 update_engine_service_emit_status_update(
298 dbus_service_, 309 dbus_service_,
299 last_checked_time_, 310 last_checked_time_,
300 download_progress_, 311 download_progress_,
301 UpdateStatusToString(status_), 312 UpdateStatusToString(status_),
302 new_version_.c_str(), 313 new_version_.c_str(),
303 new_size_); 314 new_size_);
304 } 315 }
305 316
306 } // namespace chromeos_update_engine 317 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « update_attempter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698