コード例 #1
0
ファイル: cpumeter.cpp プロジェクト: kuailexs/symbiandump-os1
TInt CCpuMeter::Construct()
{
    iNumCpus = NumberOfCpus();
    iNullThreads = (RThread*)User::AllocZ(iNumCpus*sizeof(RThread));
    iDelta = (TInt*)User::AllocZ(iNumCpus*sizeof(TInt));
    iMeas[0] = (TTimeIntervalMicroSeconds*)User::AllocZ(iNumCpus*sizeof(TTimeIntervalMicroSeconds));
    iMeas[1] = (TTimeIntervalMicroSeconds*)User::AllocZ(iNumCpus*sizeof(TTimeIntervalMicroSeconds));
    if (!iNullThreads || !iDelta || !iMeas[0] || !iMeas[1])
        return KErrNoMemory;
    TFullName kname;
    _LIT(KLitKernelName, "ekern.exe*");
    _LIT(KLitNull, "::Null");
    TFindProcess fp(KLitKernelName);
    test_KErrNone(fp.Next(kname));
    test.Printf(_L("Found kernel process: %S\n"), &kname);
    kname.Append(KLitNull);
    TInt i;
    for (i=0; i<iNumCpus; ++i)
    {
        TFullName tname(kname);
        TFullName tname2;
        if (i>0)
            tname.AppendNum(i);
        TFindThread ft(tname);
        test_KErrNone(ft.Next(tname2));
        TInt r = iNullThreads[i].Open(ft);
        test_KErrNone(r);
        iNullThreads[i].FullName(tname2);
        test.Printf(_L("Found and opened %S\n"), &tname2);
    }
    for (i=0; i<iNumCpus; ++i)
        iNullThreads[i].GetCpuTime(iMeas[0][i]);
    iNextMeas = 1;
    return KErrNone;
}
コード例 #2
0
ファイル: info.cpp プロジェクト: Frankie-666/tomita-parser
size_t NSystemInfo::CachedNumberOfCpus() {
    if (!NCpus) {
        NCpus = NumberOfCpus();
    }

    return NCpus;
}
コード例 #3
0
ファイル: cpumeter.cpp プロジェクト: kuailexs/symbiandump-os1
GLDEF_C TInt E32Main()
{
    test.SetLogged(EFalse);
    test.Title();
    RThread().SetPriority(EPriorityAbsoluteHigh);

    if (CpuTimeSupported())
    {
        UseKernelCpuTime();
    }
    if (NumberOfCpus()>1)
    {
        test.Printf(_L("Needs RThread::GetCpuTime() on SMP systems\n"));
    }
    else
        MeasureByNOPs();

    return 0;
}