Timo Kokkonen [Sun, 15 Aug 2010 16:43:08 +0000 (19:43 +0300)]
parser: Do not scan processes twice
Before we would scan some processes twice: First when we find out the
pages of the interesting processes, then again when we scan the rest
of the processes. This patch changes the handling so that the second
time we ignore all interesting pids that we already scanned.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 15 Aug 2010 16:39:10 +0000 (19:39 +0300)]
read_pageframe: Do not add empty entries in process list
If reading of some of the process details fails, the process is most
likely died while we were processing its details. Thus, there is no
good to add the entry to the process list either. The entry is now
freed instead of adding the half-read entry to the list.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 14 Aug 2010 16:56:09 +0000 (19:56 +0300)]
parser: Fix the order of argumets for list_add()
The parameters were in wrong order, thus causing the new pageframe
referencing node to be lost for most of the processes. The results
were thus showing only references for only the first pid that was
found, ignoring everything else. This fix will thus improve the
results dramatically.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Fri, 23 Jul 2010 12:38:59 +0000 (15:38 +0300)]
Break parsing if no processes are found
Scanning through all pids in the system can be a time consuming task,
especially with slower CPUs. Therefore, if the user gives a
nonexistent process argument it can tage significant amount of time
until the user gets the response that there will be no useful results
available.
This patch counts the number of processes that have been encoutered
during the prescan. If the count is zero, then it is no good to
proceed scanning all of the rest processes. As an extra benefit, the
number of prescanned processes can be used for something useful..
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Thu, 22 Jul 2010 11:19:45 +0000 (14:19 +0300)]
parser: get_next_pid: Do not store state internally
Storing the directory state internally may conflict in case there are
multiple users to the get_next_pid function. The directory state is
now taken as an argument and caller will store it.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Thu, 22 Jul 2010 09:12:07 +0000 (12:12 +0300)]
Scan threads only when requested
Usually there is no need to scan every threads for every processes, as
they are very likely to share their address space between each
others. Thus, scanning only one of them is mostly enough.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Fri, 16 Jul 2010 12:00:22 +0000 (15:00 +0300)]
parse_pageframe: Fully ignore all unused pages
The pagemap data read from the file might contain only the page shift
field, nothing else. That kind of pages are really not useful, so they
can be skipped.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Wed, 14 Jul 2010 19:10:28 +0000 (22:10 +0300)]
analyzer: Sort processes based on both swapped and present size
Sorting by only the present size will cause the logic to get in an
infinite loop, since the exit criteria for the print loop is that the
sum of the swapped and present size needs to be zero.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Wed, 14 Jul 2010 13:17:25 +0000 (16:17 +0300)]
parser: Populate the pageframe tree by scanning interesting pids first
The "interesting" pids needs to be scanned always first, since later
on the pages from "noninteresting" pids are compared to the ones
already in the tree. We are optimizing by not storing anything out of
interest in the tree.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Mon, 5 Jul 2010 19:21:46 +0000 (22:21 +0300)]
Handle the process name better
Read the name from cmdline instead of the comm file. It appears that
at least in ubuntu kernel the comm file is not even
exposed. Furthermore, the newline in the end of the cmdline is
replaced with null byte. This also ensures that the string is always
null terminated even though the string is otherwise truncated.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 4 Jul 2010 13:26:56 +0000 (16:26 +0300)]
analyzer: Remodify the pretty prints
Now there is an adjustable limit when prettifying prints takes
effect. When the number goes above the threshold, the number is
divided to look prettier.
After this change, there is still enough accuracy in the numbers to
keep them meaningful even though they are shrunk dramatically.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sun, 4 Jul 2010 12:58:57 +0000 (15:58 +0300)]
Make it possible to scan only interesting pids
When scanning "non-interesting" pids, the pageframes are not populated
in the tree. This makes it possible to reduce memory consumption
significantly by discarding uninterested data.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
Timo Kokkonen [Sat, 3 Jul 2010 12:08:56 +0000 (15:08 +0300)]
parser: Populate pageframe structure completely
Now all fields are filled. If page exists then either pfn or swap type
and offset are wrong. But the correct field can be determined by
inspecting the page_present and page_swapped fields.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>