# ./vmtouch
./vmtouch: no files or directories specified
vmtouch v1.3.1 - the Virtual Memory Toucher by Doug Hoyte
Portable file system cache diagnostics and control
Usage: vmtouch [OPTIONS] ... FILES OR DIRECTORIES ...
Options:
-t touch pages into memory
-e evict pages from memory
-l lock pages in physical memory with mlock(2)
-L lock pages in physical memory with mlockall(2)
-d daemon mode
-m <size> max file size to touch
-p <range> use the specified portion instead of the entire file
-f follow symbolic links
-F don't crawl different filesystems
-h also count hardlinked copies
-i <pattern> ignores files and directories that match this pattern
-I <pattern> only process files that match this pattern
-b <list file> get files or directories from the list file
-0 in batch mode (-b) separate paths with NUL byte instead of newline
-w wait until all pages are locked (only useful together with -d)
-P <pidfile> write a pidfile (only useful together with -l or -L)
-o <type> output in machine friendly format. 'kv' for key=value pairs.
-v verbose
-q quiet
# ./vmtouch test.bin
Files: 1
Directories: 0
Resident Pages: 109159/109159 426M/426M 100%
Elapsed: 0.069863 seconds
# echo 3 > /proc/sys/vm/drop_caches
# ./vmtouch test.bin
Files: 1
Directories: 0
Resident Pages: 0/109159 0/426M 0%
Elapsed: 0.01347 seconds
常见命令:
加入缓存
vmtouch -vt 文件名
查询
vmtouch 文件名
Reference: