--- a/kerneltest/e32test/misc/cpumeter.cpp Tue Feb 02 01:24:03 2010 +0200
+++ b/kerneltest/e32test/misc/cpumeter.cpp Fri Apr 16 16:24:37 2010 +0300
@@ -48,6 +48,8 @@
TInt Construct();
void Measure();
void Display(TInt aInterval);
+ void DisplayCoreControlInfo();
+ void ChangeNumberOfCores(TInt aNum);
public:
TInt iNumCpus;
TInt iNextMeas;
@@ -152,6 +154,38 @@
test.Printf(buf);
}
+void CCpuMeter::DisplayCoreControlInfo()
+ {
+ SCpuStates s;
+ TInt r = UserSvr::HalFunction(EHalGroupKernel, EKernelHalCpuStates, &s, 0);
+ if (r != KErrNone)
+ {
+ test.Printf(_L("Error %d\n"), r);
+ return;
+ }
+ test.SetLogged(ETrue);
+ test.Printf(_L(" TA=%08x IA=%08x CU=%08x GD=%08x DC=%08x\n"), s.iTA, s.iIA, s.iCU, s.iGD, s.iDC);
+ test.Printf(_L(" SC=%08x RC=%08x PO=%02x CCS=%08x PODC=%08x\n"), s.iSC, s.iRC, s.iPO, s.iCCS, s.iPODC);
+ TInt i;
+ for (i=0; i<iNumCpus; ++i)
+ {
+ test.Printf(_L("%1d:DS=%08x UDC=%08x UAC=%08x OP=%08x F=%08x\n"), i, s.iDS[i], s.iUDC[i], s.iUAC[i], s.iOP[i], s.iF[i]);
+ }
+ test.SetLogged(EFalse);
+ }
+
+void CCpuMeter::ChangeNumberOfCores(TInt aNum)
+ {
+ test.SetLogged(ETrue);
+ test.Printf(_L("#CORES->%d\n"), aNum);
+ TInt r = UserSvr::HalFunction(EHalGroupKernel, EKernelHalSetNumberOfCpus, (TAny*)aNum, 0);
+ if (r != KErrNone)
+ {
+ test.Printf(_L("Error %d\n"), r);
+ }
+ test.SetLogged(EFalse);
+ }
+
void UseKernelCpuTime()
{
test.Start(_L("Create CCpuMeter"));
@@ -175,6 +209,14 @@
delete m;
return;
}
+ if (m->iNumCpus > 1)
+ {
+ // SMP only options
+ if (k == EKeySpace)
+ m->DisplayCoreControlInfo();
+ else if (k>='1' && k<=('0'+m->iNumCpus))
+ m->ChangeNumberOfCores(k - '0');
+ }
console->Read(s);
}
}