PerformanceLinux.cpp revision 5413a6a2dab50ebebc702aa2ae7d8059dcd09c9c
/* $Id$ */
/** @file
*
* VBox Linux-specific Performance Classes implementation.
*/
/*
* Copyright (C) 2008 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#include <stdio.h>
#include "Performance.h"
namespace pm {
class CollectorLinux : public CollectorHAL
{
public:
virtual int getRawProcessCpuLoad(RTPROCESS process, uint64_t *user, uint64_t *kernel, uint64_t *total);
private:
int getRawProcessStats(RTPROCESS process, uint64_t *cpuUser, uint64_t *cpuKernel, ULONG *memPagesUsed);
};
// Linux Metric factory
{
mHAL = new CollectorLinux();
}
// Collector HAL for Linux
{
int rc = VINF_SUCCESS;
if (f)
{
{
}
else
fclose(f);
}
else
return rc;
}
int CollectorLinux::getRawProcessCpuLoad(RTPROCESS process, uint64_t *user, uint64_t *kernel, uint64_t *total)
{
int rc = VINF_SUCCESS;
if (RT_SUCCESS(rc))
{
}
return rc;
}
{
return E_NOTIMPL;
}
{
int rc = VINF_SUCCESS;
if (f)
{
if (processed == 4)
{
}
else
fclose(f);
}
else
return rc;
}
{
if (RT_SUCCESS(rc))
{
}
return rc;
}
int CollectorLinux::getRawProcessStats(RTPROCESS process, uint64_t *cpuUser, uint64_t *cpuKernel, ULONG *memPagesUsed)
{
int rc = VINF_SUCCESS;
char *pszName;
char c;
int iTmp;
unsigned uTmp;
//printf("Opening %s...\n", pszName);
if (f)
{
if (fscanf(f, "%d %s %c %d %d %d %d %d %u %lu %lu %lu %lu %lu %lu "
"%ld %ld %ld %ld %ld %ld %llu %lu %ld",
{
}
else
fclose(f);
}
else
return rc;
}
}