security/sandbox/chromium/base/cpu.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/sandbox/chromium/base/cpu.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,81 @@
     1.4 +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +#ifndef BASE_CPU_H_
     1.9 +#define BASE_CPU_H_
    1.10 +
    1.11 +#include <string>
    1.12 +
    1.13 +#include "base/base_export.h"
    1.14 +
    1.15 +namespace base {
    1.16 +
    1.17 +// Query information about the processor.
    1.18 +class BASE_EXPORT CPU {
    1.19 + public:
    1.20 +  // Constructor
    1.21 +  CPU();
    1.22 +
    1.23 +  enum IntelMicroArchitecture {
    1.24 +    PENTIUM,
    1.25 +    SSE,
    1.26 +    SSE2,
    1.27 +    SSE3,
    1.28 +    SSSE3,
    1.29 +    SSE41,
    1.30 +    SSE42,
    1.31 +    AVX,
    1.32 +    MAX_INTEL_MICRO_ARCHITECTURE
    1.33 +  };
    1.34 +
    1.35 +  // Accessors for CPU information.
    1.36 +  const std::string& vendor_name() const { return cpu_vendor_; }
    1.37 +  int signature() const { return signature_; }
    1.38 +  int stepping() const { return stepping_; }
    1.39 +  int model() const { return model_; }
    1.40 +  int family() const { return family_; }
    1.41 +  int type() const { return type_; }
    1.42 +  int extended_model() const { return ext_model_; }
    1.43 +  int extended_family() const { return ext_family_; }
    1.44 +  bool has_mmx() const { return has_mmx_; }
    1.45 +  bool has_sse() const { return has_sse_; }
    1.46 +  bool has_sse2() const { return has_sse2_; }
    1.47 +  bool has_sse3() const { return has_sse3_; }
    1.48 +  bool has_ssse3() const { return has_ssse3_; }
    1.49 +  bool has_sse41() const { return has_sse41_; }
    1.50 +  bool has_sse42() const { return has_sse42_; }
    1.51 +  bool has_avx() const { return has_avx_; }
    1.52 +  bool has_non_stop_time_stamp_counter() const {
    1.53 +    return has_non_stop_time_stamp_counter_;
    1.54 +  }
    1.55 +  IntelMicroArchitecture GetIntelMicroArchitecture() const;
    1.56 +  const std::string& cpu_brand() const { return cpu_brand_; }
    1.57 +
    1.58 + private:
    1.59 +  // Query the processor for CPUID information.
    1.60 +  void Initialize();
    1.61 +
    1.62 +  int signature_;  // raw form of type, family, model, and stepping
    1.63 +  int type_;  // process type
    1.64 +  int family_;  // family of the processor
    1.65 +  int model_;  // model of processor
    1.66 +  int stepping_;  // processor revision number
    1.67 +  int ext_model_;
    1.68 +  int ext_family_;
    1.69 +  bool has_mmx_;
    1.70 +  bool has_sse_;
    1.71 +  bool has_sse2_;
    1.72 +  bool has_sse3_;
    1.73 +  bool has_ssse3_;
    1.74 +  bool has_sse41_;
    1.75 +  bool has_sse42_;
    1.76 +  bool has_avx_;
    1.77 +  bool has_non_stop_time_stamp_counter_;
    1.78 +  std::string cpu_vendor_;
    1.79 +  std::string cpu_brand_;
    1.80 +};
    1.81 +
    1.82 +}  // namespace base
    1.83 +
    1.84 +#endif  // BASE_CPU_H_

mercurial