1 /* 2 $Id: BlockCacheConcurrencyTest.h 4522 2003-09-07 11:53:03Z bonefish $ 3 4 This file defines a class for testing BBlockCache 5 6 */ 7 8 9 #ifndef BlockCacheConcurrencyTest_H 10 #define BlockCacheConcurrencyTest_H 11 12 13 #include "ThreadedTestCase.h" 14 #include <string> 15 #include <OS.h> 16 17 18 class BBlockCache; 19 class BList; 20 21 22 class BlockCacheConcurrencyTest : public BThreadedTestCase { 23 24 private: 25 BBlockCache *theObjCache; 26 BBlockCache *theMallocCache; 27 int numBlocksInCache; 28 size_t sizeOfBlocksInCache; 29 size_t sizeOfNonCacheBlocks; 30 31 void *GetBlock(BBlockCache *theCache, size_t blockSize, 32 thread_id theThread, BList *cacheList, BList *nonCacheList); 33 void SaveBlock(BBlockCache *theCache, void *, size_t blockSize, 34 thread_id theThread, BList *cacheList, BList *nonCacheList); 35 void FreeBlock(void *, size_t blockSize, bool isMallocTest, 36 thread_id theThread, BList *cacheList, 37 BList *nonCacheList); 38 void TestBlockCache(BBlockCache *theCache, bool isMallocTest); 39 40 public: 41 static Test *suite(void); 42 void TestThreadObj(void); 43 void TestThreadMalloc(void); 44 virtual void setUp(void); 45 virtual void tearDown(void); 46 BlockCacheConcurrencyTest(std::string); 47 virtual ~BlockCacheConcurrencyTest(); 48 }; 49 50 #endif 51