| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(HOST_OS_FUCHSIA) | 6 #if defined(HOST_OS_FUCHSIA) |
| 7 | 7 |
| 8 #include "vm/cpuinfo.h" | 8 #include "vm/cpuinfo.h" |
| 9 | 9 |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 CpuId::InitOnce(); | 24 CpuId::InitOnce(); |
| 25 | 25 |
| 26 fields_[kCpuInfoProcessor] = "Processor"; | 26 fields_[kCpuInfoProcessor] = "Processor"; |
| 27 fields_[kCpuInfoModel] = "Hardware"; | 27 fields_[kCpuInfoModel] = "Hardware"; |
| 28 fields_[kCpuInfoHardware] = "Hardware"; | 28 fields_[kCpuInfoHardware] = "Hardware"; |
| 29 fields_[kCpuInfoFeatures] = "Features"; | 29 fields_[kCpuInfoFeatures] = "Features"; |
| 30 fields_[kCpuInfoArchitecture] = "CPU architecture"; | 30 fields_[kCpuInfoArchitecture] = "CPU architecture"; |
| 31 #endif | 31 #endif |
| 32 } | 32 } |
| 33 | 33 |
| 34 | |
| 35 void CpuInfo::Cleanup() { | 34 void CpuInfo::Cleanup() { |
| 36 if (method_ == kCpuInfoCpuId) { | 35 if (method_ == kCpuInfoCpuId) { |
| 37 CpuId::Cleanup(); | 36 CpuId::Cleanup(); |
| 38 } | 37 } |
| 39 } | 38 } |
| 40 | 39 |
| 41 | |
| 42 bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { | 40 bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { |
| 43 if (method_ == kCpuInfoCpuId) { | 41 if (method_ == kCpuInfoCpuId) { |
| 44 return strstr(CpuId::field(idx), search_string); | 42 return strstr(CpuId::field(idx), search_string); |
| 45 } else { | 43 } else { |
| 46 return false; | 44 return false; |
| 47 } | 45 } |
| 48 } | 46 } |
| 49 | 47 |
| 50 | |
| 51 const char* CpuInfo::ExtractField(CpuInfoIndices idx) { | 48 const char* CpuInfo::ExtractField(CpuInfoIndices idx) { |
| 52 if (method_ == kCpuInfoCpuId) { | 49 if (method_ == kCpuInfoCpuId) { |
| 53 return CpuId::field(idx); | 50 return CpuId::field(idx); |
| 54 } else { | 51 } else { |
| 55 return strdup(""); | 52 return strdup(""); |
| 56 } | 53 } |
| 57 } | 54 } |
| 58 | 55 |
| 59 | |
| 60 bool CpuInfo::HasField(const char* field) { | 56 bool CpuInfo::HasField(const char* field) { |
| 61 if (method_ == kCpuInfoCpuId) { | 57 if (method_ == kCpuInfoCpuId) { |
| 62 return (strcmp(field, fields_[kCpuInfoProcessor]) == 0) || | 58 return (strcmp(field, fields_[kCpuInfoProcessor]) == 0) || |
| 63 (strcmp(field, fields_[kCpuInfoModel]) == 0) || | 59 (strcmp(field, fields_[kCpuInfoModel]) == 0) || |
| 64 (strcmp(field, fields_[kCpuInfoHardware]) == 0) || | 60 (strcmp(field, fields_[kCpuInfoHardware]) == 0) || |
| 65 (strcmp(field, fields_[kCpuInfoFeatures]) == 0); | 61 (strcmp(field, fields_[kCpuInfoFeatures]) == 0); |
| 66 } else { | 62 } else { |
| 67 return false; | 63 return false; |
| 68 } | 64 } |
| 69 } | 65 } |
| 70 | 66 |
| 71 } // namespace dart | 67 } // namespace dart |
| 72 | 68 |
| 73 #endif // defined(HOST_OS_FUCHSIA) | 69 #endif // defined(HOST_OS_FUCHSIA) |
| OLD | NEW |