From 4f40fb6fbfa95c51b6abfceffcd0e1ce80824e70 Mon Sep 17 00:00:00 2001 From: Jeremie Koenig Date: Mon, 23 Aug 2010 09:05:30 +0000 Subject: Add a TODO-list * TODO: New file. --- TODO | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 TODO (limited to 'TODO') diff --git a/TODO b/TODO new file mode 100644 index 00000000..b4a39b05 --- /dev/null +++ b/TODO @@ -0,0 +1,2 @@ +* Add swap information +* Threads in /proc/[pid]/task/[n] -- cgit v1.2.3 From 164db73bb35173f45a7eaba1984c3169cba778e8 Mon Sep 17 00:00:00 2001 From: Jeremie Koenig Date: Wed, 25 Aug 2010 12:03:16 +0000 Subject: Add swap information to the top-level stat file * rootdir.c (rootdir_gc_meminfo): Add swap information. * TODO: Update. --- TODO | 1 - rootdir.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'TODO') diff --git a/TODO b/TODO index b4a39b05..241c61ae 100644 --- a/TODO +++ b/TODO @@ -1,2 +1 @@ -* Add swap information * Threads in /proc/[pid]/task/[n] diff --git a/rootdir.c b/rootdir.c index 204bc02b..419f774e 100644 --- a/rootdir.c +++ b/rootdir.c @@ -1,7 +1,10 @@ #include #include +#include +#include #include #include +#include #include #include #include @@ -101,6 +104,22 @@ out: return err; } +static error_t +get_swapinfo (default_pager_info_t *info) +{ + mach_port_t defpager; + error_t err; + + defpager = file_name_lookup (_SERVERS_DEFPAGER, O_READ, 0); + if (defpager == MACH_PORT_NULL) + return errno; + + err = default_pager_info (defpager, info); + mach_port_deallocate (mach_task_self (), defpager); + + return err; +} + static error_t rootdir_gc_version (void *hook, char **contents, ssize_t *contents_len) { @@ -223,6 +242,7 @@ rootdir_gc_meminfo (void *hook, char **contents, ssize_t *contents_len) host_basic_info_data_t hbi; mach_msg_type_number_t cnt; struct vm_statistics vmstats; + default_pager_info_t swap; error_t err; err = vm_statistics (mach_task_self (), &vmstats); @@ -234,6 +254,10 @@ rootdir_gc_meminfo (void *hook, char **contents, ssize_t *contents_len) if (err) return err; + err = get_swapinfo (&swap); + if (err) + return err; + assert (cnt == HOST_BASIC_INFO_COUNT); *contents_len = asprintf (contents, "MemTotal: %14lu kB\n" @@ -241,13 +265,17 @@ rootdir_gc_meminfo (void *hook, char **contents, ssize_t *contents_len) "Active: %14lu kB\n" "Inactive: %14lu kB\n" "Mlocked: %14lu kB\n" + "SwapTotal:%14lu kB\n" + "SwapFree: %14lu kB\n" , /* TODO: check that these are really 1024-bytes kBs. */ (long unsigned) hbi.memory_size / 1024, (long unsigned) vmstats.free_count * PAGE_SIZE / 1024, (long unsigned) vmstats.active_count * PAGE_SIZE / 1024, (long unsigned) vmstats.inactive_count * PAGE_SIZE / 1024, - (long unsigned) vmstats.wire_count * PAGE_SIZE / 1024); + (long unsigned) vmstats.wire_count * PAGE_SIZE / 1024, + (long unsigned) swap.dpi_total_space / 1024, + (long unsigned) swap.dpi_free_space / 1024); return 0; } -- cgit v1.2.3 From e25cfb3f3a843122df7e70e97992a97ffe81717a Mon Sep 17 00:00:00 2001 From: Jeremie Koenig Date: Wed, 25 Aug 2010 19:15:35 +0000 Subject: Update the to-do list. * TODO: Add more entries. --- TODO | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'TODO') diff --git a/TODO b/TODO index 241c61ae..952d67bc 100644 --- a/TODO +++ b/TODO @@ -1 +1,24 @@ -* Threads in /proc/[pid]/task/[n] +Known bugs to be fixed +---------------------- + +* The non-owned processes sometimes show up with INT_MAX as their owner, + instead of opt_anon_uid. This is likely to be a libps problem. + +Improvements and new features +----------------------------- + +* There is a lot of dynamic memory allocation going on and it comes with a + cost in performance. We could try to limit such allocation, as long as it + keeps the inner interface simple and preserves the read/readdir semantics + (performance is probably not critical for a proc filesystem.) + One way would be to add an (optional) "needed_length" field to + procfs_node_ops, and arrange to pass a sufficent buffer in (*contents, + *contents_len) when get_contents is called. Then the user-provided buffer + might be used directly under some circumstances. + +* Add thread directories as [pid]/task/[n]. This shouldn't be too hard if we + use "process" nodes for threads, and provide an "exists" hook for the "task" + entry itself so that it's disabled in thread nodes. It might prove necessary + to have "optional" libps flags for some content generators, though, since + some of them might be missing for threads. + -- cgit v1.2.3