Structures and functions to change frequency at the scale of a CPU core.
More...
Go to the source code of this file.
|
| int | dvfs_core_open (dvfs_core **ppCore, unsigned int id, bool seq) |
| | Opens the Core context for the given core ID. More...
|
| |
| int | dvfs_core_close (dvfs_core *core) |
| | Closes properly an opened Core context. More...
|
| |
| int | dvfs_core_get_gov (const dvfs_core *core, char *buf, size_t buf_len) |
| | Sets the current DVFS governor on the given core to the given buffer. More...
|
| |
| int | dvfs_core_set_gov (const dvfs_core *core, const char *gov) |
| | Changes the governor on the given core. More...
|
| |
| int | dvfs_core_set_freq (const dvfs_core *core, unsigned int freq) |
| | Sets the frequency for the given core. More...
|
| |
| int | dvfs_core_get_current_freq (const dvfs_core *core, unsigned int *pFreq) |
| | Gets the frequency currently set for the core. More...
|
| |
| int | dvfs_core_get_freq (const dvfs_core *core, unsigned int *pFreq, unsigned int freq_id) |
| | Gets the frequency currently set for the core. More...
|
| |
| int | dvfs_core_get_nb_freqs (const dvfs_core *core, unsigned int *pNbFreq) |
| | Gets the number of frequencies available for the core. More...
|
| |
| int | dvfs_core_get_id (const dvfs_core *core, unsigned int *pID) |
| | Gets the ID of the DVFS core. More...
|
| |
Structures and functions to change frequency at the scale of a CPU core.
Closes properly an opened Core context.
Sets back the governor that was in place when opening the context.
- Parameters
-
- Returns
- Return values
-
| DVFS_SUCCESS | if everything goes right. |
| DVFS_ERROR_INVALID_ARG | if core is NULL. |
| int dvfs_core_get_current_freq |
( |
const dvfs_core * |
core, |
|
|
unsigned int * |
pFreq |
|
) |
| |
Gets the frequency currently set for the core.
Warning, this is not necessarily the frequency currently active for the core as other cores in the same unit may have requested a different frequency. In order to determine the frequency actually set for the core, use instead dvfs_unit_get_freq().
- Parameters
-
| core | The CPU core. |
| pFreq | The frequency currently set. |
- Returns
- Return values
-
| DVFS_SUCCESS | if everything goes right. |
| DVFS_ERROR_INVALID_ARG | if core or buf are NULL. |
| DVFS_ERROR_FILE_ERROR | operation on file failed (you can check errno for more details). |
- See also
- dvfs_unit_get_freq()
| int dvfs_core_get_freq |
( |
const dvfs_core * |
core, |
|
|
unsigned int * |
pFreq, |
|
|
unsigned int |
freq_id |
|
) |
| |
Gets the frequency currently set for the core.
- Parameters
-
| core | The CPU core. |
| pFreq | The frequency currentlu set |
| freq_id | The id of the frequency with respect to the order in the freqs internal array |
- Returns
- Return values
-
| DVFS_SUCCESS | if everything goes right. |
| DVFS_ERROR_INVALID_ARG | if core or pFreq are NULL. |
| DVFS_ERROR_INVALID_FREQ_ID | the id passed is not valid |
| int dvfs_core_get_gov |
( |
const dvfs_core * |
core, |
|
|
char * |
buf, |
|
|
size_t |
buf_len |
|
) |
| |
Sets the current DVFS governor on the given core to the given buffer.
- Parameters
-
| core | The core on which the governor has to be set. |
| buf | The pointer to the buffer which will be set to the governor string value |
| buf_len | The size of the buffer |
- Returns
- Return values
-
| DVFS_SUCCESS | if everything goes right. |
| DVFS_ERROR_INVALID_ARG | if core or buf are NULL. |
| DVFS_ERROR_BUFFER_TOO_SHORT | if the buffer for the path to the governor file is too short |
| DVFS_ERROR_FILE_ERROR | operation on file failed (you can check errno for more details). |
| int dvfs_core_get_id |
( |
const dvfs_core * |
core, |
|
|
unsigned int * |
pID |
|
) |
| |
Gets the ID of the DVFS core.
- Parameters
-
| core | The CPU core. |
| pID | Will be filled with the ID |
- Returns
- Return values
-
| DVFS_SUCCESS | if everything goes right. |
| DVFS_ERROR_INVALID_ARG | if core or pNbFreq are NULL. |
| int dvfs_core_get_nb_freqs |
( |
const dvfs_core * |
core, |
|
|
unsigned int * |
pNbFreq |
|
) |
| |
Gets the number of frequencies available for the core.
- Parameters
-
| core | The CPU core. |
| pNbFreq | The number of frequencies available for the core |
- Returns
- Return values
-
| DVFS_SUCCESS | if everything goes right. |
| DVFS_ERROR_INVALID_ARG | if core or pNbFreq are NULL. |
| int dvfs_core_open |
( |
dvfs_core ** |
ppCore, |
|
|
unsigned int |
id, |
|
|
bool |
seq |
|
) |
| |
Opens the Core context for the given core ID.
The dvfs_core is valid even if the semaphore failed. The frequency transitions will not be seqeuntialized.
- Parameters
-
| ppCore | the instanciated Core context for this core. May return NULL in case of error. The error cases are often related to file opening (such as permission denied). In such cases errno is set appropriately. |
| id | The id of the core to control. |
| seq | True when the frequency transitions must be sequentialized. |
- Returns
- Return values
-
| DVFS_SUCCESS | if everything goes right. |
| DVFS_ERROR_INVALID_ARG | if ppUnit or cores are NULL. |
| DVFS_ERROR_MEM_ALLOC_FAILED | if memory allocation failed. |
- See also
- dvfs_core_close()
| int dvfs_core_set_freq |
( |
const dvfs_core * |
core, |
|
|
unsigned int |
freq |
|
) |
| |
Sets the frequency for the given core.
Assumes that the "userspace" governor has been set, result is unknown otherwise.
- Parameters
-
| core | The related core. |
| freq | The frequency to set. |
- Returns
- Return values
-
| DVFS_SUCCESS | if everything goes right. |
| DVFS_ERROR_INVALID_ARG | if core or buf are NULL. |
| DVFS_ERROR_SET_FREQ_FILE | frequency file not operational. |
| DVFS_ERROR_FILE_ERROR | operation on file failed (you can check errno for more details). |
| int dvfs_core_set_gov |
( |
const dvfs_core * |
core, |
|
|
const char * |
gov |
|
) |
| |
Changes the governor on the given core.
- Parameters
-
| core | The core on which the governor has to be set. |
| gov | The governor to set. |
- Returns
- Return values
-
| DVFS_SUCCESS | if everything goes right. |
| DVFS_ERROR_INVALID_ARG | if core or buf are NULL. |
| DVFS_ERROR_BUFFER_TOO_SHORT | if the buffer for the path to the governor file is too short. |
| DVFS_ERROR_FILE_ERROR | operation on file failed (you can check errno for more details). |