diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-03-17 07:56:31 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-03-18 07:43:46 +0100 |
commit | 5eaf0e7458bac80ba669f03c4feaae5bad55c6c9 (patch) | |
tree | a6ed26d6617c2b1c2503df1607443e966d875897 /cpukit/libcsupport/src/resource_snapshot.c | |
parent | score: Destroy thread timer lock (diff) | |
download | rtems-5eaf0e7458bac80ba669f03c4feaae5bad55c6c9.tar.bz2 |
posix: Use per-thread lookup tree for POSIX Keys
Yields higher performance on SMP systems.
Close #2625.
Diffstat (limited to 'cpukit/libcsupport/src/resource_snapshot.c')
-rw-r--r-- | cpukit/libcsupport/src/resource_snapshot.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/cpukit/libcsupport/src/resource_snapshot.c b/cpukit/libcsupport/src/resource_snapshot.c index d6f2e4606e..198015593f 100644 --- a/cpukit/libcsupport/src/resource_snapshot.c +++ b/cpukit/libcsupport/src/resource_snapshot.c @@ -105,31 +105,24 @@ static void get_heap_info(Heap_Control *heap, Heap_Information_block *info) memset(&info->Stats, 0, sizeof(info->Stats)); } -static bool count_posix_key_value_pairs( - const RBTree_Node *node, - void *visitor_arg -) +static POSIX_Keys_Control *get_next_key(Objects_Id *id) { - uint32_t *count = visitor_arg; - - (void) node; + Objects_Locations location; - ++(*count); - - return false; + return (POSIX_Keys_Control *) + _Objects_Get_next(&_POSIX_Keys_Information, *id, &location, id); } static uint32_t get_active_posix_key_value_pairs(void) { uint32_t count = 0; + Objects_Id id = OBJECTS_ID_INITIAL_INDEX; + POSIX_Keys_Control *the_key; - _Thread_Disable_dispatch(); - _RBTree_Iterate( - &_POSIX_Keys_Key_value_lookup_tree, - count_posix_key_value_pairs, - &count - ); - _Thread_Enable_dispatch(); + while ((the_key = get_next_key(&id)) != NULL ) { + count += _Chain_Node_count_unprotected(&the_key->Key_value_pairs); + _Objects_Allocator_unlock(); + } return count; } |