mendevi.database.complete

Fill the SQL database.

Functions

add_environment(database)

Complete the environment table with the current environment.

get_idle([duration])

Measure the idle consumption.

Details

mendevi.database.complete.add_environment(database: Cursor | str | bytes | Path) int[source]

Complete the environment table with the current environment.

Parameters

databasepathlike

The path of the existing database to be updated.

Returns

idint

The primary key of the freshly updated environment table.

Examples

>>> import os, tempfile
>>> from mendevi.database.complete import add_environment
>>> from mendevi.database.create import create_database
>>> create_database(database := tempfile.mktemp(suffix=".sqlite"))
>>> add_environment(database)
1
>>> os.remove(database)
>>>
mendevi.database.complete.get_idle(duration: float = 60.0) dict[source]

Measure the idle consumption.

Parameters

durationfloat, default=60

The total duration of the measurement, bloking time in second.

Returns

measuresdict

duration: float, the real measure duration ps_core: list[list[float]], tensor of detailed usage of each logical core in % ps_dt: list[float], the duration of each interval in seconds ps_ram: list[int], list of the sampled ram usage in bytes in each point rapl_dt: list[float], the duration of each interval in seconds rapl_power: list[float], the average power in watt in each interval start: float, absolute timestamp wattmeter_dt: list[float], the duration of each interval in seconds wattmeter_power: list[float], the sampled power in watt in each point

Examples

>>> from mendevi.database.complete import get_idle
>>> get_idle()
>>>