* Fixed maintaining the object depot's free magazine count (it's not really used
though). * Added/improved some KDL commands to make the slab easier to work with from KDL. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35466 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2cb3c4eb06
commit
54f3267e78
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
|
* Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
* Copyright 2008, Axel Dörfler. All Rights Reserved.
|
* Copyright 2008-2010, Axel Dörfler. All Rights Reserved.
|
||||||
* Copyright 2007, Hugo Santos. All Rights Reserved.
|
* Copyright 2007, Hugo Santos. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
@ -76,6 +76,9 @@ DepotMagazine::Push(void* object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
static DepotMagazine*
|
static DepotMagazine*
|
||||||
alloc_magazine(uint32 flags)
|
alloc_magazine(uint32 flags)
|
||||||
{
|
{
|
||||||
@ -150,6 +153,7 @@ push_empty_magazine(object_depot* depot, DepotMagazine* magazine)
|
|||||||
SpinLocker _(depot->inner_lock);
|
SpinLocker _(depot->inner_lock);
|
||||||
|
|
||||||
_push(depot->empty, magazine);
|
_push(depot->empty, magazine);
|
||||||
|
depot->empty_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -322,3 +326,55 @@ object_depot_make_empty(object_depot* depot, uint32 flags)
|
|||||||
while (emptyMagazines)
|
while (emptyMagazines)
|
||||||
free_magazine(_pop(emptyMagazines), flags);
|
free_magazine(_pop(emptyMagazines), flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - private kernel API
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
dump_object_depot(object_depot* depot)
|
||||||
|
{
|
||||||
|
kprintf(" full: %p, count %lu\n", depot->full, depot->full_count);
|
||||||
|
kprintf(" empty: %p, count %lu\n", depot->empty, depot->empty_count);
|
||||||
|
kprintf(" stores:\n");
|
||||||
|
|
||||||
|
int cpuCount = smp_get_num_cpus();
|
||||||
|
|
||||||
|
for (int i = 0; i < cpuCount; i++) {
|
||||||
|
kprintf(" [%d] loaded: %p\n", i, depot->stores[i].loaded);
|
||||||
|
kprintf(" previous: %p\n", depot->stores[i].previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
dump_object_depot(int argCount, char** args)
|
||||||
|
{
|
||||||
|
if (argCount != 2)
|
||||||
|
kprintf("usage: %s [address]\n", args[0]);
|
||||||
|
else
|
||||||
|
dump_object_depot((object_depot*)parse_expression(args[1]));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
dump_depot_magazine(int argCount, char** args)
|
||||||
|
{
|
||||||
|
if (argCount != 2) {
|
||||||
|
kprintf("usage: %s [address]\n", args[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DepotMagazine* magazine = (DepotMagazine*)parse_expression(args[1]);
|
||||||
|
|
||||||
|
kprintf("next: %p\n", magazine->next);
|
||||||
|
kprintf("current_round: %u\n", magazine->current_round);
|
||||||
|
kprintf("round_count: %u\n", magazine->round_count);
|
||||||
|
|
||||||
|
for (uint16 i = 0; i < magazine->current_round; i++)
|
||||||
|
kprintf(" [%i] %p\n", i, magazine->rounds[i]);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, Ingo Weinhold <ingo_weinhold@gmx.de>.
|
* Copyright 2010, Ingo Weinhold <ingo_weinhold@gmx.de>.
|
||||||
* Copyright 2008, Axel Dörfler. All Rights Reserved.
|
* Copyright 2008-2010, Axel Dörfler. All Rights Reserved.
|
||||||
* Copyright 2007, Hugo Santos. All Rights Reserved.
|
* Copyright 2007, Hugo Santos. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
@ -226,7 +226,7 @@ dump_cache_info(int argc, char* argv[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectCache* cache = (ObjectCache*)strtoul(argv[1], NULL, 16);
|
ObjectCache* cache = (ObjectCache*)parse_expression(argv[1]);
|
||||||
|
|
||||||
kprintf("name: %s\n", cache->name);
|
kprintf("name: %s\n", cache->name);
|
||||||
kprintf("lock: %p\n", &cache->lock);
|
kprintf("lock: %p\n", &cache->lock);
|
||||||
@ -243,6 +243,11 @@ dump_cache_info(int argc, char* argv[])
|
|||||||
kprintf("resize entry don't wait: %p\n", cache->resize_entry_dont_wait);
|
kprintf("resize entry don't wait: %p\n", cache->resize_entry_dont_wait);
|
||||||
kprintf("resize entry can wait: %p\n", cache->resize_entry_can_wait);
|
kprintf("resize entry can wait: %p\n", cache->resize_entry_can_wait);
|
||||||
|
|
||||||
|
if ((cache->flags & CACHE_NO_DEPOT) == 0) {
|
||||||
|
kprintf("depot:\n");
|
||||||
|
dump_object_depot(&cache->depot);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -735,6 +740,10 @@ slab_init_post_area()
|
|||||||
add_debugger_command("slabs", dump_slabs, "list all object caches");
|
add_debugger_command("slabs", dump_slabs, "list all object caches");
|
||||||
add_debugger_command("slab_cache", dump_cache_info,
|
add_debugger_command("slab_cache", dump_cache_info,
|
||||||
"dump information about a specific object cache");
|
"dump information about a specific object cache");
|
||||||
|
add_debugger_command("slab_depot", dump_object_depot,
|
||||||
|
"dump contents of an object depot");
|
||||||
|
add_debugger_command("slab_magazine", dump_depot_magazine,
|
||||||
|
"dump contents of a depot magazine");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include <debug_paranoia.h>
|
#include <debug_paranoia.h>
|
||||||
|
|
||||||
struct ObjectCache;
|
struct ObjectCache;
|
||||||
|
struct object_depot;
|
||||||
|
|
||||||
|
|
||||||
void request_memory_manager_maintenance();
|
void request_memory_manager_maintenance();
|
||||||
|
|
||||||
@ -36,6 +38,10 @@ void block_free(void* block, uint32 flags);
|
|||||||
void block_allocator_init_boot();
|
void block_allocator_init_boot();
|
||||||
void block_allocator_init_rest();
|
void block_allocator_init_rest();
|
||||||
|
|
||||||
|
void dump_object_depot(object_depot* depot);
|
||||||
|
int dump_object_depot(int argCount, char** args);
|
||||||
|
int dump_depot_magazine(int argCount, char** args);
|
||||||
|
|
||||||
|
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
static inline Type*
|
static inline Type*
|
||||||
|
Loading…
Reference in New Issue
Block a user