| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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(TARGET_OS_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
| 7 | 7 |
| 8 #include "vm/cpuinfo.h" | 8 #include "vm/cpuinfo.h" |
| 9 #include "vm/cpuid.h" | 9 #include "vm/cpuid.h" |
| 10 #include "vm/proccpuinfo.h" | 10 #include "vm/proccpuinfo.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 const char* CpuInfo::fields_[kCpuInfoMax] = {0}; | 21 const char* CpuInfo::fields_[kCpuInfoMax] = {0}; |
| 22 | 22 |
| 23 void CpuInfo::InitOnce() { | 23 void CpuInfo::InitOnce() { |
| 24 #if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64) | 24 #if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64) |
| 25 fields_[kCpuInfoProcessor] = "vendor_id"; | 25 fields_[kCpuInfoProcessor] = "vendor_id"; |
| 26 fields_[kCpuInfoModel] = "model name"; | 26 fields_[kCpuInfoModel] = "model name"; |
| 27 fields_[kCpuInfoHardware] = "model name"; | 27 fields_[kCpuInfoHardware] = "model name"; |
| 28 fields_[kCpuInfoFeatures] = "flags"; | 28 fields_[kCpuInfoFeatures] = "flags"; |
| 29 method_ = kCpuInfoCpuId; | 29 method_ = kCpuInfoCpuId; |
| 30 CpuId::InitOnce(); | 30 CpuId::InitOnce(); |
| 31 #elif defined(HOST_ARCH_ARM) | 31 #elif defined(HOST_ARCH_ARM) || defined(HOST_ARCH_ARM64) |
| 32 // TODO(zra): Verify that these field names are correct for arm64. |
| 32 fields_[kCpuInfoProcessor] = "Processor"; | 33 fields_[kCpuInfoProcessor] = "Processor"; |
| 33 fields_[kCpuInfoModel] = "model name"; | 34 fields_[kCpuInfoModel] = "model name"; |
| 34 fields_[kCpuInfoHardware] = "Hardware"; | 35 fields_[kCpuInfoHardware] = "Hardware"; |
| 35 fields_[kCpuInfoFeatures] = "Features"; | 36 fields_[kCpuInfoFeatures] = "Features"; |
| 36 method_ = kCpuInfoSystem; | 37 method_ = kCpuInfoSystem; |
| 37 ProcCpuInfo::InitOnce(); | 38 ProcCpuInfo::InitOnce(); |
| 38 #elif defined(HOST_ARCH_MIPS) || defined(HOST_ARCH_ARM64) | 39 #elif defined(HOST_ARCH_MIPS) |
| 39 // TODO(zra): Verify that these field names are correct for arm64. | |
| 40 fields_[kCpuInfoProcessor] = "system type"; | 40 fields_[kCpuInfoProcessor] = "system type"; |
| 41 fields_[kCpuInfoModel] = "cpu model"; | 41 fields_[kCpuInfoModel] = "cpu model"; |
| 42 fields_[kCpuInfoHardware] = "cpu model"; | 42 fields_[kCpuInfoHardware] = "cpu model"; |
| 43 fields_[kCpuInfoFeatures] = "ASEs implemented"; | 43 fields_[kCpuInfoFeatures] = "ASEs implemented"; |
| 44 method_ = kCpuInfoSystem; | 44 method_ = kCpuInfoSystem; |
| 45 ProcCpuInfo::InitOnce(); | 45 ProcCpuInfo::InitOnce(); |
| 46 #else | 46 #else |
| 47 #error Unrecognized target architecture | 47 #error Unrecognized target architecture |
| 48 #endif | 48 #endif |
| 49 } | 49 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 (strcmp(field, fields_[kCpuInfoFeatures]) == 0); | 120 (strcmp(field, fields_[kCpuInfoFeatures]) == 0); |
| 121 } else { | 121 } else { |
| 122 ASSERT(method_ == kCpuInfoSystem); | 122 ASSERT(method_ == kCpuInfoSystem); |
| 123 return ProcCpuInfo::HasField(field); | 123 return ProcCpuInfo::HasField(field); |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace dart | 127 } // namespace dart |
| 128 | 128 |
| 129 #endif // defined(TARGET_OS_LINUX) | 129 #endif // defined(TARGET_OS_LINUX) |
| OLD | NEW |