make power multi var generic, attribute of each profile

This commit is contained in:
Josh Lay 2022-11-26 22:43:52 -06:00
parent 4dff0b95ab
commit 40028e5229
Signed by: jlay
GPG key ID: B265E45CACAD108A
3 changed files with 29 additions and 37 deletions

View file

@ -1,17 +1,14 @@
---
# misc default vars handling unit conversion RE: power capabilities/limits
#
# the discovered board limit for power capability
# the discovered board limit for power capability (in microWatts)
power_max: "{{ power_max_b64['content'] | b64decode }}"
board_watts: "{{ power_max|int/1000000 }}"
# convert discovered board power limit (int) to a float
# for some math in the tuned config template
power_max_float: "{{ power_max_b64['content'] | b64decode |float }}"
# determine the microWatt limits based on the provided multipliers
power_cap_custom_float: "{{ power_max |float * power_max_custom_multi }}"
power_cap_default_float: "{{ power_max |float * power_max_default_multi }}"
# convert the microWatt limits to ints for some math - also in the tuned config template
power_cap_custom: "{{ power_cap_custom_float |int }}"
power_cap_default: "{{ power_cap_default_float |int }}"
# internals for profile power calculations
# item in the context of the with_nested loops in the play
profile_name: "{{ item.0.key }}"
profile_percentage: "{{ (item.0.value.pwr_cap_multi * 100.0) | round(2) }}"
profile_multi: "{{ item.0.value.pwr_cap_multi }}"
profile_microwatts: "{{ power_max | float * profile_multi | float }}"
profile_watts: "{{ profile_microwatts | int/1000000 }}"