blob: 47b93f6799a86dd26aa540fe7d691f96c21a143c [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * Copyright 2008 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_BASE_SYSTEMINFO_H__
12#define WEBRTC_BASE_SYSTEMINFO_H__
13
14#include <string>
15
16#include "webrtc/base/basictypes.h"
17
18namespace rtc {
19
20class SystemInfo {
21 public:
22 enum Architecture {
23 SI_ARCH_UNKNOWN = -1,
24 SI_ARCH_X86 = 0,
25 SI_ARCH_X64 = 1,
26 SI_ARCH_ARM = 2
27 };
28
29 SystemInfo();
30
31 // The number of CPU Cores in the system.
32 int GetMaxPhysicalCpus();
33 // The number of CPU Threads in the system.
34 int GetMaxCpus();
35 // The number of CPU Threads currently available to this process.
36 int GetCurCpus();
37 // Identity of the CPUs.
38 Architecture GetCpuArchitecture();
39 std::string GetCpuVendor();
40 int GetCpuFamily();
41 int GetCpuModel();
42 int GetCpuStepping();
43 // Return size of CPU cache in bytes. Uses largest available cache (L3).
44 int GetCpuCacheSize();
45 // Estimated speed of the CPUs, in MHz. e.g. 2400 for 2.4 GHz
46 int GetMaxCpuSpeed();
47 int GetCurCpuSpeed();
48 // Total amount of physical memory, in bytes.
49 int64 GetMemorySize();
50 // The model name of the machine, e.g. "MacBookAir1,1"
51 std::string GetMachineModel();
52
53 // The gpu identifier
54 struct GpuInfo {
kwiberg@webrtc.org67186fe2015-03-09 22:21:53 +000055 GpuInfo();
56 ~GpuInfo();
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000057 std::string device_name;
58 std::string description;
59 int vendor_id;
60 int device_id;
61 std::string driver;
62 std::string driver_version;
63 };
64 bool GetGpuInfo(GpuInfo *info);
65
66 private:
67 int physical_cpus_;
68 int logical_cpus_;
69 int cache_size_;
70 Architecture cpu_arch_;
71 std::string cpu_vendor_;
72 int cpu_family_;
73 int cpu_model_;
74 int cpu_stepping_;
75 int cpu_speed_;
76 int64 memory_;
77 std::string machine_model_;
78};
79
80} // namespace rtc
81
82#endif // WEBRTC_BASE_SYSTEMINFO_H__