]>
git.itanic.dy.fi Git - scan-pagemap/log
summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
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>
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>
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>
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>
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>
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>
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>
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>
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>
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: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>
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 [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>
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>
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 [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>
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>
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>
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 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>
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>
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>
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 [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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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 20:23:45 +0000 (23:23 +0300)]
main.c: Print per pid statistics
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
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>
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>
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>
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>
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>
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>
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>
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 [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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>