VirtualBox

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

Last change on this file since 83 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.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 InnoTek Systemberatung 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 = NULL;
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\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 for (int i = 0; i < 80; i++)
56 {
57 RTPrintf("tstGIP-2: %2d: %016llx %016llx %08x %d %08x %15llu %08x %08x %08x %08x %08x %08x %08x %08x\n",
58 i,
59 g_pSUPGlobalInfoPage->u64NanoTS,
60 g_pSUPGlobalInfoPage->u64TSC,
61 g_pSUPGlobalInfoPage->u32UpdateIntervalTSC,
62 g_pSUPGlobalInfoPage->iTSCHistoryHead,
63 g_pSUPGlobalInfoPage->u32TransactionId,
64 g_pSUPGlobalInfoPage->u64CpuHz,
65 g_pSUPGlobalInfoPage->au32TSCHistory[0],
66 g_pSUPGlobalInfoPage->au32TSCHistory[1],
67 g_pSUPGlobalInfoPage->au32TSCHistory[2],
68 g_pSUPGlobalInfoPage->au32TSCHistory[3],
69 g_pSUPGlobalInfoPage->au32TSCHistory[4],
70 g_pSUPGlobalInfoPage->au32TSCHistory[5],
71 g_pSUPGlobalInfoPage->au32TSCHistory[6],
72 g_pSUPGlobalInfoPage->au32TSCHistory[7]);
73 RTThreadSleep(9);
74 }
75 }
76 else
77 {
78 RTPrintf("tstGIP-2: g_pSUPGlobalInfoPage is NULL\n");
79 rc = -1;
80 }
81
82 SUPTerm();
83 }
84 else
85 RTPrintf("tstGIP-2: SUPInit failed: %Vrc\n", rc);
86 return !!rc;
87}
Note: See TracBrowser for help on using the repository browser.

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