* Added a peak value (the maximum number of allocated objects) to the net_buffer
stats. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35602 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -163,6 +163,8 @@ static vint32 sAllocatedDataHeaderCount = 0;
|
|||||||
static vint32 sAllocatedNetBufferCount = 0;
|
static vint32 sAllocatedNetBufferCount = 0;
|
||||||
static vint32 sEverAllocatedDataHeaderCount = 0;
|
static vint32 sEverAllocatedDataHeaderCount = 0;
|
||||||
static vint32 sEverAllocatedNetBufferCount = 0;
|
static vint32 sEverAllocatedNetBufferCount = 0;
|
||||||
|
static vint32 sMaxAllocatedDataHeaderCount = 0;
|
||||||
|
static vint32 sMaxAllocatedNetBufferCount = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -611,10 +613,12 @@ dump_net_buffer(int argc, char** argv)
|
|||||||
static int
|
static int
|
||||||
dump_net_buffer_stats(int argc, char** argv)
|
dump_net_buffer_stats(int argc, char** argv)
|
||||||
{
|
{
|
||||||
kprintf("allocated data headers: %7ld / %7ld\n", sAllocatedDataHeaderCount,
|
kprintf("allocated data headers: %7ld / %7ld, peak %7ld\n",
|
||||||
sEverAllocatedDataHeaderCount);
|
sAllocatedDataHeaderCount, sEverAllocatedDataHeaderCount,
|
||||||
kprintf("allocated net buffers: %7ld / %7ld\n", sAllocatedNetBufferCount,
|
sMaxAllocatedDataHeaderCount);
|
||||||
sEverAllocatedNetBufferCount);
|
kprintf("allocated net buffers: %7ld / %7ld, peak %7ld\n",
|
||||||
|
sAllocatedNetBufferCount, sEverAllocatedNetBufferCount,
|
||||||
|
sMaxAllocatedNetBufferCount);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -706,7 +710,11 @@ static inline data_header*
|
|||||||
allocate_data_header()
|
allocate_data_header()
|
||||||
{
|
{
|
||||||
#if ENABLE_STATS
|
#if ENABLE_STATS
|
||||||
atomic_add(&sAllocatedDataHeaderCount, 1);
|
int32 current = atomic_add(&sAllocatedDataHeaderCount, 1) + 1;
|
||||||
|
int32 max = atomic_get(&sMaxAllocatedDataHeaderCount);
|
||||||
|
if (current > max)
|
||||||
|
atomic_test_and_set(&sMaxAllocatedDataHeaderCount, current, max);
|
||||||
|
|
||||||
atomic_add(&sEverAllocatedDataHeaderCount, 1);
|
atomic_add(&sEverAllocatedDataHeaderCount, 1);
|
||||||
#endif
|
#endif
|
||||||
return (data_header*)object_cache_alloc(sDataNodeCache, 0);
|
return (data_header*)object_cache_alloc(sDataNodeCache, 0);
|
||||||
@@ -717,7 +725,11 @@ static inline net_buffer_private*
|
|||||||
allocate_net_buffer()
|
allocate_net_buffer()
|
||||||
{
|
{
|
||||||
#if ENABLE_STATS
|
#if ENABLE_STATS
|
||||||
atomic_add(&sAllocatedNetBufferCount, 1);
|
int32 current = atomic_add(&sAllocatedNetBufferCount, 1) + 1;
|
||||||
|
int32 max = atomic_get(&sMaxAllocatedNetBufferCount);
|
||||||
|
if (current > max)
|
||||||
|
atomic_test_and_set(&sMaxAllocatedNetBufferCount, current, max);
|
||||||
|
|
||||||
atomic_add(&sEverAllocatedNetBufferCount, 1);
|
atomic_add(&sEverAllocatedNetBufferCount, 1);
|
||||||
#endif
|
#endif
|
||||||
return (net_buffer_private*)object_cache_alloc(sNetBufferCache, 0);
|
return (net_buffer_private*)object_cache_alloc(sNetBufferCache, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user