From 519901db42f8a99e7605d48fbae59df6bc4ee2fe Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 7 Nov 2014 23:40:13 +0100 Subject: use posix_fadvise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/framebuffer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/framebuffer.c b/src/framebuffer.c index 6a6d76a..05ada4a 100644 --- a/src/framebuffer.c +++ b/src/framebuffer.c @@ -51,6 +51,8 @@ int main() height = var_info.yres; inv_width = 1 / (double)width; + posix_fadvise(fd, 0, (size_t)(width * height * 4), + POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE | POSIX_FADV_WILLNEED); mem = mmap(NULL, (size_t)(width * height * 4), PROT_READ, MAP_SHARED, fd, (off_t)0); if (mem == MAP_FAILED) return perror("get-luminosity::framebuffer: mmap"), close(fd), 1; -- cgit v1.2.3-70-g09d2