caching - How to drop memory cache periodically in Linux? -
working on system measurement project , requires me drop cache periodically accurate number (since having cache there alter results). can manually drop cache using:
echo 3 > /proc/sys/vm/drop_caches
however, want automatically drop every microsecond. command should use?
you create own command that, i.e. write program that. example, like:
while (1) { if ((fp = fopen("/proc/sys/vm/drop_caches", "r")) == null) { /* error handler */ } fprintf(fp, "3\n"); fclose(fp); nanosleep(...); /* see nanosleep(2) */ }
in program, , made daemon.
Comments
Post a Comment