PerformanceSolaris.cpp revision e45ccb294fc1f6b4078d058eaff86100361a7358
/* $Id$ */
/** @file
*
* VBox Solaris-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 <procfs.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <kstat.h>
#include "Performance.h"
namespace pm {
class CollectorSolaris : public CollectorHAL
{
public:
virtual ~CollectorSolaris();
virtual int getRawProcessCpuLoad(RTPROCESS process, uint64_t *user, uint64_t *kernel, uint64_t *total);
private:
};
{
return new CollectorSolaris();
}
// Collector HAL for Solaris
: mKC(0),
mSysPages(0),
mZFSCache(0)
{
if ((mKC = kstat_open()) == 0)
{
return;
}
{
return;
}
{
}
}
{
}
{
int rc = VINF_SUCCESS;
int cpus;
if (mKC == 0)
return VERR_INTERNAL_ERROR;
{
return VERR_INTERNAL_ERROR;
}
++cpus;
}
}
if (cpus == 0)
{
Log(("no cpu stats found!\n"));
return VERR_INTERNAL_ERROR;
}
return rc;
}
int CollectorSolaris::getRawProcessCpuLoad(RTPROCESS process, uint64_t *user, uint64_t *kernel, uint64_t *total)
{
int rc = VINF_SUCCESS;
char *pszName;
if (h != -1)
{
{
//Assert((pid_t)process == pstatus.pr_pid);
//Log(("user=%u kernel=%u total=%u\n", prusage.pr_utime.tv_sec, prusage.pr_stime.tv_sec, prusage.pr_tstamp.tv_sec));
//Log(("user=%llu kernel=%llu total=%llu\n", *user, *kernel, *total));
}
else
{
}
close(h);
}
else
{
}
return rc;
}
{
int rc = VINF_SUCCESS;
return VERR_INTERNAL_ERROR;
{
return VERR_INTERNAL_ERROR;
}
{
return VERR_INTERNAL_ERROR;
}
{
if (mZFSCache)
{
else
}
else
Log(("mZFSCache missing.\n"));
}
{
return VERR_INTERNAL_ERROR;
}
return rc;
}
{
int rc = VINF_SUCCESS;
if (h != -1)
{
{
}
else
{
}
close(h);
}
else
{
}
return rc;
}
}