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

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: indent 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/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/threading/thread_checker.h"
11 #include "components/metrics/metrics_provider.h"
12
13 // Provides metrics about the local drives on a user's computer. Currently only
14 // checks to see if they incur a seek-time penalty (e.g. if they're SSDs).
15 //
16 // Defers gathering metrics until after "rush hour" (startup) so as to not bog
17 // down the FILE thread.
18 class DriveMetricsProvider : public metrics::MetricsProvider {
19 public:
20 DriveMetricsProvider();
21 ~DriveMetricsProvider() override;
22
23 // metrics::MetricsDataProvider:
24 void ProvideSystemProfileMetrics(
25 metrics::SystemProfileProto* system_profile_proto) override;
26
27 struct SeekPenaltyResponse {
Alexei Svitkine (slow) 2015/03/16 16:49:36 Move these to the private section.
Dan Beam 2015/03/16 19:20:23 they were used in the anonymous namespace, so had
28 SeekPenaltyResponse();
29 bool success;
30 bool has_seek_penalty;
31 };
32
33 struct DriveMetrics {
34 SeekPenaltyResponse app_drive;
35 SeekPenaltyResponse user_data_drive;
36 };
37
38 private:
39 // Called when metrics are done being gathered from the FILE thread.
40 void GotDriveMetrics(const DriveMetrics& metrics);
41
42 // False until |GotDriveMetrics| is called.
43 bool got_metrics_;
44 DriveMetrics metrics_;
45
46 base::ThreadChecker thread_checker_;
47 base::WeakPtrFactory<DriveMetricsProvider> weak_ptr_factory_;
48
49 DISALLOW_COPY_AND_ASSIGN(DriveMetricsProvider);
50 };
51
52 #endif // CHROME_BROWSER_METRICS_DRIVE_METRICS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698