## osinfo_resources

osinfo_resources — 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 ()

## Types and Values

#define | OSINFO_ARCHITECTURE_ALL
#define | OSINFO_MEGAHERTZ
#define | OSINFO_KIBIBYTES
#define | OSINFO_MEBIBYTES
#define | OSINFO_GIBIBYTES
#define | OSINFO_TYPE_RESOURCES
#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

## 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_TYPE_RESOURCES

    #define OSINFO_TYPE_RESOURCES (osinfo_resources_get_type ())

### 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"

## See Also

OsinfoOs