blob: a70f5b6e029b6414008d41067de5b5735ac84e6a [file] [log] [blame]
[email protected]2a758d612008-09-17 10:09:391// Copyright (c) 2008 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef BASE_SYS_INFO_H_
6#define BASE_SYS_INFO_H_
7
[email protected]d632798e2008-09-17 13:10:458#include "base/basictypes.h"
9
[email protected]0e91dd22008-09-18 12:34:2410#include <string>
11
[email protected]2a758d612008-09-17 10:09:3912namespace base {
13
14class SysInfo {
15 public:
16 // Return the number of logical processors/cores on the current machine.
17 static int NumberOfProcessors();
[email protected]d632798e2008-09-17 13:10:4518
19 // Return the number of bytes of physical memory on the current machine.
20 static int64 AmountOfPhysicalMemory();
[email protected]fadf97f2008-09-18 12:18:1421
22 // Return the number of megabytes of physical memory on the current machine.
23 static int AmountOfPhysicalMemoryMB() {
24 return static_cast<int>(AmountOfPhysicalMemory() / 1024 / 1024);
25 }
[email protected]0e91dd22008-09-18 12:34:2426
[email protected]02ee34a2008-09-20 01:16:2327 // Return the available disk space in bytes on the volume containing |path|,
28 // or -1 on failure.
[email protected]0e91dd22008-09-18 12:34:2429 static int64 AmountOfFreeDiskSpace(const std::wstring& path);
30
[email protected]05f9b682008-09-29 22:18:0131 // Return true if the given environment variable is defined.
32 // TODO: find a better place for HasEnvVar.
33 static bool HasEnvVar(const wchar_t* var);
34
35 // Return the value of the given environment variable
36 // or an empty string if not defined.
37 // TODO: find a better place for GetEnvVar.
38 static std::wstring GetEnvVar(const wchar_t* var);
39
40 // Returns the name of the host operating system.
41 static std::string OperatingSystemName();
42
43 // Returns the version of the host operating system.
44 static std::string OperatingSystemVersion();
45
46 // Returns the CPU architecture of the system. Exact return value may differ
47 // across platforms.
48 static std::string CPUArchitecture();
49
50 // Returns the pixel dimensions of the primary display via the
51 // width and height parameters.
52 static void GetPrimaryDisplayDimensions(int* width, int* height);
53
54 // Return the number of displays.
55 static int DisplayCount();
[email protected]2a758d612008-09-17 10:09:3956};
57
58} // namespace base
59
60#endif // BASE_SYS_INFO_H_