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

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

Issue 999623002: metrics/base: log whether drives have seek penalties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DONT_ASSERT_ANYTHING 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_METRICS_DRIVE_METRICS_PROVIDER_H_
6 #define CHROME_BROWSER_METRICS_DRIVE_METRICS_PROVIDER_H_
7
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/threading/thread_checker.h"
12 #include "components/metrics/metrics_provider.h"
13 #include "components/metrics/proto/system_profile.pb.h"
14
15 // Provides metrics about the local drives on a user's computer. Currently only
16 // checks to see if they incur a seek-time penalty (e.g. if they're SSDs).
17 //
18 // Defers gathering metrics until after "rush hour" (startup) so as to not bog
19 // down the FILE thread.
20 class DriveMetricsProvider : public metrics::MetricsProvider {
21 public:
22 DriveMetricsProvider();
23 ~DriveMetricsProvider() override;
24
25 // metrics::MetricsDataProvider:
26 void ProvideSystemProfileMetrics(
27 metrics::SystemProfileProto* system_profile_proto) override;
28
29 // Called by ChromeMetricsServiceClient to start gathering metrics.
30 void GetDriveMetrics(const base::Closure& done);
31
32 private:
33 // A response to querying a drive as to whether it incurs a seek penalty.
34 // |has_seek_penalty| is set if |success| is true.
35 struct SeekPenaltyResponse {
36 SeekPenaltyResponse();
37 bool success;
38 bool has_seek_penalty;
39 };
40
41 struct DriveMetrics {
42 SeekPenaltyResponse app_drive;
43 SeekPenaltyResponse user_data_drive;
44 };
45
46 // Gather metrics about various drives on the FILE thread.
47 static DriveMetrics GetDriveMetricsOnFileThread();
48
49 // Tries to determine whether there is a penalty for seeking on the drive that
50 // hosts |path_service_key| (for example: the drive that holds "Local State").
51 static void QuerySeekPenalty(int path_service_key,
52 SeekPenaltyResponse* response);
53
54 // Called when metrics are done being gathered from the FILE thread.
55 void GotDriveMetrics(const DriveMetrics& metrics);
56
57 // Fills |drive| with information from successful |response|s.
58 void FillDriveMetrics(
59 const SeekPenaltyResponse& response,
60 metrics::SystemProfileProto::Hardware::Drive* drive);
61
62 // Information gathered about various important drives.
63 DriveMetrics metrics_;
64
65 // Called when metrics are done being collected.
66 base::Closure got_metrics_callback_;
67
68 base::ThreadChecker thread_checker_;
69 base::WeakPtrFactory<DriveMetricsProvider> weak_ptr_factory_;
70
71 DISALLOW_COPY_AND_ASSIGN(DriveMetricsProvider);
72 };
73
74 #endif // CHROME_BROWSER_METRICS_DRIVE_METRICS_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/metrics/chrome_metrics_service_client.cc ('k') | chrome/browser/metrics/drive_metrics_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698