OsinfoResources

## OsinfoResources OsinfoResources — Required or recommended resources for an (guest) OS |

## Functions

OsinfoResources * | osinfo_resources_new ()
const gchar * | osinfo_resources_get_architecture ()
gint | osinfo_resources_get_n_cpus ()
gint64 | osinfo_resources_get_cpu ()
gint64 | osinfo_resources_get_ram ()
gint64 | osinfo_resources_get_storage ()
void | osinfo_resources_set_n_cpus ()
void | osinfo_resources_set_cpu ()
void | osinfo_resources_set_ram ()
void | osinfo_resources_set_storage ()

## Properties

gchar * | architecture | Read / Write / Construct Only
gint64 | cpu | Read / Write
gint | n-cpus | Read / Write
gint64 | ram | Read / Write
gint64 | storage | Read / Write

## Types and Values

#define | OSINFO_ARCHITECTURE_ALL
#define | OSINFO_MEGAHERTZ
#define | OSINFO_KIBIBYTES
#define | OSINFO_MEBIBYTES
#define | OSINFO_GIBIBYTES
#define | OSINFO_RESOURCES_PROP_ARCHITECTURE
#define | OSINFO_RESOURCES_PROP_CPU
#define | OSINFO_RESOURCES_PROP_N_CPUS
#define | OSINFO_RESOURCES_PROP_RAM
#define | OSINFO_RESOURCES_PROP_STORAGE

## Object Hierarchy

        GObject
        ╰── OsinfoEntity
            ╰── OsinfoResources

## Description

OsinfoResources is an entity representing required or recommended resources for an (guest) operating system.

## Functions

### osinfo_resources_new ()

    OsinfoResources *
    osinfo_resources_new (const gchar *id,
                          const gchar *architecture);

### osinfo_resources_get_architecture ()

    const gchar *
    osinfo_resources_get_architecture (OsinfoResources *resources);

Retrieves the target hardware architecture to which `resources` applies. Some operating systems specify the same requirements and recommendations for all architectures. In such cases, the string returned by this call will be OSINFO_ARCHITECTURE_ALL.

#### Parameters

resources | an OsinfoResources instance |

#### Returns

the hardware architecture.

[transfer none]

### osinfo_resources_get_n_cpus ()

    gint
    osinfo_resources_get_n_cpus (OsinfoResources *resources);

Retrieves the number of CPUs.

#### Parameters

resources | an OsinfoResources instance |

#### Returns

the number of CPUs, or -1.

### osinfo_resources_get_cpu ()

    gint64
    osinfo_resources_get_cpu (OsinfoResources *resources);

Retrieves the CPU frequency in hertz (Hz). Divide the value by OSINFO_MEGAHERTZ if you need this value in megahertz (MHz).

#### Parameters

resources | an OsinfoResources instance |

#### Returns

the CPU frequency, or -1.

### osinfo_resources_get_ram ()

    gint64
    osinfo_resources_get_ram (OsinfoResources *resources);

Retrieves the amount of Random Access Memory (RAM) in bytes. Divide the value by OSINFO_MEBIBYTES if you need this value in mebibytes.

#### Parameters

resources | an OsinfoResources instance |

#### Returns

the amount of RAM, or -1.

### osinfo_resources_get_storage ()

    gint64
    osinfo_resources_get_storage (OsinfoResources *resources);

Retrieves the amount of storage space in bytes. Divide the value by OSINFO_GIBIBYTES if you need this value in gibibytes.

#### Parameters

resources | an OsinfoResources instance |

#### Returns

the amount of storage, or -1.

### osinfo_resources_set_n_cpus ()

    void
    osinfo_resources_set_n_cpus (OsinfoResources *resources,
                                 gint n_cpus);

Sets the number of CPUs.

#### Parameters

resources | an OsinfoResources instance |
n_cpus | the number of CPUs |

### osinfo_resources_set_cpu ()

    void
    osinfo_resources_set_cpu (OsinfoResources *resources,
                              gint64 cpu);

Sets the CPU frequency.

#### Parameters

resources | an OsinfoResources instance |
cpu | the CPU frequency in hertz (Hz) |

### osinfo_resources_set_ram ()

    void
    osinfo_resources_set_ram (OsinfoResources *resources,
                              gint64 ram);

Sets the amount of RAM in bytes.

#### Parameters

resources | an OsinfoResources instance |
ram | the amount of ram in bytes |

### osinfo_resources_set_storage ()

    void
    osinfo_resources_set_storage (OsinfoResources *resources,
                                  gint64 storage);

Sets the amount of storage space.

#### Parameters

resources | an OsinfoResources instance |
storage | the amount of storage in bytes |

## Types and Values

### OSINFO_ARCHITECTURE_ALL

    #define OSINFO_ARCHITECTURE_ALL "all"

### OSINFO_MEGAHERTZ

    #define OSINFO_MEGAHERTZ        1000000

### OSINFO_KIBIBYTES

    #define OSINFO_KIBIBYTES        1024

### OSINFO_MEBIBYTES

    #define OSINFO_MEBIBYTES        1048576

### OSINFO_GIBIBYTES

    #define OSINFO_GIBIBYTES        1073741824

### OSINFO_RESOURCES_PROP_ARCHITECTURE

    #define OSINFO_RESOURCES_PROP_ARCHITECTURE "architecture"

### OSINFO_RESOURCES_PROP_CPU

    #define OSINFO_RESOURCES_PROP_CPU          "cpu"

### OSINFO_RESOURCES_PROP_N_CPUS

    #define OSINFO_RESOURCES_PROP_N_CPUS       "n-cpus"

### OSINFO_RESOURCES_PROP_RAM

    #define OSINFO_RESOURCES_PROP_RAM          "ram"

### OSINFO_RESOURCES_PROP_STORAGE

    #define OSINFO_RESOURCES_PROP_STORAGE      "storage"

## Property Details

### The `“architecture”` property

      “architecture”             gchar *

The target hardware architecture to which these resources applies.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“cpu”` property

      “cpu”                      gint64

The CPU frequency in hertz (Hz).

Flags: Read / Write

Allowed values: [-1,2147483647]

Default value: -1

### The `“n-cpus”` property

      “n-cpus”                   gint

The number of CPUs.

Flags: Read / Write

Allowed values: >= -1

Default value: -1

### The `“ram”` property

      “ram”                      gint64

The amount of Random Access Memory (RAM) in bytes.

Flags: Read / Write

Allowed values: >= -1

Default value: -1

### The `“storage”` property

      “storage”                  gint64

The amount of storage space in bytes.

Flags: Read / Write

Allowed values: >= -1

Default value: -1

## See Also

OsinfoOs