mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 01:46:14 +00:00
linux: Flush page/buffer cache before querying available memory
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
784b77257b
commit
70e6ed92ab
@ -98,7 +98,14 @@ intel_get_avail_ram_mb(void)
|
|||||||
|
|
||||||
#ifdef HAVE_STRUCT_SYSINFO_TOTALRAM /* Linux */
|
#ifdef HAVE_STRUCT_SYSINFO_TOTALRAM /* Linux */
|
||||||
struct sysinfo sysinf;
|
struct sysinfo sysinf;
|
||||||
int ret;
|
int fd, ret;
|
||||||
|
|
||||||
|
fd = open("/proc/sys/vm/drop_caches", O_RDWR);
|
||||||
|
if (fd != -1) {
|
||||||
|
ret = write(fd, "3", 2);
|
||||||
|
close(fd);
|
||||||
|
(void)ret;
|
||||||
|
}
|
||||||
|
|
||||||
ret = sysinfo(&sysinf);
|
ret = sysinfo(&sysinf);
|
||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user