Added options -o and -r to save/read a list of files to use #43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not sure if you want this, but since I wanted it, I thought I'd share it. (If you don't want to merge, I completely understand; I'll personally be using my fork in that case)
Use case:
You want to preload a certain program, let's say the Intellij IDEA located in
/opt/idea
. Let's say this is a huge directory, and you only want to preload the part of the program which it requires to start the program. To reduce the time needed to start it.First you make sure none of it is in memory. Then you start the Intellij IDEA. Now you run
vmtouch -o /opt/idea > ~/idea_preload.txt
.Now if you were to preload it (perhaps on boot), then you could simply do
vmtouch -l -r ~/idea_preload.txt /opt/idea
and you're good to go.Caveats:
Using
-r
is slower than not using-r
, because we're linearly going through every single entry in the list. Some kind of parsing-tree might be faster, but doing that in C sounds like a nightmare.I'm also using filenames instead of resident_pages; so it'll preload more than it should, but less than it otherwise would if you loaded the entire directory.
Anyway, it's here if you want it.