@@ -151,13 +151,13 @@ fapi2::ReturnCode calc_util_from_throttles(const uint16_t i_n_throttles,
151
151
// Check for the minimum
152
152
if (o_calc_util < TT::MIN_UTIL)
153
153
{
154
- FAPI_INF (" Calculated utilization (%f ) is less than the minimum utilization: %lu. Setting to minimum value" ,
155
- o_calc_util, TT::MIN_UTIL);
154
+ FAPI_INF (" Calculated utilization (%lu ) is less than the minimum utilization: %lu. Setting to minimum value" ,
155
+ static_cast < uint64_t >( o_calc_util) , TT::MIN_UTIL);
156
156
o_calc_util = TT::MIN_UTIL;
157
157
}
158
158
159
- FAPI_INF (" In calc_util_from_throttles, calculated %f for output utilization from throttles:%d, dram_clocks %d" ,
160
- o_calc_util, i_n_throttles, i_num_dram_clocks);
159
+ FAPI_INF (" In calc_util_from_throttles, calculated %lu for output utilization from throttles:%d, dram_clocks %d" ,
160
+ static_cast < uint64_t >( o_calc_util) , i_n_throttles, i_num_dram_clocks);
161
161
162
162
fapi_try_exit:
163
163
return fapi2::current_err;
@@ -605,17 +605,18 @@ fapi2::ReturnCode throttle<MC, TT>::power_regulator_throttles ()
605
605
" Failed to calculate the max and idle power for port %s" ,
606
606
mss::c_str (iv_target));
607
607
608
- FAPI_INF (" POWER throttles: %s max port power is %f" , mss::c_str (iv_target), l_port_power_calc_max);
608
+ FAPI_INF (" POWER throttles: %s max port power is %lu" , mss::c_str (iv_target),
609
+ static_cast <uint64_t >(l_port_power_calc_max));
609
610
610
611
// Calculate the power curve slope and intercept using the port's min and max power values
611
612
FAPI_TRY (calc_power_curve (l_port_power_calc_idle,
612
613
l_port_power_calc_max,
613
614
l_port_power_slope,
614
615
l_port_power_int),
615
- " Failed to calculate the power curve for port %s, calculated port power max is %f , idle is %f " ,
616
+ " Failed to calculate the power curve for port %s, calculated port power max is %lu , idle is %lu " ,
616
617
mss::c_str (iv_target),
617
- l_port_power_calc_max,
618
- l_port_power_calc_idle);
618
+ static_cast < uint64_t >( l_port_power_calc_max) ,
619
+ static_cast < uint64_t >( l_port_power_calc_idle) );
619
620
620
621
FAPI_INF (" %s POWER Port power limit is %d" , mss::c_str (iv_target), iv_port_power_limit);
621
622
// Calculate the port's utilization to get under watt target using the port's calculated slopes
@@ -624,13 +625,13 @@ fapi2::ReturnCode throttle<MC, TT>::power_regulator_throttles ()
624
625
iv_port_power_limit,
625
626
l_calc_util_port);
626
627
627
- FAPI_INF (" %s POWER calc util port is %f " , mss::c_str (iv_target), l_calc_util_port);
628
+ FAPI_INF (" %s POWER calc util port is %lu " , mss::c_str (iv_target), static_cast < uint64_t >( l_calc_util_port) );
628
629
629
630
// Calculate the new slot values and the max power value for the port
630
631
FAPI_TRY ( calc_slots_and_power ( l_calc_util_port),
631
- " %s Error calculating the final throttles and power values for target with passed in port utilization %f " ,
632
+ " %s Error calculating the final throttles and power values for target with passed in port utilization %lu " ,
632
633
mss::c_str (iv_target),
633
- l_calc_util_port);
634
+ static_cast < uint64_t >( l_calc_util_port) );
634
635
635
636
fapi_try_exit:
636
637
return fapi2::current_err;
@@ -707,7 +708,8 @@ fapi2::ReturnCode throttle<MC, TT>::thermal_throttles ()
707
708
iv_dimm_thermal_limit[l_pos],
708
709
l_calc_util[l_pos]);
709
710
710
- FAPI_INF (" THERMAL throttles: %s dram databus utilization is %f" , mss::c_str (l_dimm), l_calc_util[l_pos]);
711
+ FAPI_INF (" THERMAL throttles: %s dram databus utilization is %lu" , mss::c_str (l_dimm),
712
+ static_cast <uint64_t >(l_calc_util[l_pos]));
711
713
712
714
l_temp_n_slot = power_thermal::throttled_cmds (l_calc_util[l_pos], iv_m_clocks);
713
715
@@ -773,11 +775,11 @@ fapi2::ReturnCode throttle<MC, TT>::calc_port_power(const double i_idle_util [TT
773
775
{
774
776
const auto l_pos = mss::index (l_dimm);
775
777
// Printing as decimals because HB messes up floats
776
- FAPI_INF (" %s max dram databus for DIMM in pos %d is %d , databus for idle is %d " ,
778
+ FAPI_INF (" %s max dram databus for DIMM in pos %d is %lu , databus for idle is %lu " ,
777
779
mss::c_str (iv_target),
778
780
l_pos,
779
- static_cast <uint64_t >( i_max_util[l_pos]),
780
- static_cast <uint64_t >( i_idle_util[l_pos]) );
781
+ static_cast <uint64_t >(i_max_util[l_pos]),
782
+ static_cast <uint64_t >(i_idle_util[l_pos]) );
781
783
// Sum up the dimm's power to calculate the port power curve
782
784
o_port_power_idle += calc_power (i_idle_util[l_pos], l_pos, l_rc);
783
785
FAPI_TRY (l_rc, " calc_power failed" );
@@ -835,9 +837,9 @@ fapi2::ReturnCode throttle<MC, TT>::calc_dimm_power(const double i_databus_idle,
835
837
calc_power_uplift (iv_power_uplift_idle, o_dimm_power_idle[l_pos]);
836
838
calc_power_uplift (iv_power_uplift, o_dimm_power_max[l_pos]);
837
839
838
- FAPI_INF (" Calc_dimm_power: dimm (%d) power max is %f , dimm slope %d, intercept %d for %s" ,
840
+ FAPI_INF (" Calc_dimm_power: dimm (%d) power max is %lu , dimm slope %d, intercept %d for %s" ,
839
841
l_pos,
840
- o_dimm_power_max[l_pos],
842
+ static_cast < uint64_t >( o_dimm_power_max[l_pos]) ,
841
843
iv_pwr_slope[l_pos],
842
844
iv_pwr_int[l_pos],
843
845
mss::c_str (l_dimm));
@@ -876,11 +878,20 @@ fapi2::ReturnCode throttle<MC, TT>::calc_power_curve(const double i_power_idle,
876
878
" Calculated zero for the divisor in calc_power_curve on target %s" ,
877
879
mss::c_str (iv_target) );
878
880
881
+ FAPI_ASSERT (((i_power_max - i_power_idle) > 0 ),
882
+ fapi2::MSS_CALC_POWER_CURVE_NEGATIVE_OR_ZERO_SLOPE ()
883
+ .set_PORT_TARGET (iv_target)
884
+ .set_PORT_IDLE_POWER (i_power_idle)
885
+ .set_PORT_MAX_UTIL_POWER (i_power_max)
886
+ .set_RESULT (i_power_max - i_power_idle),
887
+ " Calculated zero or negative value for the slope in calc_power_curve (%lu - %lu) on target %s" ,
888
+ static_cast <uint64_t >(i_power_max), static_cast <uint64_t >(i_power_idle), mss::c_str (iv_target) );
889
+
879
890
o_slope = (i_power_max - i_power_idle) / l_divisor;
880
891
o_int = i_power_idle - (o_slope * TT::IDLE_UTIL);
881
- FAPI_INF (" Calc_power_curve: power idle is %f , max is %f , slope is %d, int is %d for %s" ,
882
- i_power_idle,
883
- i_power_max,
892
+ FAPI_INF (" Calc_power_curve: power idle is %lu , max is %lu , slope is %d, int is %d for %s" ,
893
+ static_cast < uint64_t >( i_power_idle) ,
894
+ static_cast < uint64_t >( i_power_max) ,
884
895
o_slope,
885
896
o_int,
886
897
mss::c_str (iv_target));
@@ -916,8 +927,8 @@ void throttle<MC, TT>::calc_util_usage(const uint32_t i_slope,
916
927
// Check for the minimum threshnold and update if need be
917
928
if (o_util < TT::MIN_UTIL)
918
929
{
919
- FAPI_INF (" Calculated utilization (%f ) is less than the minimum utilization: %lu. Setting to minimum value for %s" ,
920
- o_util,
930
+ FAPI_INF (" Calculated utilization (%lu ) is less than the minimum utilization: %lu. Setting to minimum value for %s" ,
931
+ static_cast < uint64_t >( o_util) ,
921
932
TT::MIN_UTIL, mss::c_str (iv_target));
922
933
o_util = TT::MIN_UTIL;
923
934
}
@@ -955,10 +966,10 @@ fapi2::ReturnCode throttle<MC, TT>::calc_power_from_n (const uint16_t i_n_slot,
955
966
956
967
// Determine the utilization for each DIMM that will maximize the port power
957
968
FAPI_TRY ( calc_split_util (l_calc_util_slot, l_calc_util_port, l_calc_databus_port_max),
958
- " Error splitting the utilization for target %s with slot utilizatio %f and port util %f " ,
969
+ " Error splitting the utilization for target %s with slot utilization %lu and port util %lu " ,
959
970
mss::c_str (iv_target),
960
- l_calc_util_slot,
961
- l_calc_util_port);
971
+ static_cast < uint64_t >( l_calc_util_slot) ,
972
+ static_cast < uint64_t >( l_calc_util_port) );
962
973
963
974
FAPI_TRY ( calc_port_power (l_calc_databus_port_idle,
964
975
l_calc_databus_port_max,
@@ -1051,9 +1062,9 @@ fapi2::ReturnCode throttle<MC, TT>::calc_split_util(
1051
1062
fapi2::MSS_SLOT_UTIL_EXCEEDS_PORT ()
1052
1063
.set_SLOT_UTIL (i_util_slot)
1053
1064
.set_PORT_UTIL (i_util_port),
1054
- " The slot utilization (%f ) exceeds the port's utilization (%f ) for %s" ,
1055
- i_util_slot,
1056
- i_util_port,
1065
+ " The slot utilization (%lu ) exceeds the port's utilization (%lu ) for %s" ,
1066
+ static_cast < uint64_t >( i_util_slot) ,
1067
+ static_cast < uint64_t >( i_util_port) ,
1057
1068
mss::c_str (iv_target));
1058
1069
1059
1070
if (l_count_dimms == 0 )
@@ -1070,9 +1081,9 @@ fapi2::ReturnCode throttle<MC, TT>::calc_split_util(
1070
1081
// assumptions slot <= port, l_count_dimms <=2
1071
1082
if (i_util_slot * l_count_dimms > i_util_port)
1072
1083
{
1073
- FAPI_INF (" i_util_slot is %f , i_util_port is %f , l_count_dimms is %d for %s" ,
1074
- i_util_slot,
1075
- i_util_port,
1084
+ FAPI_INF (" i_util_slot is %lu , i_util_port is %lu , l_count_dimms is %d for %s" ,
1085
+ static_cast < uint64_t >( i_util_slot) ,
1086
+ static_cast < uint64_t >( i_util_port) ,
1076
1087
l_count_dimms,
1077
1088
mss::c_str (iv_target));
1078
1089
const uint8_t l_high_pos = (iv_pwr_slope[0 ] >= iv_pwr_slope[1 ]) ? 0 : 1 ;
@@ -1087,12 +1098,12 @@ fapi2::ReturnCode throttle<MC, TT>::calc_split_util(
1087
1098
0
1088
1099
);
1089
1100
1090
- FAPI_INF (" Split utilization for target %s, DIMM in %d gets %f , DIMM in %d gets %f " ,
1101
+ FAPI_INF (" Split utilization for target %s, DIMM in %d gets %lu , DIMM in %d gets %lu " ,
1091
1102
mss::c_str (iv_target),
1092
1103
l_high_pos,
1093
- o_util_dimm_max[l_high_pos],
1104
+ static_cast < uint64_t >( o_util_dimm_max[l_high_pos]) ,
1094
1105
!l_high_pos,
1095
- o_util_dimm_max[!l_high_pos]);
1106
+ static_cast < uint64_t >( o_util_dimm_max[!l_high_pos]) );
1096
1107
}
1097
1108
else
1098
1109
{
0 commit comments