🔒 Locked
Clearing Disk Cache / Profiling
Advertisement
Original Post
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 :)
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.
What happens when I run out of disks? I'm not sure if switching folders will trick it.
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.
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.
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.
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.
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...
Right click on My Computer -> Properties -> Advanced -> Performance Settings -> Advanced -> Virtual Memory (Change) -> "No Paging File"
?
I think that should do it...
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.
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?
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement