summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneal <neal>2008-06-26 07:02:40 +0000
committerneal <neal>2008-06-26 07:02:40 +0000
commit05e23c2cc501a89ad446415a421472ecfaa9fd2b (patch)
treee37ab6848729df399cd12043a55eb90f76968fe3
parentacf372c67575341f8923940d1d06084cdb37ac55 (diff)
hurd/
2008-06-26 Neal H. Walfield <neal@gnu.org> * cap.h (RM_object_name): Define. (struct object_name): New struct. (object_name): New method. viengoos/ 2008-06-26 Neal H. Walfield <neal@gnu.org> * rm.h (rm_method_id_string): Handle the RM_object_name case. * server.c (server_loop): Implement the object_name method. * activity.h (struct activity): New field name. * thread.h (struct thread): Likewise. * object.h (OBJECT_NAME_FMT): New macro. (OBJECT_NAME_PRINTF): Likewise. * activity.c: Include "thread.h". (do_activity_dump): Use OBJECT_NAME_FMT and OBJECT_NAME_PRINTF rather than OID_FMT and OID_PRINTF. (activity_dump): Only call do_activity_dump if debugging output is enabled. * pager.c: Include "thread.h". (pager_collect): Use OBJECT_NAME_FMT and OBJECT_NAME_PRINTF rather than OID_FMT and OID_PRINTF. * ager.c (update_stats): Likewise.
-rw-r--r--hurd/ChangeLog6
-rw-r--r--hurd/cap.h13
-rw-r--r--viengoos/ChangeLog19
-rw-r--r--viengoos/activity.c8
-rw-r--r--viengoos/activity.h2
-rw-r--r--viengoos/ager.c24
-rw-r--r--viengoos/object.h38
-rw-r--r--viengoos/pager.c6
-rw-r--r--viengoos/rm.h2
-rw-r--r--viengoos/server.c30
-rw-r--r--viengoos/thread.h2
11 files changed, 130 insertions, 20 deletions
diff --git a/hurd/ChangeLog b/hurd/ChangeLog
index c1cb12e..cafdc1c 100644
--- a/hurd/ChangeLog
+++ b/hurd/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-26 Neal H. Walfield <neal@gnu.org>
+
+ * cap.h (RM_object_name): Define.
+ (struct object_name): New struct.
+ (object_name): New method.
+
2008-06-24 Neal H. Walfield <neal@gnu.org>
* cap.h (RM_object_discard): New define.
diff --git a/hurd/cap.h b/hurd/cap.h
index 5722268..559675e 100644
--- a/hurd/cap.h
+++ b/hurd/cap.h
@@ -379,6 +379,7 @@ enum
RM_object_discarded_clear,
RM_object_discard,
RM_object_status,
+ RM_object_name,
};
enum
@@ -494,6 +495,18 @@ enum
RPC (object_status, 3, 1, addr_t, principal, addr_t, object, bool, clear,
uintptr_t, status)
+struct object_name
+{
+ char name[12];
+};
+
+/* Give object OBJECT a name. This is only used for debugging
+ purposes and is only supported by some objects, in particular,
+ activities and threads. */
+RPC (object_name, 3, 0, addr_t, principal,
+ addr_t, object, struct object_name, name);
+
+
#undef RPC_STUB_PREFIX
#undef RPC_ID_PREFIX
#undef RPC_TARGET
diff --git a/viengoos/ChangeLog b/viengoos/ChangeLog
index c54f612..31e9cf3 100644
--- a/viengoos/ChangeLog
+++ b/viengoos/ChangeLog
@@ -1,5 +1,24 @@
2008-06-26 Neal H. Walfield <neal@gnu.org>
+ * rm.h (rm_method_id_string): Handle the RM_object_name case.
+ * server.c (server_loop): Implement the object_name method.
+
+ * activity.h (struct activity): New field name.
+ * thread.h (struct thread): Likewise.
+ * object.h (OBJECT_NAME_FMT): New macro.
+ (OBJECT_NAME_PRINTF): Likewise.
+ * activity.c: Include "thread.h".
+ (do_activity_dump): Use OBJECT_NAME_FMT and OBJECT_NAME_PRINTF
+ rather than OID_FMT and OID_PRINTF.
+ (activity_dump): Only call do_activity_dump if debugging output is
+ enabled.
+ * pager.c: Include "thread.h".
+ (pager_collect): Use OBJECT_NAME_FMT and OBJECT_NAME_PRINTF rather
+ than OID_FMT and OID_PRINTF.
+ * ager.c (update_stats): Likewise.
+
+2008-06-26 Neal H. Walfield <neal@gnu.org>
+
* activity.h (activity_charge): Also update ACTIVITY's claimed and
disowned statistics, as appropriate.
diff --git a/viengoos/activity.c b/viengoos/activity.c
index 0569cb3..b9784d1 100644
--- a/viengoos/activity.c
+++ b/viengoos/activity.c
@@ -23,6 +23,7 @@
#include <hurd/cap.h>
#include "activity.h"
+#include "thread.h"
#include "object.h"
#include "profile.h"
@@ -395,10 +396,10 @@ do_activity_dump (struct activity *activity, int indent)
int clean = eviction_list_count (&activity->eviction_clean);
int dirty = eviction_list_count (&activity->eviction_dirty);
- printf ("%s %llx: %d frames (active: %d, inactive: %d, "
+ printf ("%s " OBJECT_NAME_FMT ": %d frames (active: %d, inactive: %d, "
"pending eviction: %d/%d); total: %d; s:%d/%d; c:%d/%d\n",
indent_string,
- object_to_object_desc ((struct object *) activity)->oid,
+ OBJECT_NAME_PRINTF ((struct object *) activity),
activity->frames_local, active, inactive, clean, dirty,
activity->frames_total,
activity->policy.sibling_rel.priority,
@@ -414,5 +415,6 @@ do_activity_dump (struct activity *activity, int indent)
void
activity_dump (struct activity *activity)
{
- do_activity_dump (activity, 0);
+ do_debug (0)
+ do_activity_dump (activity, 0);
}
diff --git a/viengoos/activity.h b/viengoos/activity.h
index fadf984..38d9997 100644
--- a/viengoos/activity.h
+++ b/viengoos/activity.h
@@ -114,6 +114,8 @@ struct activity
/* The current period. */
unsigned char current_period;
struct activity_stats stats[ACTIVITY_STATS_PERIODS + 1];
+
+ struct object_name name;
};
LIST_CLASS(activity_children, struct activity, sibling, false)
diff --git a/viengoos/ager.c b/viengoos/ager.c
index 934b56c..6549c7e 100644
--- a/viengoos/ager.c
+++ b/viengoos/ager.c
@@ -97,10 +97,9 @@ update_stats (void)
dec /= 5 - MIN (ACTIVITY_STATS (activity)->pressure, 4);
debug (0, "Due to pressure (%d), decreasing frames available "
- "to " OID_FMT " from %d to %d",
+ "to " OBJECT_NAME_FMT " from %d to %d",
ACTIVITY_STATS (activity)->pressure,
- OID_PRINTF (object_to_object_desc ((struct object *)
- activity)->oid),
+ OBJECT_NAME_PRINTF ((struct object *) activity),
frames, frames - dec);
frames -= dec;
@@ -304,13 +303,13 @@ update_stats (void)
else
free = 0;
- debug (5, OID_FMT ": alloced: %d of %d, "
+ debug (5, "Period %d: " OBJECT_NAME_FMT ": alloced: %d of %d, "
"priority: %d, weight: %d/%lld, prio group frames: %d, "
"claimed: %d, disowned: %d, "
"share: %d, excess: %d, unused: %d, "
"could steal: %d, could use: %d, free: %d, avail: %d",
- OID_PRINTF (object_to_object_desc ((struct object *)
- activity)->oid),
+ period / FREQ,
+ OBJECT_NAME_PRINTF ((struct object *) activity),
my_alloced, alloced, priority, my_weight, weight, frames,
my_claimed, my_disowned, share, excess, unused,
could_steal, could_use, free, avail);
@@ -343,10 +342,9 @@ update_stats (void)
frames = 0;
}
- debug (5, OID_FMT " (s: %d/%d; c: %d/%d): "
- "%d/%d frames, %d/%d avail (" OID_FMT ")",
- OID_PRINTF (object_to_object_desc ((struct object *)
- activity)->oid),
+ debug (5, OBJECT_NAME_FMT " (s: %d/%d; c: %d/%d): "
+ "%d/%d frames, %d/%d avail (" OBJECT_NAME_FMT ")",
+ OBJECT_NAME_PRINTF ((struct object *) activity),
activity->policy.sibling_rel.priority,
activity->policy.sibling_rel.weight,
activity->policy.child_rel.priority,
@@ -355,10 +353,8 @@ update_stats (void)
activity->frames_total,
ACTIVITY_STATS (activity)->available_local,
ACTIVITY_STATS (activity)->available,
- OID_PRINTF (activity->parent
- ? object_to_object_desc ((struct object *)
- activity->parent)->oid
- : 0));
+ OBJECT_NAME_PRINTF ((struct object *)
+ (activity->parent ?: root_activity)));
activity->current_period ++;
if (activity->current_period == ACTIVITY_STATS_PERIODS + 1)
diff --git a/viengoos/object.h b/viengoos/object.h
index 4d8cb43..161d636 100644
--- a/viengoos/object.h
+++ b/viengoos/object.h
@@ -207,6 +207,44 @@ struct object_desc
memory map. */
extern struct object_desc *object_descs;
+/* This does not really belong here but there isn't really a better
+ place. The first reason is that it relies on the definition of
+ struct activity and struct thread and this header file includes
+ neither activity.h nor thread.h. */
+#define OBJECT_NAME_FMT "%s%s" OID_FMT
+#define OBJECT_NAME_PRINTF(__onp) \
+ ({ \
+ const char *name = ""; \
+ if (object_type ((__onp)) == cap_activity_control) \
+ { \
+ struct activity *a = (struct activity *) (__onp); \
+ name = a->name.name; \
+ } \
+ else if (object_type ((__onp)) == cap_thread) \
+ { \
+ struct thread *t = (struct thread *) (__onp); \
+ name = t->name.name; \
+ } \
+ name; \
+ }), \
+ ({ \
+ const char *name = ""; \
+ if (object_type ((__onp)) == cap_activity_control) \
+ { \
+ struct activity *a = (struct activity *) (__onp); \
+ name = a->name.name; \
+ } \
+ else if (object_type ((__onp)) == cap_thread) \
+ { \
+ struct thread *t = (struct thread *) (__onp); \
+ name = t->name.name; \
+ } \
+ const char *space = ""; \
+ if (*name) \
+ space = " "; \
+ space; \
+ }), OID_PRINTF (object_to_object_desc ((__onp))->oid) \
+
LIST_CLASS(activity_lru, struct object_desc, activity_node, true)
LIST_CLASS(eviction, struct object_desc, activity_node, true)
diff --git a/viengoos/pager.c b/viengoos/pager.c
index 0dd3f72..85bf1ba 100644
--- a/viengoos/pager.c
+++ b/viengoos/pager.c
@@ -23,6 +23,7 @@
#include "activity.h"
#include "object.h"
#include "pager.h"
+#include "thread.h"
#include "profile.h"
int pager_min_alloc_before_next_collect;
@@ -530,10 +531,9 @@ pager_collect (int goal)
assertx (victim_frames >= share,
"%d < %d", victim_frames, share);
- debug (0, DEBUG_BOLD ("Revoking from activity " OID_FMT "%s, ")
+ DEBUG (5, DEBUG_BOLD ("Revoking from activity " OBJECT_NAME_FMT ", ")
"%d/%d frames (pending eviction: %d/%d), share: %d, goal: %d",
- OID_PRINTF (object_to_object_desc ((struct object *) victim)->oid),
- victim->parent ? "" : " (root activity)",
+ OBJECT_NAME_PRINTF ((struct object *) victim),
victim->frames_local, victim->frames_total,
eviction_list_count (&victim->eviction_dirty),
victim->frames_pending_eviction,
diff --git a/viengoos/rm.h b/viengoos/rm.h
index 59ab1ea..868c32b 100644
--- a/viengoos/rm.h
+++ b/viengoos/rm.h
@@ -67,6 +67,8 @@ rm_method_id_string (int id)
return "object_discard";
case RM_object_status:
return "object_status";
+ case RM_object_name:
+ return "object_name";
case RM_exception_collect:
return "exception_collect";
case RM_thread_exregs:
diff --git a/viengoos/server.c b/viengoos/server.c
index f2bf6e2..067ad5f 100644
--- a/viengoos/server.c
+++ b/viengoos/server.c
@@ -1178,6 +1178,36 @@ server_loop (void)
break;
}
+ case RM_object_name:
+ {
+ addr_t object_addr;
+ struct object_name name;
+
+ err = rm_object_name_send_unmarshal
+ (&msg, &principal_addr, &object_addr, &name);
+
+ struct object *object = OBJECT (&thread->aspace,
+ object_addr, -1, false);
+
+ if (object_type (object) == cap_activity_control)
+ {
+ struct activity *a = (struct activity *) object;
+
+ memcpy (a->name.name, name.name, sizeof (name));
+ a->name.name[sizeof (a->name.name) - 1] = 0;
+ }
+ else if (object_type (object) == cap_thread)
+ {
+ struct thread *t = (struct thread *) object;
+
+ memcpy (t->name.name, name.name, sizeof (name));
+ t->name.name[sizeof (t->name.name) - 1] = 0;
+ }
+
+ rm_object_name_reply_marshal (&msg);
+ break;
+ }
+
case RM_thread_exregs:
{
struct hurd_thread_exregs_in in;
diff --git a/viengoos/thread.h b/viengoos/thread.h
index 2d6cb63..27321f6 100644
--- a/viengoos/thread.h
+++ b/viengoos/thread.h
@@ -113,6 +113,8 @@ struct thread
#ifndef NDEBUG
struct list_node futex_waiter_node;
#endif
+
+ struct object_name name;
};
#ifndef NDEBUG