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

Side by Side Diff: chrome/browser/metrics/drive_metrics_provider.cc

Issue 1011093004: metrics: log whether drives have seek penalties (and whether this was determined successfully). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ssd2
Patch Set: times Created 5 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "chrome/browser/metrics/drive_metrics_provider.h" 5 #include "chrome/browser/metrics/drive_metrics_provider.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/metrics/histogram_macros.h"
12 #include "base/path_service.h" 13 #include "base/path_service.h"
13 #include "base/sys_info.h" 14 #include "base/sys_info.h"
15 #include "base/time/time.h"
14 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
15 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
16 18
17 DriveMetricsProvider::DriveMetricsProvider() : weak_ptr_factory_(this) {} 19 DriveMetricsProvider::DriveMetricsProvider() : weak_ptr_factory_(this) {}
18 20
19 DriveMetricsProvider::~DriveMetricsProvider() {} 21 DriveMetricsProvider::~DriveMetricsProvider() {}
20 22
21 void DriveMetricsProvider::ProvideSystemProfileMetrics( 23 void DriveMetricsProvider::ProvideSystemProfileMetrics(
22 metrics::SystemProfileProto* system_profile_proto) { 24 metrics::SystemProfileProto* system_profile_proto) {
23 auto* hardware = system_profile_proto->mutable_hardware(); 25 auto* hardware = system_profile_proto->mutable_hardware();
(...skipping 29 matching lines...) Expand all
53 // static 55 // static
54 void DriveMetricsProvider::QuerySeekPenalty( 56 void DriveMetricsProvider::QuerySeekPenalty(
55 int path_service_key, 57 int path_service_key,
56 DriveMetricsProvider::SeekPenaltyResponse* response) { 58 DriveMetricsProvider::SeekPenaltyResponse* response) {
57 DCHECK(response); 59 DCHECK(response);
58 60
59 base::FilePath path; 61 base::FilePath path;
60 if (!PathService::Get(path_service_key, &path)) 62 if (!PathService::Get(path_service_key, &path))
61 return; 63 return;
62 64
65 base::TimeTicks start = base::TimeTicks::Now();
66
63 response->success = 67 response->success =
64 base::SysInfo::HasSeekPenalty(path, &response->has_seek_penalty); 68 base::SysInfo::HasSeekPenalty(path, &response->has_seek_penalty);
69
70 UMA_HISTOGRAM_TIMES("Hardware.Drive.HasSeekPenalty_Time",
71 base::TimeTicks::Now() - start);
72 UMA_HISTOGRAM_BOOLEAN("Hardware.Drive.HasSeekPenalty_Success",
73 response->success);
74 if (response->success) {
75 UMA_HISTOGRAM_BOOLEAN("Hardware.Drive.HasSeekPenalty",
76 response->has_seek_penalty);
77 }
65 } 78 }
66 79
67 void DriveMetricsProvider::GotDriveMetrics( 80 void DriveMetricsProvider::GotDriveMetrics(
68 const DriveMetricsProvider::DriveMetrics& metrics) { 81 const DriveMetricsProvider::DriveMetrics& metrics) {
69 DCHECK(thread_checker_.CalledOnValidThread()); 82 DCHECK(thread_checker_.CalledOnValidThread());
70 metrics_ = metrics; 83 metrics_ = metrics;
71 got_metrics_callback_.Run(); 84 got_metrics_callback_.Run();
72 } 85 }
73 86
74 void DriveMetricsProvider::FillDriveMetrics( 87 void DriveMetricsProvider::FillDriveMetrics(
75 const DriveMetricsProvider::SeekPenaltyResponse& response, 88 const DriveMetricsProvider::SeekPenaltyResponse& response,
76 metrics::SystemProfileProto::Hardware::Drive* drive) { 89 metrics::SystemProfileProto::Hardware::Drive* drive) {
77 if (response.success) 90 if (response.success)
78 drive->set_has_seek_penalty(response.has_seek_penalty); 91 drive->set_has_seek_penalty(response.has_seek_penalty);
79 } 92 }
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698