PerformanceDarwin.cpp revision e45ccb294fc1f6b4078d058eaff86100361a7358
/* $Id$ */
/** @file
* VBox Darwin-specific Performance Classes implementation.
*/
/*
* Copyright (C) 2008 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include <mach/mach_error.h>
#include <mach/mach_host.h>
#include <mach/mach_init.h>
#include <mach/mach_time.h>
#include <mach/vm_statistics.h>
#include "Performance.h"
/* The following declarations are missing in 10.4.x SDK */
/* @todo Replace them with libproc.h and sys/proc_info.h when 10.4 is no longer supported */
struct proc_taskinfo {
};
#define PROC_PIDTASKINFO 4
namespace pm {
class CollectorDarwin : public CollectorHAL
{
public:
virtual int getRawProcessCpuLoad(RTPROCESS process, uint64_t *user, uint64_t *kernel, uint64_t *total);
private:
};
{
return new CollectorDarwin();
}
{
int mib[2];
size = sizeof(hostMemory);
hostMemory = 0;
}
}
{
if (krc != KERN_SUCCESS)
{
return RTErrConvertFromDarwinKern(krc);
}
return VINF_SUCCESS;
}
{
if (krc != KERN_SUCCESS)
{
return RTErrConvertFromDarwinKern(krc);
}
return VINF_SUCCESS;
}
{
if (nb <= 0)
{
return RTErrConvertFromDarwin(rc);
}
{
return VERR_INTERNAL_ERROR;
}
return VINF_SUCCESS;
}
int CollectorDarwin::getRawProcessCpuLoad(RTPROCESS process, uint64_t *user, uint64_t *kernel, uint64_t *total)
{
struct proc_taskinfo tinfo;
if (RT_SUCCESS(rc))
{
*total = mach_absolute_time();
}
return rc;
}
{
struct proc_taskinfo tinfo;
if (RT_SUCCESS(rc))
{
}
return rc;
}
}