Now that we don't scan interesting processes multiple times, we can
count the pages which have refcount == 1 as unique pages and show that
number to the user.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
struct bintree_ops ops;
long int pages_present;
long int pages_swapped;
struct bintree_ops ops;
long int pages_present;
long int pages_swapped;
af->pages_present++;
else if (pf->page_swapped)
af->pages_swapped++;
af->pages_present++;
else if (pf->page_swapped)
af->pages_swapped++;
+ if (pf->refcount == 1)
+ af->pages_unique++;
count = bintree_walk(&pf->tree, &af.ops);
printf("present pages: %ld, %lld %sB\n"
"Swapped pages: %ld, %lld %sB\n"
count = bintree_walk(&pf->tree, &af.ops);
printf("present pages: %ld, %lld %sB\n"
"Swapped pages: %ld, %lld %sB\n"
+ "Unique pages: %ld, %lld %sB\n"
"Total %ld physical pages, %lld %sB\n",
af.pages_present,
PAGE_TO_NICE(af.pages_present),
"Total %ld physical pages, %lld %sB\n",
af.pages_present,
PAGE_TO_NICE(af.pages_present),
af.pages_swapped,
PAGE_TO_NICE(af.pages_swapped),
PAGE_TO_NICE_UNIT(af.pages_swapped),
af.pages_swapped,
PAGE_TO_NICE(af.pages_swapped),
PAGE_TO_NICE_UNIT(af.pages_swapped),
+ af.pages_unique,
+ PAGE_TO_NICE(af.pages_unique),
+ PAGE_TO_NICE_UNIT(af.pages_unique),
count,
PAGE_TO_NICE(count),
PAGE_TO_NICE_UNIT(count));
count,
PAGE_TO_NICE(count),
PAGE_TO_NICE_UNIT(count));