e6660f4933111b0649ffa77483102881f4e75c3bvboxsync/* $Id$ */
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync/** @file
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Statistics.
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync */
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync/*
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * Copyright (C) 2007-2010 Oracle Corporation
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync *
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * available from http://www.virtualbox.org. This file is free software;
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * General Public License (GPL) as published by the Free Software
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync *
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * The contents of this file may alternatively be used under the terms
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * of the Common Development and Distribution License Version 1.0
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * VirtualBox OSE distribution, in which case the provisions of the
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * CDDL are applicable instead of those of the GPL.
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync *
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * You may elect to license modified versions of this file under the
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * terms and conditions of either the GPL or the CDDL or both.
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync */
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync/*******************************************************************************
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync* Header Files *
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync*******************************************************************************/
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync#include "VBGLR3Internal.h"
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync/**
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * Query the current statistics update interval.
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync *
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * @returns IPRT status code.
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * @param pcMsInterval Update interval in ms (out).
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync */
e6660f4933111b0649ffa77483102881f4e75c3bvboxsyncVBGLR3DECL(int) VbglR3StatQueryInterval(PRTMSINTERVAL pcMsInterval)
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync{
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync VMMDevGetStatisticsChangeRequest Req;
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync vmmdevInitRequest(&Req.header, VMMDevReq_GetStatisticsChangeRequest);
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync Req.eventAck = VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST;
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync Req.u32StatInterval = 1;
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync int rc = vbglR3GRPerform(&Req.header);
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync if (RT_SUCCESS(rc))
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync {
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync *pcMsInterval = Req.u32StatInterval * 1000;
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync if (*pcMsInterval / 1000 != Req.u32StatInterval)
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync *pcMsInterval = ~(RTMSINTERVAL)0;
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync }
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync return rc;
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync}
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync/**
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * Report guest statistics.
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync *
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * @returns IPRT status code.
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync * @param pReq Request packet with statistics.
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync */
e6660f4933111b0649ffa77483102881f4e75c3bvboxsyncVBGLR3DECL(int) VbglR3StatReport(VMMDevReportGuestStats *pReq)
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync{
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync vmmdevInitRequest(&pReq->header, VMMDevReq_ReportGuestStats);
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync return vbglR3GRPerform(&pReq->header);
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync}
e6660f4933111b0649ffa77483102881f4e75c3bvboxsync