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

Unified Diff: chrome/browser/metrics/disk_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: nits 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/disk_metrics_provider.h
diff --git a/chrome/browser/metrics/disk_metrics_provider.h b/chrome/browser/metrics/disk_metrics_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..32c8fbd4758a90c6b85dc4055f08a3fe23d3cecc
--- /dev/null
+++ b/chrome/browser/metrics/disk_metrics_provider.h
@@ -0,0 +1,46 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_METRICS_DISK_METRICS_PROVIDER_H_
Alexei Svitkine (slow) 2015/03/12 16:41:06 Can this class live in the component? Since it jus
Dan Beam 2015/03/13 19:31:32 look at the cc dependencies
+#define CHROME_BROWSER_METRICS_DISK_METRICS_PROVIDER_H_
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "base/threading/thread_checker.h"
+#include "components/metrics/metrics_provider.h"
+
+struct SeekPenaltyResponse {
+ SeekPenaltyResponse();
+ bool success;
+ bool has_seek_penalty;
+};
+
+struct DiskMetrics {
Alexei Svitkine (slow) 2015/03/12 16:41:06 Can these be declared inside the class? That way,
Dan Beam 2015/03/13 19:31:32 yes, Done.
+ SeekPenaltyResponse app_disk;
+ SeekPenaltyResponse user_data_disk;
+};
+
+// Provides metrics about the local disks on a user's computer. Currently only
+// checks to see if they incur a seek-time penalty (e.g. if they're SSDs).
+class DiskMetricsProvider : public metrics::MetricsProvider {
+ public:
+ DiskMetricsProvider();
+ ~DiskMetricsProvider() override;
+
+ // metrics::MetricsDataProvider:
+ void ProvideSystemProfileMetrics(
+ metrics::SystemProfileProto* system_profile_proto) override;
+
+ private:
+ void GotDiskMetrics(const DiskMetrics& metrics);
Alexei Svitkine (slow) 2015/03/12 16:41:06 Add a comment.
Dan Beam 2015/03/13 19:31:32 Done.
+
+ DiskMetrics metrics_;
+
+ base::ThreadChecker thread_checker_;
+ base::WeakPtrFactory<DiskMetricsProvider> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(DiskMetricsProvider);
+};
+
+#endif // CHROME_BROWSER_METRICS_DISK_METRICS_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698