Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using memory without cache for benchmark?

Posted on 2004-09-23
3
Medium Priority
?
177 Views
Last Modified: 2010-04-15
I'm writing a crossplaform bechmark in c. It's meanth to test the effects that some bios settings have on you're overall system. For nom it only has a FPU test but the next test i want to write a memory bandwith test. I' don't need to know the exact value of the memory bandwith but just a relative value to see how you're sistem improves or doesn't.

I wanted to test this by copying data of memory into another place in the memory but is there any way i can make make shure i'm not reading or writing to the cache by clearing it or something else? How do i best do this? If possible a crossplatform (linux / windows) would be the best but if it's not possible two different  way's to do this(one for linux one for windows ) are no problem.
Any other suggenstions on doing this test are also more than welcome.
0
Comment
Question by:neushoorn
1 Comment
 
LVL 46

Accepted Solution

by:
Kent Olsen earned 500 total points
ID: 12143008

Without hacking into the BIOs and disabling the cache your options are somewhat limited.  But you do have options.

I'd run several tests with data transfers of different sizes so that the tests show the effects of copying withing the cache and with repeated cache voiding.

#define XFER1 256
#define XFER2 1024
#define XFER3 4096
#define XFER4 16384
#define XFER5 65536
#define XFER6 262144
#define XFER7 1048576
#define XFER8 4194304
#define XFER9 16777216

#define XFER_LIMIT 2147483647

unisgned int TransferSize[10] = {XFER1, XFER2, XFER3, XFER4, XFER5, XFER6, XFER7, XFER8, XFER9, 0};

int Method;
char *ibuf = 0;
char *obuf = 0;
int XferSize;
int PassCount;
int idx;

for (Method = 0; TransferSize[Method]; Method++)
{
  XferSize = TransferSize[Method];
  PassCount = XFER_LIMIT / XferSize;
  ibuf = (char *)realloc (ibuf);
  obuf = (char *)realloc (obuf);
  for (idx = 0; idx < PassCount; idx++)
    memcpy (obuf, ibuf, XferSize);
}


Just insert your timing controls around the inner for() loop and you'll get an idea of how long it takes to move 2GB in chunks of varying sizes.  The smaller blocks will void the cache once, at most.  The larger blocks will repeated void the cache.

This doesn't give you the answer that you're looking for, but it will give you an idea of relative performance based on "cache only" and "cache voiding".

Good Luck,
Kent
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question