PerformanceLinux.cpp revision e64031e20c39650a7bc902a3e1aba613b9415dee
/* $Id$ */
/** @file
*
* VBox Linux-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 <stdio.h>
#include <map>
#include <vector>
#include "Logging.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);
struct VMProcessStats
{
};
};
{
return new CollectorLinux();
}
// Collector HAL for Linux
{
{
if (RT_FAILURE(rc))
return rc;
}
{
}
return VINF_SUCCESS;
}
{
int rc = VINF_SUCCESS;
if (f)
{
{
}
else
fclose(f);
}
else
return rc;
}
{
return VINF_SUCCESS;
}
int CollectorLinux::getRawProcessCpuLoad(RTPROCESS process, uint64_t *user, uint64_t *kernel, uint64_t *total)
{
{
return VERR_INTERNAL_ERROR;
}
return VINF_SUCCESS;
}
{
int rc = VINF_SUCCESS;
if (f)
{
if (processed == 4)
{
}
else
fclose(f);
}
else
return rc;
}
{
{
return VERR_INTERNAL_ERROR;
}
return VINF_SUCCESS;
}
int CollectorLinux::getRawProcessStats(RTPROCESS process, uint64_t *cpuUser, uint64_t *cpuKernel, ULONG *memPagesUsed)
{
int rc = VINF_SUCCESS;
char *pszName;
char c;
int iTmp;
long long unsigned int u64Tmp;
unsigned uTmp;
unsigned long ulTmp;
//printf("Opening %s...\n", pszName);
if (f)
{
if (fscanf(f, "%d %s %c %d %d %d %d %d %u %lu %lu %lu %lu %u %u "
"%ld %ld %ld %ld %ld %ld %llu %lu %u",
{
}
else
fclose(f);
}
else
return rc;
}
}