VirtualBox

Ignore:
Timestamp:
Apr 8, 2013 10:18:06 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
84826
Message:

HostDrivers/Support/testcase/tstGIP-2.cpp: handle the CPU count correctly, especially important with async TSC handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp

    r44528 r45399  
    55
    66/*
    7  * Copyright (C) 2006-2011 Oracle Corporation
     7 * Copyright (C) 2006-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    9797        if (g_pSUPGlobalInfoPage)
    9898        {
    99             RTPrintf("tstGIP-2: u32UpdateHz=%RU32  u32UpdateIntervalNS=%RU32  u64NanoTSLastUpdateHz=%RX64  u32Mode=%d (%s) u32Version=%#x\n",
     99            RTPrintf("tstGIP-2: cCpus=%d  u32UpdateHz=%RU32  u32UpdateIntervalNS=%RU32  u64NanoTSLastUpdateHz=%RX64  u32Mode=%d (%s) u32Version=%#x\n",
     100                     g_pSUPGlobalInfoPage->cCpus,
    100101                     g_pSUPGlobalInfoPage->u32UpdateHz,
    101102                     g_pSUPGlobalInfoPage->u32UpdateIntervalNS,
     
    109110                     ? "tstGIP-2:     it: u64NanoTS        delta     u64TSC           UpIntTSC H  TransId           CpuHz TSC Interval History...\n"
    110111                     : "tstGIP-2:     it: u64NanoTS        delta     u64TSC             UpIntTSC H    TransId           CpuHz TSC Interval History...\n");
    111             static SUPGIPCPU s_aaCPUs[2][RT_ELEMENTS(g_pSUPGlobalInfoPage->aCPUs)];
     112            static SUPGIPCPU s_aaCPUs[2][256];
    112113            for (uint32_t i = 0; i < cIterations; i++)
    113114            {
    114115                /* copy the data */
    115                 memcpy(&s_aaCPUs[i & 1][0], &g_pSUPGlobalInfoPage->aCPUs[0], sizeof(g_pSUPGlobalInfoPage->aCPUs));
     116                memcpy(&s_aaCPUs[i & 1][0], &g_pSUPGlobalInfoPage->aCPUs[0], g_pSUPGlobalInfoPage->cCpus * sizeof(g_pSUPGlobalInfoPage->aCPUs[0]));
    116117
    117118                /* display it & find something to spin on. */
    118119                uint32_t u32TransactionId = 0;
    119120                uint32_t volatile *pu32TransactionId = NULL;
    120                 for (unsigned iCpu = 0; iCpu < RT_ELEMENTS(g_pSUPGlobalInfoPage->aCPUs); iCpu++)
     121                for (unsigned iCpu = 0; iCpu < g_pSUPGlobalInfoPage->cCpus; iCpu++)
    121122                    if (    g_pSUPGlobalInfoPage->aCPUs[iCpu].u64CpuHz > 0
    122123                        &&  g_pSUPGlobalInfoPage->aCPUs[iCpu].u64CpuHz != _4G + 1)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette