PerformanceSolaris.cpp revision 8b1975ddd07b69272802f37efbcf9a358c32a15a
/* $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 <unistd.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;
}
{
}
}
{
if (mKC)
}
{
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)
{
{
{
/*
* Account for ZFS minimum arc cache size limit.
* "c_min" is the target minimum size of the ZFS cache, and not the hard limit. It's possible
* for "size" to shrink below "c_min" (e.g: during boot & high memory consumption).
*/
}
else
}
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;
}
{
/*
* Get the instance number from the interface name, then clip it off.
*/
int cbInstance = 0;
for (int i = 0; i < cbIface - 1; i++)
{
if (!RT_C_IS_DIGIT(*pszEnd))
break;
cbInstance++;
pszEnd--;
}
return uInstance;
}
{
if (ksAdapter == 0)
{
char szModule[KSTAT_STRLEN];
if (ksAdapter == 0)
{
if (ksAdapter == 0)
{
return VERR_INTERNAL_ERROR;
}
}
}
{
return VERR_INTERNAL_ERROR;
}
{
return VERR_INTERNAL_ERROR;
}
{
return VERR_INTERNAL_ERROR;
}
return VINF_SUCCESS;
}
{
return VERR_NOT_IMPLEMENTED;
}
}