+/*
+ * Copyright (C) 2010 Timo Kokkonen <timo.t.kokkonen@iki.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
- struct pageframe pf;
+ struct rb_root root;
struct process process_list;
struct parse_opts opts;
read_args(argc, argv, &opts);
if (argc < 2) {
- printf("A pid or process name "
- "needs to be given as an argument\n");
- print_help_and_die(argv[0]);
+ opts.parse_mask = PARSE_MAP_NAME;
+ opts.name = "";
}
- clear_pageframe(&pf);
-
+ memset(&root, 0, sizeof(root));
memset(&process_list, 0, sizeof(process_list));
INIT_LIST_HEAD(&process_list.list);
- if (scan_all_pids(&pf, &process_list, &opts))
+ printf("Scanning all process IDs\n");
+
+ if (scan_all_pids(&root, &process_list, &opts))
return 1;
- update_kpageflags(&pf);
+ printf("Updating kpageflags\n");
+ update_kpageflags(&root);
+ printf("Preparing to print out results\n");
if (opts.parse_mask & PARSE_DUMP)
- dump_process_maps(&pf, &process_list, &opts);
+ dump_process_maps(&root, &process_list, &opts);
else
- print_pid_stats(&pf, &process_list, &opts);
+ print_pid_stats(&root, &process_list, &opts);
- print_page_stats(&pf);
+ print_page_stats(&root);
return 0;
}