OLD | NEW |
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 "components/metrics/drive_metrics_provider.h" | 5 #include "components/metrics/drive_metrics_provider.h" |
6 | 6 |
7 #include <linux/kdev_t.h> // For MAJOR()/MINOR(). | 7 #include <linux/kdev_t.h> // For MAJOR()/MINOR(). |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "build/build_config.h" |
15 | 16 |
16 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
17 #include "base/sys_info.h" | 18 #include "base/sys_info.h" |
18 #endif | 19 #endif |
19 | 20 |
20 namespace metrics { | 21 namespace metrics { |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 // See http://www.kernel.org/doc/Documentation/devices.txt for more info. | 25 // See http://www.kernel.org/doc/Documentation/devices.txt for more info. |
(...skipping 30 matching lines...) Expand all Loading... |
55 std::string rotational_path = base::StringPrintf(kRotationalFormat, sdX); | 56 std::string rotational_path = base::StringPrintf(kRotationalFormat, sdX); |
56 std::string rotates; | 57 std::string rotates; |
57 if (!base::ReadFileToString(base::FilePath(rotational_path), &rotates)) | 58 if (!base::ReadFileToString(base::FilePath(rotational_path), &rotates)) |
58 return false; | 59 return false; |
59 | 60 |
60 *has_seek_penalty = rotates.substr(0, 1) == "1"; | 61 *has_seek_penalty = rotates.substr(0, 1) == "1"; |
61 return true; | 62 return true; |
62 } | 63 } |
63 | 64 |
64 } // namespace metrics | 65 } // namespace metrics |
OLD | NEW |