]> git.itanic.dy.fi Git - scan-pagemap/log
scan-pagemap
13 years agoCompact pageframe structure
Timo Kokkonen [Mon, 16 Aug 2010 18:23:30 +0000 (21:23 +0300)]
Compact pageframe structure

Instead of decoding each entry to individual variables in the
pageframe structure, maintain them as a single raw 64 bit
value. Various helper functions are introduced for decoding the
information on the fly. This reduces the run time memory consumption
without really slowing down the execution.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoprint_page_stats: Print unique pages
Timo Kokkonen [Sun, 15 Aug 2010 19:44:14 +0000 (22:44 +0300)]
print_page_stats: Print unique pages

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>
13 years agoparser: When scannin by name, scan all pids twice
Timo Kokkonen [Sun, 15 Aug 2010 19:37:16 +0000 (22:37 +0300)]
parser: When scannin by name, scan all pids twice

When scanning by a mapping name, we must first scan through all
processes to find out which processes are using the mappings. Then we
need to scan all pids again to find out if there are somewhere
physical pages that are being shared by the given mapping with a
different name.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Fix scanning by mapping name
Timo Kokkonen [Sun, 15 Aug 2010 19:36:18 +0000 (22:36 +0300)]
parser: Fix scanning by mapping name

If we scan by a mapping name, we must allow all processes to be
scanned.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoCorrect the usage of linked lists
Timo Kokkonen [Sun, 15 Aug 2010 17:45:57 +0000 (20:45 +0300)]
Correct the usage of linked lists

There is really no documentation about how the linked lists in the
lists.h should be used. Specifically, it does not mention the fact
that the head entry of the list should never be used at all. Instead,
the head entry, when being empty, just points to itself.

Now that this fact is clear, a lot of difficult assumptions can be
left out and some overly complicated code can be cleared with the list
handling. This is because the head entry does not have to contain a
valid entry at all.

This also fixes a bug with was caused by the incorrect list handling:
printing the process list always had the head entry missing, since the
list_for_all() functions left the head entry unhandled for purpose.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoMakefile: Disable optimizations for the debug version
Timo Kokkonen [Sun, 15 Aug 2010 17:45:22 +0000 (20:45 +0300)]
Makefile: Disable optimizations for the debug version

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Do not scan processes twice
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>
13 years agoread_pageframe: Do not add empty entries in process list
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>
13 years agoutils.h: Fix coding conventions
Timo Kokkonen [Sun, 15 Aug 2010 16:36:07 +0000 (19:36 +0300)]
utils.h: Fix coding conventions

These were reported by checkpatch.pl

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Fix the order of argumets for list_add()
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>
13 years agomain: Print warning if root priviledges are not available
Timo Kokkonen [Sat, 14 Aug 2010 16:01:55 +0000 (19:01 +0300)]
main: Print warning if root priviledges are not available

Without root priviledges, reading only the user's own processes is
possible. Thus, the results usually don't contain all of the possible
results.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agomain.c: Get rid of unnecessary white space
Timo Kokkonen [Sat, 14 Aug 2010 15:59:47 +0000 (18:59 +0300)]
main.c: Get rid of unnecessary white space

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agomain.c: Print page stats also after dumping process maps
Timo Kokkonen [Fri, 23 Jul 2010 16:58:22 +0000 (19:58 +0300)]
main.c: Print page stats also after dumping process maps

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoDump process page maps when requested
Timo Kokkonen [Fri, 23 Jul 2010 16:40:30 +0000 (19:40 +0300)]
Dump process page maps when requested

If dumping is requested, only the given processes are being scanned,
not all pids in the system.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoanalyzer: Add support for dumping process page maps
Timo Kokkonen [Fri, 23 Jul 2010 16:37:02 +0000 (19:37 +0300)]
analyzer: Add support for dumping process page maps

This code will dump the process page mappings, sorted by the the
actual (ram + swap) size. The size of the mapping address space is
printed as well.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Avoid too long reads from /proc/pid/pageframe
Timo Kokkonen [Fri, 23 Jul 2010 16:35:20 +0000 (19:35 +0300)]
parser: Avoid too long reads from /proc/pid/pageframe

The correct amount is always one 8 byte entry for each 4096 size
pages.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoanalyzer: print_pid_stats: Add column for total mem usage
Timo Kokkonen [Fri, 23 Jul 2010 14:45:51 +0000 (17:45 +0300)]
analyzer: print_pid_stats: Add column for total mem usage

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoprint_help: Add help string for the -P and --process options
Timo Kokkonen [Fri, 23 Jul 2010 14:38:14 +0000 (17:38 +0300)]
print_help: Add help string for the -P and --process options

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoAnalyzer: Do not report unused pages
Timo Kokkonen [Fri, 23 Jul 2010 14:34:56 +0000 (17:34 +0300)]
Analyzer: Do not report unused pages

We are ignoring the unused pages anyway, so there is no good in
reporting them.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoread_args: Remove debug print
Timo Kokkonen [Fri, 23 Jul 2010 14:33:46 +0000 (17:33 +0300)]
read_args: Remove debug print

This line got here by accident again, remove it!

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoanalyzer: Avoid ignoring mappings with only one reference
Timo Kokkonen [Fri, 23 Jul 2010 14:13:00 +0000 (17:13 +0300)]
analyzer: Avoid ignoring mappings with only one reference

The list_for_each_entry macro does not work for lists that have only
one item in it. Thus, we need a special case for lists containing only
one entry.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoBreak parsing if no processes are found
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>
13 years agomain.c: read_args: Add missing break to switch clause
Timo Kokkonen [Fri, 23 Jul 2010 12:37:34 +0000 (15:37 +0300)]
main.c: read_args: Add missing break to switch clause

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Coding convention fixes
Timo Kokkonen [Fri, 23 Jul 2010 11:14:03 +0000 (14:14 +0300)]
parser: Coding convention fixes

These were reported by the checkpatch.pl script

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agomain.c: Clear the options structure before using
Timo Kokkonen [Fri, 23 Jul 2010 11:04:21 +0000 (14:04 +0300)]
main.c: Clear the options structure before using

Obviously it is not guaranteed that the contents of the structure are
zeroed if the content is allocated from the stack..

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: opendir_check: Open the correct directory
Timo Kokkonen [Fri, 23 Jul 2010 10:50:40 +0000 (13:50 +0300)]
parser: opendir_check: Open the correct directory

Remove the incorrect hard coded directory since it is wrong.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agomain.c: Add new command line options for parsing by process name
Timo Kokkonen [Fri, 23 Jul 2010 10:41:44 +0000 (13:41 +0300)]
main.c: Add new command line options for parsing by process name

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Add support for parsing processes by name
Timo Kokkonen [Fri, 23 Jul 2010 10:41:22 +0000 (13:41 +0300)]
parser: Add support for parsing processes by name

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Factor out reading cmdline to separate function
Timo Kokkonen [Fri, 23 Jul 2010 10:39:59 +0000 (13:39 +0300)]
parser: Factor out reading cmdline to separate function

This will be needed from different places in future, so factor it out
in a separate function.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparse_opts: Add new parse options
Timo Kokkonen [Fri, 23 Jul 2010 10:36:56 +0000 (13:36 +0300)]
parse_opts: Add new parse options

Prepare for adding support for parsing by process name.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Factor out duplicate code into a separate function
Timo Kokkonen [Thu, 22 Jul 2010 11:34:05 +0000 (14:34 +0300)]
parser: Factor out duplicate code into a separate function

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: get_next_pid: Do not store state internally
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>
13 years agoAnalyzer: Print thread-ID only when --with-threads is enabled
Timo Kokkonen [Thu, 22 Jul 2010 09:33:51 +0000 (12:33 +0300)]
Analyzer: Print thread-ID only when --with-threads is enabled

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoScan threads only when requested
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>
13 years agomain.c: Add help text
Timo Kokkonen [Thu, 22 Jul 2010 08:19:41 +0000 (11:19 +0300)]
main.c: Add help text

Print usage when insufficient parameters are given or when user
requests the help text.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoAdd support for parsing all threads, not just thead parents
Timo Kokkonen [Mon, 19 Jul 2010 11:51:39 +0000 (14:51 +0300)]
Add support for parsing all threads, not just thead parents

Some threads may have different memory address space than their
parents. Therefore it makes sense to allow scanning all threads
separately.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparse_pageframe: Fully ignore all unused pages
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>
13 years agoparse_pageframe: Avoid short reads
Timo Kokkonen [Fri, 16 Jul 2010 11:58:54 +0000 (14:58 +0300)]
parse_pageframe: Avoid short reads

The reads need to be always 64 bit aligned and read length must be a
multiple of 64 bits.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoanalyzer: Avoid null pointer dereference
Timo Kokkonen [Fri, 16 Jul 2010 11:57:16 +0000 (14:57 +0300)]
analyzer: Avoid null pointer dereference

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoanalyzer: Print also the total numer of processes printed
Timo Kokkonen [Wed, 14 Jul 2010 19:19:35 +0000 (22:19 +0300)]
analyzer: Print also the total numer of processes printed

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoanalyzer: Sort processes based on both swapped and present size
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>
13 years agomain.c: Add support for scanning a mapping by a name
Timo Kokkonen [Wed, 14 Jul 2010 17:25:47 +0000 (20:25 +0300)]
main.c: Add support for scanning a mapping by a name

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoanalyzer: Add a comment
Timo Kokkonen [Wed, 14 Jul 2010 17:24:53 +0000 (20:24 +0300)]
analyzer: Add a comment

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agomain.c: Read arguments with getopt_long()
Timo Kokkonen [Wed, 14 Jul 2010 14:18:47 +0000 (17:18 +0300)]
main.c: Read arguments with getopt_long()

This makes it much easier to add new command line arguments in future.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Populate the pageframe tree by scanning interesting pids first
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>
13 years agoStore parse options in a structure
Timo Kokkonen [Wed, 14 Jul 2010 08:23:14 +0000 (11:23 +0300)]
Store parse options in a structure

This makes it much easier to decide what kind of data to parse

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Ignore unused pages
Timo Kokkonen [Wed, 14 Jul 2010 07:28:35 +0000 (10:28 +0300)]
parser: Ignore unused pages

Ignore any pages that have no physical pages (either in swap or ram)
mapped at all.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoAnalyzer: Print better per pid stats
Timo Kokkonen [Tue, 6 Jul 2010 13:34:25 +0000 (16:34 +0300)]
Analyzer: Print better per pid stats

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoanalyze.c: Unify variable naming with pagemap.h
Timo Kokkonen [Tue, 6 Jul 2010 13:31:16 +0000 (16:31 +0300)]
analyze.c: Unify variable naming with pagemap.h

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Reduce some debug prints
Timo Kokkonen [Tue, 6 Jul 2010 11:34:49 +0000 (14:34 +0300)]
parser: Reduce some debug prints

The code works sufficiently reliably now so there is no need to print
the pid we are working on with.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparse_pagemap: Optimize pagemap reads
Timo Kokkonen [Tue, 6 Jul 2010 11:30:13 +0000 (14:30 +0300)]
parse_pagemap: Optimize pagemap reads

Do less read() syscalls in order to reduce overhead.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Fix crash when maps structure is NULL
Timo Kokkonen [Tue, 6 Jul 2010 07:23:54 +0000 (10:23 +0300)]
parser: Fix crash when maps structure is NULL

The maps structure can be NULL when scanning kernel processes.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoanalyzer: print_pid_stats: Sort process list by mem usage
Timo Kokkonen [Mon, 5 Jul 2010 21:16:44 +0000 (00:16 +0300)]
analyzer: print_pid_stats: Sort process list by mem usage

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Store per pid page stats
Timo Kokkonen [Mon, 5 Jul 2010 21:16:15 +0000 (00:16 +0300)]
parser: Store per pid page stats

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoanalyzer: pretty prints: Fix bug with unit conversion
Timo Kokkonen [Mon, 5 Jul 2010 21:13:37 +0000 (00:13 +0300)]
analyzer: pretty prints: Fix bug with unit conversion

The megabyte unit was not shown correctly.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoHandle the process name better
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>
13 years agomain.c: Print per pid statistics
Timo Kokkonen [Sun, 4 Jul 2010 20:23:45 +0000 (23:23 +0300)]
main.c: Print per pid statistics

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoAnalyzer: Add per pid analyzer
Timo Kokkonen [Sun, 4 Jul 2010 20:22:14 +0000 (23:22 +0300)]
Analyzer: Add per pid analyzer

This will print statistics about how much data is being shared between
pids.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoanalyze.c: Add whitespace on byte prefix in pretty prints
Timo Kokkonen [Sun, 4 Jul 2010 20:20:52 +0000 (23:20 +0300)]
analyze.c: Add whitespace on byte prefix in pretty prints

This helps keeping lines aligned when long lists are being printed.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoPut the processes in a linked list as well
Timo Kokkonen [Sun, 4 Jul 2010 20:19:56 +0000 (23:19 +0300)]
Put the processes in a linked list as well

Each process structure stores the per process statistics and memory
mappings.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Store the per mapping statistics in the maps structure
Timo Kokkonen [Sun, 4 Jul 2010 20:16:49 +0000 (23:16 +0300)]
parser: Store the per mapping statistics in the maps structure

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agopagemap.h: Calculate page size correctly
Timo Kokkonen [Sun, 4 Jul 2010 16:10:17 +0000 (19:10 +0300)]
pagemap.h: Calculate page size correctly

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoParser: Remove excess debug prints
Timo Kokkonen [Sun, 4 Jul 2010 13:30:53 +0000 (16:30 +0300)]
Parser: Remove excess debug prints

These provide very little useful information at this point. Removing
them make the program more usable.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Remove dead code
Timo Kokkonen [Sun, 4 Jul 2010 13:30:29 +0000 (16:30 +0300)]
parser: Remove dead code

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoanalyzer: Remodify the pretty prints
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>
13 years agoMake it possible to scan only interesting pids
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>
13 years agobintree.h: Add missing function prototype
Timo Kokkonen [Sun, 4 Jul 2010 12:57:47 +0000 (15:57 +0300)]
bintree.h: Add missing function prototype

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agobintree: Add bintree_find
Timo Kokkonen [Sun, 4 Jul 2010 09:24:24 +0000 (12:24 +0300)]
bintree: Add bintree_find

This allows finding a node from the tree without adding it in it
first.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoanalyzer: Pretty print output
Timo Kokkonen [Sun, 4 Jul 2010 07:23:28 +0000 (10:23 +0300)]
analyzer: Pretty print output

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agobintree_add: return the correct pointer when recursing
Timo Kokkonen [Sun, 4 Jul 2010 07:16:25 +0000 (10:16 +0300)]
bintree_add: return the correct pointer when recursing

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agomain.c: Scan through all pids
Timo Kokkonen [Sat, 3 Jul 2010 20:11:52 +0000 (23:11 +0300)]
main.c: Scan through all pids

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Add support for parsing through all PIDs
Timo Kokkonen [Sat, 3 Jul 2010 20:10:53 +0000 (23:10 +0300)]
parser: Add support for parsing through all PIDs

This reads the entire /proc directory and parses all pids it can find
there.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agopagemaps: Optimize memory usage
Timo Kokkonen [Sat, 3 Jul 2010 20:06:54 +0000 (23:06 +0300)]
pagemaps: Optimize memory usage

Do not make a new copy of the maps structure for each pageframe. Just
store a pointer to it instead.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparse_pagemap: Fix massive memory leak
Timo Kokkonen [Sat, 3 Jul 2010 19:37:37 +0000 (22:37 +0300)]
parse_pagemap: Fix massive memory leak

When matching pageframe is found from the tree, the allocated one
should be freed as it is not used anymore.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agomain.c: Take the pid as an argument
Timo Kokkonen [Sat, 3 Jul 2010 15:19:06 +0000 (18:19 +0300)]
main.c: Take the pid as an argument

Using hard coded values is bit silly..

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoAdd analyzer
Timo Kokkonen [Sat, 3 Jul 2010 15:07:01 +0000 (18:07 +0300)]
Add analyzer

This can now simply count the number of pages used in the system, but
later on there can be more sophisticated statistical output.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoPut some sense in how pointers are being passed
Timo Kokkonen [Sat, 3 Jul 2010 15:06:28 +0000 (18:06 +0300)]
Put some sense in how pointers are being passed

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Increment refcount for each pageframe
Timo Kokkonen [Sat, 3 Jul 2010 14:59:24 +0000 (17:59 +0300)]
parser: Increment refcount for each pageframe

A lot of pageframes are shared, so the refcount needs to be counted

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agobintree_add: Return the correct member during add
Timo Kokkonen [Sat, 3 Jul 2010 13:46:34 +0000 (16:46 +0300)]
bintree_add: Return the correct member during add

When a member is not found from the tree, return the new member
instead of the parent node. Also fix the comment regarding the
function.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agobintree: Give the bintree_ops pointer to the callback function
Timo Kokkonen [Sat, 3 Jul 2010 12:39:08 +0000 (15:39 +0300)]
bintree: Give the bintree_ops pointer to the callback function

This allows the callback to get status information if the caller has
embedded his opts structure inside of some other structure.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoStore the process pid to the maps structure
Timo Kokkonen [Sat, 3 Jul 2010 12:17:25 +0000 (15:17 +0300)]
Store the process pid to the maps structure

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
13 years agoparser: Populate pageframe structure completely
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>
13 years agoInitial commit
Timo Kokkonen [Sat, 3 Jul 2010 12:02:25 +0000 (15:02 +0300)]
Initial commit

Not much functionality yet. Reads a single (hard coded) pid's memory
regions and prints the data as debug prints out.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>