VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp@ 3874

Last change on this file since 3874 was 2981, checked in by vboxsync, 18 years ago

InnoTek -> innotek: all the headers and comments.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/** @file
2 *
3 * VBox host drivers - Ring-0 support drivers - Testcases:
4 * Test the Global Info Page interface
5 */
6
7/*
8 * Copyright (C) 2006-2007 innotek GmbH
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * If you received this file as part of a commercial VirtualBox
19 * distribution, then only the terms of your commercial VirtualBox
20 * license agreement apply instead of the previous paragraph.
21 */
22
23/*******************************************************************************
24* Header Files *
25*******************************************************************************/
26#include <VBox/sup.h>
27#include <VBox/err.h>
28#include <VBox/param.h>
29#include <iprt/asm.h>
30#include <iprt/assert.h>
31#include <iprt/alloc.h>
32#include <iprt/thread.h>
33#include <iprt/stream.h>
34#include <iprt/runtime.h>
35
36
37int main(void)
38{
39 RTR3Init();
40
41 /*
42 * Init
43 */
44 PSUPDRVSESSION pSession = NIL_RTR0PTR;
45 int rc = SUPInit(&pSession);
46 if (VBOX_SUCCESS(rc))
47 {
48 if (g_pSUPGlobalInfoPage)
49 {
50 RTPrintf("tstGIP-2: u32UpdateHz=%RU32 u32UpdateIntervalNS=%RU32 u64NanoTSLastUpdateHz=%RX64 u32Mode=%d (%s) u32Version=%#x\n"
51 "tstGIP-2: it: u64NanoTS u64TSC UpIntTSC H TransId CpuHz TSC Interval History...\n",
52 g_pSUPGlobalInfoPage->u32UpdateHz,
53 g_pSUPGlobalInfoPage->u32UpdateIntervalNS,
54 g_pSUPGlobalInfoPage->u64NanoTSLastUpdateHz,
55 g_pSUPGlobalInfoPage->u32Mode,
56 g_pSUPGlobalInfoPage->u32Mode == SUPGIPMODE_SYNC_TSC ? "sync"
57 : g_pSUPGlobalInfoPage->u32Mode == SUPGIPMODE_ASYNC_TSC ? "async"
58 : "???",
59 g_pSUPGlobalInfoPage->u32Version);
60 for (int i = 0; i < 80; i++)
61 {
62 for (unsigned iCpu = 0; iCpu < RT_ELEMENTS(g_pSUPGlobalInfoPage->aCPUs); iCpu++)
63 if ( g_pSUPGlobalInfoPage->aCPUs[iCpu].u64CpuHz > 0
64 && g_pSUPGlobalInfoPage->aCPUs[iCpu].u64CpuHz != _4G + 1)
65 RTPrintf("tstGIP-2: %2d/%d: %016llx %016llx %08x %d %08x %15llu %08x %08x %08x %08x %08x %08x %08x %08x (%d)\n",
66 i, iCpu,
67 g_pSUPGlobalInfoPage->aCPUs[iCpu].u64NanoTS,
68 g_pSUPGlobalInfoPage->aCPUs[iCpu].u64TSC,
69 g_pSUPGlobalInfoPage->aCPUs[iCpu].u32UpdateIntervalTSC,
70 g_pSUPGlobalInfoPage->aCPUs[iCpu].iTSCHistoryHead,
71 g_pSUPGlobalInfoPage->aCPUs[iCpu].u32TransactionId,
72 g_pSUPGlobalInfoPage->aCPUs[iCpu].u64CpuHz,
73 g_pSUPGlobalInfoPage->aCPUs[iCpu].au32TSCHistory[0],
74 g_pSUPGlobalInfoPage->aCPUs[iCpu].au32TSCHistory[1],
75 g_pSUPGlobalInfoPage->aCPUs[iCpu].au32TSCHistory[2],
76 g_pSUPGlobalInfoPage->aCPUs[iCpu].au32TSCHistory[3],
77 g_pSUPGlobalInfoPage->aCPUs[iCpu].au32TSCHistory[4],
78 g_pSUPGlobalInfoPage->aCPUs[iCpu].au32TSCHistory[5],
79 g_pSUPGlobalInfoPage->aCPUs[iCpu].au32TSCHistory[6],
80 g_pSUPGlobalInfoPage->aCPUs[iCpu].au32TSCHistory[7],
81 g_pSUPGlobalInfoPage->aCPUs[iCpu].cErrors);
82 RTThreadSleep(9);
83 }
84 }
85 else
86 {
87 RTPrintf("tstGIP-2: g_pSUPGlobalInfoPage is NULL\n");
88 rc = -1;
89 }
90
91 SUPTerm();
92 }
93 else
94 RTPrintf("tstGIP-2: SUPInit failed: %Vrc\n", rc);
95 return !!rc;
96}
Note: See TracBrowser for help on using the repository browser.

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