Created
December 2, 2011 19:38
-
-
Save mikeyk/1424540 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import fileinput | |
import argparse | |
from operator import itemgetter | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--target-mb', action = 'store', dest = 'target_mb', default = 61000, type = int) | |
parser.add_argument('vmtouch_output_file', action = 'store', nargs = '+') | |
args = parser.parse_args() | |
entries = [] | |
last_fl_name = None | |
for line in open(args.vmtouch_output_file[0]): | |
line = line.strip() | |
if line.startswith('['): | |
# this is a mem info row | |
if not last_fl_name: | |
continue | |
currently_paged_percent = line.rsplit(' ', 1)[-1] | |
num, denom = map(float, currently_paged_percent.split('/')) | |
if num and denom: | |
bytes = denom * 4096 | |
mb = bytes / (1024 * 1024) | |
entries.append((last_fl_name, num / denom, mb)) | |
elif line.startswith('.') or line.startswith('/'): | |
last_fl_name = line | |
sorted_entries = sorted(entries, key = itemgetter(1), reverse = True) | |
loaded_mb = 0 | |
to_page_in = [] | |
for entry in sorted_entries: | |
if loaded_mb <= args.target_mb: | |
loaded_mb += entry[-1] | |
to_page_in.append(entry[0]) | |
print 'vmtouch -m 5G -vt', ' '.join(to_page_in) |
I think it's something like: vmtouch -vf > vmtouch_output_file.txt
We do vmtouch -v -m 5G \* > output.txt
…On Apr 12, 2012, at 6:32 AM, ***@***.*** wrote:
I think it's something like: vmtouch -vf > vmtouch_output_file.txt
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/1424540
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what command do you use to generate the vmtouch output on one machine ?