tstCompressionBenchmark.cpp revision a9d893999c866903a9b29cea4ba4f9a0a64bb65d
/* $Id$ */
/** @file
* Compression Benchmark for SSM.
*/
/*
* Copyright (C) 2009 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.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <iprt/initterm.h>
/*******************************************************************************
* Global Variables *
*******************************************************************************/
static uint8_t *g_pabDecompr;
static uint8_t *g_pabCompr;
{
return VERR_NOT_IMPLEMENTED;
}
/** Prints an error message and returns 1 for quick return from main use. */
{
return 1;
}
{
RTR3Init();
/*
* Parse arguments.
*/
static const RTGETOPTDEF s_aOptions[] =
{
};
const char *pszPageFile = NULL;
{
switch (rc)
{
case 'n':
if (g_cPages < 1)
break;
case 'i':
if (cIterations < 1)
return Error("The number of iterations must be 1 or higher\n");
break;
case 'f':
break;
default:
if (rc > 0)
{
if (RT_C_IS_GRAPH(rc))
else
}
else if (rc == VERR_GETOPT_UNKNOWN_OPTION)
else if (rc == VINF_GETOPT_NOT_OPTION)
else
return 1;
}
}
/*
* Gather the test memory.
*/
if (pszPageFile)
{
rc = RTFileReadAllEx(pszPageFile, 0, g_cPages * PAGE_SIZE, RTFILE_RDALL_O_DENY_NONE, (void **)&g_pabSrc, &cbFile);
if (RT_FAILURE(rc))
return Error("Error reading %zu bytes from %s: got %zu bytes\n", g_cPages * PAGE_SIZE, pszPageFile, cbFile);
}
else
{
if (g_pabSrc)
{
/* just fill it with something. */
{
char szTmp[17];
}
}
}
/*
* Double loop compressing and uncompressing the data, where the outer does
* the specified number of interations while the inner applies the different
* compression algorithms.
*/
struct
{
/** The time spent decompressing. */
/** The time spent compressing. */
/** The size of the compressed data. */
/** Number of errrors. */
/** Compresstion type. */
/** Compresison level. */
/** Method name. */
const char *pszName;
} aTests[] =
{
};
for (uint32_t i = 0; i < cIterations; i++)
{
{
/*
* Compress it.
*/
if (RT_FAILURE(rc))
{
continue;
}
while (cLeft-- > 0)
{
}
}
}
/*
* Report the results.
*/
RTPrintf("tstCompressionBenchmark: BEGIN RESULTS\n");
rc = 0;
{
RTPrintf("\n");
rc = 1;
}
RTPrintf("tstCompressionBenchmark: END RESULTS\n");
return rc;
}