:_module-type: REFERENCE
[id="built-in-functions-available-in-tuned-profiles_{context}"]
= Built-in functions available in TuneD profiles

[role="_abstract"]
The following built-in functions are available in all *TuneD* profiles:

`PROFILE_DIR`::
Returns the directory path where the profile and the `tuned.conf` file are located.

`exec`::
Executes a process and returns its output.

`assertion`::
Compares two arguments. If they _do not match_, the function logs text from the first argument and aborts profile loading.

`assertion_non_equal`::
Compares two arguments. If they _match_, the function logs text from the first argument and aborts profile loading.

`kb2s`::
Converts kilobytes to disk sectors.

`s2kb`::
Converts disk sectors to kilobytes.

`strip`::
Creates a string from all passed arguments and deletes both leading and trailing white space.

`virt_check`::
Checks whether *TuneD* is running inside a virtual machine (VM) or on bare metal:
+
* Inside a VM, the function returns the first argument.
* On bare metal, the function returns the second argument, even in case of an error.

`cpulist_invert`::
Inverts a list of CPUs to make its complement. For example, on a system with 4 CPUs, numbered from 0 to 3, the inversion of the list `0,2,3` is `1`.

`cpulist2hex`::
Converts a CPU list to a hexadecimal CPU mask.

`cpulist2hex_invert`::
Converts a CPU list to a hexadecimal CPU mask and inverts it.

`hex2cpulist`::
Converts a hexadecimal CPU mask to a CPU list.

`cpulist_online`::
Checks whether the CPUs from the list are online. Returns the list containing only online CPUs.

`cpulist_present`::
Checks whether the CPUs from the list are present. Returns the list containing only present CPUs.

`cpulist_unpack`::
Unpacks a CPU list in the form of `1-3,4` to `1,2,3,4`.

`cpulist_pack`::
Packs a CPU list in the form of `1,2,3,5` to `1-3,5`.

`intel_recommended_pstate`::
Returns recommended intel_pstate CPUFreq driver mode based on processor generation.
