---
sidebar_position: 0
---

# os

The `sos.management.os` API groups together methods for retrieving information about the system.


<details>
    <summary>OS Management Capabilities</summary>
		| Capability | Description |
		|:------------|:-------------|
		| `SYSTEM_CPU` | If device supports collecting CPU usage information |
		| `SYSTEM_MEMORY` | If device supports collecting memory usage information |

		If you want to check if the device supports those capabilities, use [`sos.management.supports()`](https://developers.signageos.io/sdk/sos_management/#supports).
</details>

## Methods

### getCpuUsage()

The `getCpuUsage()` method returns the current total CPU usage (ranging from 0 to 100%).

```ts expandable
getCpuUsage(): Promise<number>;
```

#### Return value

Resolves to the current CPU usage percentage.

#### Possible errors

If the CPU usage is not supported.

#### Example

```ts
const cpuUsage = await sos.management.os.getCpuUsage();
console.log(`Current CPU usage is: ${cpuUsage}%`);
```

<Separator />

### getInfo()

The `getInfo()` method returns info about the system of the device, such as what current version of it is installed on the device. Major
version of the current operating system. It's usually 1 or 2 digits, including or excluding dot notation.

```ts expandable
getInfo(): Promise<IOSInfo>;
// show-more
interface IOSInfo {
    /**
     * Major version of current operating system.
     * It's usually 1 or 2 digits including or excluding dot notation.
     * E.g.:
     * Windows -> 7, 8, 10, 11
     * WebOS -> 3, 3.2, 4, 4.1
     * Tizen -> 2.4, 3, 4, 5
     */
    version: string;
}

```

#### Return value

Resolves to an object containing information about the operating system.

#### Example

```ts
const osInfo = await sos.management.os.getInfo();
console.log(`Current OS version is: ${osInfo.version}`);
```

<Separator />

### getMemoryUsage()

The `getMemoryUsage()` method returns the total memory amount in bytes, the currently used memory, and the remaining free memory.

```ts expandable
getMemoryUsage(): Promise<SystemMemoryInfo>;
// show-more
/**
 * Returned object from `getMemoryUsage()` method.
 */
interface SystemMemoryInfo {
    used: number;
    total: number;
    free: number;
}

```

#### Return value

Resolves to an object containing total, used, and free memory in bytes.

#### Possible errors

If the memory usage is not supported.

#### Example

```ts
const memoryUsage = await sos.management.os.getMemoryUsage();
console.log(`Memory usage: ${((memoryUsage.used / memoryUsage.total) * 100).toFixed(2)}%`);
```