Fix various issues in procrank.
Fixed these problems:
1. Page swapped bit was not extracted correctly.
2. Pages were ignored when page present bit is not set.
3. Bit operations were not correct.
4. There was a compiler warning about unsigned/signed comparision.
5. Line limit was too short for the map file. This was causing procrank
to generate a warning and remove the related process from results.
Change-Id: Ifed3913a49b15f59010cfa842090a13228074df9
diff --git a/libpagemap/pm_map.c b/libpagemap/pm_map.c
index f683ba6..2d5c2f9 100644
--- a/libpagemap/pm_map.c
+++ b/libpagemap/pm_map.c
@@ -83,10 +83,6 @@
pm_memusage_zero(&ws);
for (i = 0; i < len; i++) {
- if (!PM_PAGEMAP_PRESENT(pagemap[i]) ||
- PM_PAGEMAP_SWAPPED(pagemap[i]))
- continue;
-
error = pm_kernel_flags(map->proc->ker, PM_PAGEMAP_PFN(pagemap[i]),
&flags);
if (error) goto out;
@@ -99,6 +95,7 @@
if (error) goto out;
ws.vss += map->proc->ker->pagesize;
+ if( PM_PAGEMAP_SWAPPED(pagemap[i]) ) continue;
ws.rss += (count >= 1) ? (map->proc->ker->pagesize) : (0);
ws.pss += (count >= 1) ? (map->proc->ker->pagesize / count) : (0);
ws.uss += (count == 1) ? (map->proc->ker->pagesize) : (0);