Skip to content

Commit 4307815

Browse files
committed
Use the Manufacturer's Power Time Window formula.
1 parent 7941075 commit 4307815

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

corefreqd.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,6 +1382,11 @@ void HyperThreading(RO(SHM_STRUCT) *RO(Shm), RO(PROC) *RO(Proc))
13821382
RO(Shm)->Proc.Features.HyperThreading = RO(Proc)->Features.HTT_Enable;
13831383
}
13841384

1385+
double TW_Manufacturer(unsigned short Y, unsigned short Z, double TU)
1386+
{
1387+
return (1 << Y) * (1 + Z/4) * TU;
1388+
}
1389+
13851390
void PowerInterface(RO(SHM_STRUCT) *RO(Shm), RO(PROC) *RO(Proc))
13861391
{
13871392
unsigned short pwrUnits = 0, pwrVal;
@@ -1490,20 +1495,16 @@ void PowerInterface(RO(SHM_STRUCT) *RO(Shm), RO(PROC) *RO(Proc))
14901495
}
14911496
for (pw = PWR_DOMAIN(PKG); pw < PWR_DOMAIN(SIZE); pw++)
14921497
{
1493-
unsigned long long duration;
1494-
duration = (1 << RO(Proc)->PowerThermal.PowerLimit[pw].TimeWindow1_Y);
1495-
duration *= (4 + RO(Proc)->PowerThermal.PowerLimit[pw].TimeWindow1_Z);
1496-
duration = duration >> 2;
1497-
1498-
RO(Shm)->Proc.Power.Domain[pw].TW1 = RO(Shm)->Proc.Power.Unit.Times
1499-
* (double)duration;
1500-
1501-
duration = (1 << RO(Proc)->PowerThermal.PowerLimit[pw].TimeWindow2_Y);
1502-
duration *= (4 + RO(Proc)->PowerThermal.PowerLimit[pw].TimeWindow2_Z);
1503-
duration = duration >> 2;
1504-
1505-
RO(Shm)->Proc.Power.Domain[pw].TW2 = RO(Shm)->Proc.Power.Unit.Times
1506-
* (double)duration;
1498+
RO(Shm)->Proc.Power.Domain[pw].TW1 = TW_Manufacturer(
1499+
RO(Proc)->PowerThermal.PowerLimit[pw].TimeWindow1_Y,
1500+
RO(Proc)->PowerThermal.PowerLimit[pw].TimeWindow1_Z,
1501+
RO(Shm)->Proc.Power.Unit.Times
1502+
);
1503+
RO(Shm)->Proc.Power.Domain[pw].TW2 = TW_Manufacturer(
1504+
RO(Proc)->PowerThermal.PowerLimit[pw].TimeWindow2_Y,
1505+
RO(Proc)->PowerThermal.PowerLimit[pw].TimeWindow2_Z,
1506+
RO(Shm)->Proc.Power.Unit.Times
1507+
);
15071508
}
15081509
RO(Shm)->Proc.Power.TDC = RO(Proc)->PowerThermal.TDC;
15091510
RO(Shm)->Proc.Power.Feature.TDC=RO(Proc)->PowerThermal.Enable_Limit.TDC;

0 commit comments

Comments
 (0)