diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_aux.h | 1 | ||||
-rw-r--r-- | lib/intel_os.c | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/igt_aux.h b/lib/igt_aux.h index 948101d2..aa8a3878 100644 --- a/lib/igt_aux.h +++ b/lib/igt_aux.h @@ -61,6 +61,7 @@ void igt_wait_for_keypress(void); /* These are separate to allow easier testing when porting, see the comment at * the bottom of intel_os.c. */ +void intel_purge_vm_caches(void); uint64_t intel_get_avail_ram_mb(void); uint64_t intel_get_total_ram_mb(void); uint64_t intel_get_total_swap_mb(void); diff --git a/lib/intel_os.c b/lib/intel_os.c index 6f0621c7..7d9a703a 100644 --- a/lib/intel_os.c +++ b/lib/intel_os.c @@ -185,6 +185,19 @@ intel_get_total_swap_mb(void) return retval / (1024*1024); } +void +intel_purge_vm_caches(void) +{ + int fd; + + fd = open("/proc/sys/vm/drop_caches", O_RDWR); + if (fd < 0) + return; + + write(fd, "3\n", 2); + close(fd); +} + /* * When testing a port to a new platform, create a standalone test binary |