Re: How to tell when a file is read from disk or cache?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Philip Rhoades wrote:
> Is there some way of doing this? - even for a simple situation like
> opening a text file in Vim?

Depends on what you want.

If what you’re after is to tell after the fact that a file has been
accessed, you should look into auditd, or just turn on atime on your
filesystem (note that this has been turned off for good reasons). You
may even find that relatime does what you need: I think
https://lwn.net/Articles/244829/ is still accurate.

If you want to run a program the instant a file has been accessed, you
will need to look into fanotify (and probably do some programming): see
https://lwn.net/Articles/360955/ for details.

These will let you know when a program is opened for reading: if you
then want to know each time a program reads a byte, you’re pretty much
out of luck: the mmap API means the OS doesn’t get to see precisely when
a particular byte is read (if it’s already in cache).

Hope this helps,

James.

-- 
E-mail:     james@ | A wood-pigeon would, If a wood-pigeon could,
aprilcottage.co.uk | But a wood-pigeon can’t, So it won’t.
                   | A wood-pigeon could, If a wood-pigeon would,
                   | But a wood-pigeon doesn’t want to. So it doesn’t.
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux