Archived

This topic is now archived and is closed to further replies.

cippyboy

Memory Tests...

Recommended Posts

I thought of a way of testing memory(RAM for now) and I thought of something like this:
float a=GetTickCount();
float b=a;
__int64 i=0;
while (b-a<1.0f)
{
	int *I=new int[100];
	b=GetTickCount();
	i+=400;
}
but the thing is that it`s not the same value everytime... I get from 747 200 to 228 800 so it`s not really the same... should I try to set the maximum priority ? or should I use something else ? From this I think that I can expand to CPU Speed and last but not least video memory speed, and rendering speed.. just a thought... Thanks is advance

Share this post


Link to post
Share on other sites
Loops for 1s and creates a few mb worth of memory leaks... ==> Don't EVER do it again

What are you trying to do with this? Why do you need this test for?

You should never let your fears become the boundaries of your dreams.


[edited by - _DarkWIng_ on October 21, 2003 2:41:07 PM]

Share this post


Link to post
Share on other sites
that code is WRONG!!

if you want to get the amount of free memory you can use some API but do NOT use that. That technique is probably inspired after memory probing - writing at certain offsets in memory until you get an error to determine it's size - which is used if you are writing a Kernel or smth like that.

If you want the amount of VRAM try loading textures until the driver cannot store them in video mem (glAreTexturesResident) and add the size of the framebuffer (ColorBuf, Zbuf, Stencil ~= 6Mb for 800x600 i think)


[ My Site ]
'I wish life was not so short,' he thought. 'Languages take such a time, and so do all the things one wants to know about.' - J.R.R Tolkien
Founding member of "Un-Ban nes8bit" association (UNA) (to join put this in your sig) (Welcome back to JesperT)
/*ilici*/


[edited by - Ilici on October 21, 2003 3:56:40 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by cippyboy
From this I think that I can expand to CPU Speed and last but not least video memory speed, and rendering speed.. just a thought...

I am not sure this is a good idea - there are a lot of benchmarks already around.
I personally hate automatic tweaking and let the user do whatever it wants but effectively, this is a personal opinion.
In my app I just check for this or that feature. I don''t plan to add anything to check speed in the short run. Even if I would know that "the PC can do that at that speed", it would be difficult to set up code to improve experience.
I find much easier to ask for "that feature" and when avaiable, just go for a different render path.
Often a demorun is simply better that doing benchmarks.

Share this post


Link to post
Share on other sites
Actually what I was trying to test was that.. for example I have SDRam Memory , and I tryed some DDRam memory . I wanted to test the difference between these two... offcourse there is a price difference but I wanted to test theyre potential as well...
The same goes for a Video Card as well . What`s the difference between a the same card with 32 MB and 64 MB ? more storage ? what if the second one`s memory is faster ?
Anyway even if I deallocate(fixed that->wrote it in a hurry) the same thing is happening... it`s the processor functions very... randomly I`d say, now is fast and then is slow... it doesn`t make too much sense to me.

Share this post


Link to post
Share on other sites
It can be really random since there is so much more going on besides this piece of code. GetTickCount() returns the elapsed time in *milliseconds* (not seconds) and thus your routine would be very susceptible to outside influences. You would have to average over a much longer period.

Also, instead of only allocating memory, it would be better to pre-allocate a much larger chunk of memory and then performing some memory intensive instructions in that memory (possibly written in assembler). You would then check how long it takes to perform those operations. And it would be best to make sure memory is locked down so no page swapping occurs (for large allocations).

In your example above, at least initialise the memory block (ie: use calloc instead). At the moment, you are only testing the efficiency of the memory allocation routines and not the actual memory blocks themselves.

Share this post


Link to post
Share on other sites
1. If you want to test the speed allocate a 1mb block and use a optimized routine to write to it many times. Also you could set the process''s priority to High.

2. If you want to test your AGP mem use smth like NV''s VAR or VertexBuffers - do the same as in (1) with it.

also say bye-bye to GetTickCount()! use QueryPerformanceCounter.

succes in continuare


[ My Site ]
''I wish life was not so short,'' he thought. ''Languages take such a time, and so do all the things one wants to know about.'' - J.R.R Tolkien
Founding member of "Un-Ban nes8bit" association (UNA) (to join put this in your sig) (Welcome back to JesperT)
/*ilici*/

Share this post


Link to post
Share on other sites
The point is that even if you know how much fast the system is, it''s quite difficult to tune up the code to get maximum experience.

If you want to do it "just for fun" then everything is fine, but using the obtained infos is often too difficult (especially if you have no control over content).

Share this post


Link to post
Share on other sites
Well it is kind of "for fun" but if you realize it, you`ll find out that the speed of "something" is not totally dependent of the nature of the code, or the like but more of it`s soroundings witch doesn`t really make sense, I mean how can you do 10 M operations in second 1 and then 8 M in second 2 ? Anyways this is just my opinion offcourse, and ... it might be wrong .

Share this post


Link to post
Share on other sites