diff options
author | Steve Reinhardt <stever@gmail.com> | 2008-03-24 01:08:02 -0400 |
---|---|---|
committer | Steve Reinhardt <stever@gmail.com> | 2008-03-24 01:08:02 -0400 |
commit | 627592c2f2a9d2774df50b2b5039efcb71432bc7 (patch) | |
tree | fe2cd42b91630181f7dfd9e595c885c42f56d4a5 /src/base/fast_alloc.cc | |
parent | 407710d387497f44de53baf0ae60a2c426c1bb74 (diff) | |
download | gem5-627592c2f2a9d2774df50b2b5039efcb71432bc7.tar.xz |
Add FAST_ALLOC_DEBUG and FAST_ALLOC_STATS as SConstruct options.
--HG--
extra : convert_revision : 56a7f646f2ac87019c78ba7fa62c5f4bdc00ba44
Diffstat (limited to 'src/base/fast_alloc.cc')
-rw-r--r-- | src/base/fast_alloc.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/base/fast_alloc.cc b/src/base/fast_alloc.cc index e1298a8bd..e263df893 100644 --- a/src/base/fast_alloc.cc +++ b/src/base/fast_alloc.cc @@ -45,7 +45,7 @@ void *FastAlloc::freeLists[Num_Buckets]; -#ifdef FAST_ALLOC_STATS +#if FAST_ALLOC_STATS unsigned FastAlloc::newCount[Num_Buckets]; unsigned FastAlloc::deleteCount[Num_Buckets]; unsigned FastAlloc::allocCount[Num_Buckets]; @@ -59,7 +59,7 @@ void *FastAlloc::moreStructs(int bucket) const int nstructs = Num_Structs_Per_New; // how many to allocate? char *p = ::new char[nstructs * sz]; -#ifdef FAST_ALLOC_STATS +#if FAST_ALLOC_STATS ++allocCount[bucket]; #endif @@ -72,7 +72,7 @@ void *FastAlloc::moreStructs(int bucket) } -#ifdef FAST_ALLOC_DEBUG +#if FAST_ALLOC_DEBUG #include <typeinfo> #include <iostream> @@ -167,9 +167,9 @@ FastAlloc::dump_oldest(int n) return; } - for (FastAlloc *p = inUseHead.inUsePrev; + for (FastAlloc *p = inUseHead.inUseNext; p != &inUseHead && n > 0; - p = p->inUsePrev, --n) + p = p->inUseNext, --n) { cout << p << " " << typeid(*p).name() << endl; } @@ -180,11 +180,13 @@ FastAlloc::dump_oldest(int n) // C interfaces to FastAlloc::dump_summary() and FastAlloc::dump_oldest(). // gdb seems to have trouble with calling C++ functions directly. // +void fast_alloc_summary() { FastAlloc::dump_summary(); } +void fast_alloc_oldest(int n) { FastAlloc::dump_oldest(n); |