Jump to content
  • Advertisement
Sign in to follow this  
discman1028

Clearing Disk Cache / Profiling

This topic is 4372 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'd like to time how long it takes to start up my application for the very first time. Since I can only do that once ;) I need to find out how to clear my hard disk's cache. Can I just clear the page file? If so: How do I do this? and Can this be done from the command line / can I automate this? Thanks :)

Share this post


Link to post
Share on other sites
Advertisement
Hmm, sounds quite lowlevel [smile]

How about just copying the program to another partition/folder to fool the disk cache?

Share this post


Link to post
Share on other sites
Likely, the disk cache would fool me, since I'm not sure that it would be working.

What happens when I run out of disks? I'm not sure if switching folders will trick it.

Share this post


Link to post
Share on other sites
Assuming OS==Windows here.

Since the OS disk cache is adjusted in size according to VM pressure of system, you can flush it by simply having an app allocate all available memory.
This will also cause swapping, but hey.

As to the HD disk cache, you could try using IOCTL_DISK_SET_CACHE_INFORMATION, but I've never done it.

Share this post


Link to post
Share on other sites
Copying the files to another disk won't help, unless you reboot after copying, otherwise you can be sure at least some of the data will be in cache.

You're probably on Windows, in which case, hopefully Jan's answer is probably the most useful one, unless someone can offer something more concrete.

If you're on OS X, the 'purge' command (part of the CHUD developer tools) will cause the disk caches to be purged. On Linux, with a 2.6.16 kernel or newer, 'echo 3 > /proc/sys/vm/drop_caches' will achieve the same effect. Another trick on Linux is to use a separate filesystem for the benchmark--if you perform a umount/mount cycle after each run the kernel will drop any cached data that came from that filesystem.

If there is a definitive way to purge the filesystem cache on Windows, it would be very useful to know about.

Share this post


Link to post
Share on other sites
Hmmm wait, can I just do (WinXP):

Right click on My Computer -> Properties -> Advanced -> Performance Settings -> Advanced -> Virtual Memory (Change) -> "No Paging File"

?

I think that should do it...

Share this post


Link to post
Share on other sites
I think you might want to clear your Drive:\WINDOWS\Prefetch folder too...I hear it stores temporary information about executables that speeds up load time.

If you want a good timing result, run a disk cleanup and defragmentation before you start and close all open windows. :)

Share this post


Link to post
Share on other sites
Why does this matter? It will only tell you how long it takes on your PC. Any other PC will be different. What exactly are you trying to do? See how long loading resources takes? That's something you should time internally. Also, how are you going to be accurate? You won't hit "stop" on a stop watch fast enough to be remotely accurate.

Share this post


Link to post
Share on other sites
Quote:
Original post by ouraqt
I think you might want to clear your Drive:\WINDOWS\Prefetch folder too...I hear it stores temporary information about executables that speeds up load time.


Very good advice... in fact the name of my executable appeard in files in that folder several times. Thanks!

Quote:
Original post by Mike2343
Why does this matter? It will only tell you how long it takes on your PC. Any other PC will be different. What exactly are you trying to do? See how long loading resources takes? That's something you should time internally. Also, how are you going to be accurate? You won't hit "stop" on a stop watch fast enough to be remotely accurate.


I want to get an idea of average user load time, on the very first load - that's my goal. A stopwatch is accurate, as I'm loading large resources from disk, which take on the order of seconds to load.


Any more hidden "Prefetch"-type things you all know of?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!