Skip to content

Commit

Permalink
[AArch64] Scale the absolute frequency to the monitoring interval
Browse files Browse the repository at this point in the history
  • Loading branch information
cyring committed Feb 10, 2024
1 parent 1f7f952 commit ccc8927
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions aarch64/corefreqk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2822,9 +2822,8 @@ void Generic_Core_Counters_Clear(union SAVE_AREA_CORE *Save, CORE_RO *Core)
static enum hrtimer_restart Cycle_GenericMachine(struct hrtimer *pTimer)
{
CORE_RO *Core;
unsigned int cpu;

cpu = smp_processor_id();
register unsigned long long Q, D;
const unsigned int cpu = smp_processor_id();
Core = (CORE_RO *) PUBLIC(RO(Core, AT(cpu)));

RDTSC64(Core->Overhead.TSC);
Expand Down Expand Up @@ -2864,16 +2863,16 @@ static enum hrtimer_restart Cycle_GenericMachine(struct hrtimer *pTimer)

Save_C1(Core);

if (Core->Delta.C0.URC > 1000000LLU) {
unsigned long long Q, R;
Q = Core->Delta.C0.URC / (1000000LLU * PRECISION);
R = Core->Delta.C0.URC - (Q * (1000000LLU * PRECISION));
R = R / UNIT_KHz(PRECISION);
Core->Ratio.COF.Q = Q;
Core->Ratio.COF.R = R;
} else {
Core->Ratio.Perf = Core->Boost[BOOST(MIN)];
}
Q = Core->Delta.C0.URC * Core->Clock.Q,
D = UNIT_MHz(10LLU * PUBLIC(RO(Proc))->SleepInterval);

Core->Ratio.COF.Q = Q / D;
if (Core->Ratio.COF.Q < Core->Boost[BOOST(MIN)]) {
Core->Ratio.Perf = Core->Boost[BOOST(MIN)];
} else {
Core->Ratio.COF.R = (Q - (Core->Ratio.COF.Q * D))
/ UNIT_KHz(10000LLU);
}
BITSET(LOCKLESS, PUBLIC(RW(Core, AT(cpu)))->Sync.V, NTFY);

return HRTIMER_RESTART;
Expand Down

0 comments on commit ccc8927

Please sign in to comment.