bool Table::ProfileClass() { TableTestNode testNode; #if defined(_ARMOR) Time startTicks = gos_GetHiResTime(); #endif Test_Message("Table::ProfileClass\n"); testNode.RunProfile(); SPEW(( GROUP_STUFF_TEST, "Table::ProfileClass elapsed = %f", gos_GetHiResTime() - startTicks )); return true; }
void Tree::ProfileClass() { TreeTestNode testNode; #if defined(_ARMOR) Time startTicks = gos_GetHiResTime(); #endif Test_Message("Tree::ProfileClass \n"); testNode.RunProfile(); SPEW(( GROUP_STUFF_TEST, "Tree::ProfileClass elapsed = %d", gos_GetHiResTime() - startTicks )); }
void SafeChain::ProfileClass() { SafeChainTestNode testNode; #if defined(_ARMOR) Time startTicks = gos_GetHiResTime(); #endif Test_Message("SafeChain::ProfileClass"); testNode.RunProfile(); SPEW(( GROUP_STUFF_TEST, "SafeChain::ProfileClass elapsed = %f", gos_GetHiResTime() - startTicks )); }
bool FileStream::TestClass() { char buffer[65535]; int i; Time total; Time s; Check_Object(FileStreamManager::Instance); FileStream Testit; memset(buffer,'A',65535); SPEW((GROUP_STUFF_TEST, "Starting FileStream test...")); s = gos_GetHiResTime(); for(i=0; i < 1024; i++) { Testit.Open("filetest.tst",WriteOnly); Testit.WriteBytes(buffer,65535); Testit.Close(); Testit.Open("filetest.tst",ReadOnly); Testit.ReadBytes(buffer,65535); Testit.Close(); } total = gos_GetHiResTime() - s; for(i=0; i < 65535; i++) Verify(buffer[i] == 'A'); SPEW((GROUP_STUFF_TEST, "Opening, writing, closing, opening, reading, and closing")); SPEW(( GROUP_STUFF_TEST, " 64K file 1024 times, averaging out to %f ticks apiece...", total / 1024.0f )); SPEW((GROUP_STUFF_TEST, "File data checks out, as well...")); SPEW((GROUP_STUFF_TEST, "Leaving FileStream test...")); return true; };
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void BitTrace::Set() { Check_Object(this); if (!traceUp++) { #if defined(USE_ACTIVE_PROFILE) SetLineImplementation(activeLine); #endif TraceManager::Instance->activeBits |= bitFlag; #if defined(USE_TIME_ANALYSIS) || defined(USE_TRACE_LOG) Time now = gos_GetHiResTime(); #endif #if defined(USE_TIME_ANALYSIS) lastActivity = now; #endif #if defined(USE_TRACE_LOG) // Check_Object(traceManager); IncrementSampleCount(); MemoryStream *log = GetTraceLog(); if (log) { Check_Object(log); TraceSample *sample = Cast_Pointer(TraceSample*, log->GetPointer()); sample->sampleLength = sizeof(*sample); sample->sampleType = TraceSample::GoingUp; sample->traceNumber = traceNumber; sample->sampleTime = now; log->AdvancePointer(sample->sampleLength); } #endif }
// //########################################################################### // RunProfile //########################################################################### // bool TreeTestNode::RunProfile() { TreeTestPlug *testPlug1, *testPlug2; int values[TEST_COUNT]; int i, j; Time startTicks; /* * Generate unique values, shuffle them */ for (i = 0; i < TEST_COUNT; i++) { values[i] = i; } for (i = 0; i < TEST_COUNT; i++) { int tmp; j = i + Random::GetLessThan(TEST_COUNT - i); tmp = values[j]; values[j] = values[i]; values[i] = tmp; } // //-------------------------------------------------------------------- // Run timing tests //-------------------------------------------------------------------- // /* * Create plugs and add to both sockets */ startTicks = gos_GetHiResTime(); for (i = 0; i < TEST_COUNT; i++) { testPlug1 = new TreeTestPlug(values[i]); Register_Object( testPlug1 ); tree1.AddValue(testPlug1, values[i]); tree2.AddValue(testPlug1, values[i]); } SPEW(( GROUP_STUFF_TEST, "TreeTestNode::RunTest Create = %f", gos_GetHiResTime() - startTicks )); /* * Iterate over both sockets */ startTicks = gos_GetHiResTime(); { TreeIteratorOf<TreeTestPlug*, int> iterator1(&tree1); TreeIteratorOf<TreeTestPlug*, int> iterator2(&tree2); Test_Assumption( iterator1.GetSize() == TEST_COUNT ); Test_Assumption( iterator2.GetSize() == TEST_COUNT ); i = 0; while ((testPlug1 = iterator1.ReadAndNext()) != NULL) { Test_Assumption( testPlug1->value == i ); i++; } Test_Assumption( i == TEST_COUNT ); i = 0; while ((testPlug1 = iterator2.ReadAndNext()) != NULL) { Test_Assumption( testPlug1->value == i ); i++; } Test_Assumption( i == TEST_COUNT ); } SPEW(( GROUP_STUFF_TEST, "TreeTestNode::RunTest Iterate = %f", gos_GetHiResTime() - startTicks )); /* * Find */ startTicks = gos_GetHiResTime(); { TreeIteratorOf<TreeTestPlug*, int> iterator1(&tree1); TreeIteratorOf<TreeTestPlug*, int> iterator2(&tree2); for (i = 0; i < TEST_COUNT; i++) { testPlug1 = iterator1.Find(i); testPlug2 = iterator2.Find(i); Test_Assumption( testPlug1->value == i ); Test_Assumption( testPlug2->value == i ); Test_Assumption( testPlug1 == testPlug2 ); } } SPEW(( GROUP_STUFF_TEST, "TreeTestNode::RunTest Find = %f", gos_GetHiResTime() - startTicks )); /* * Destroy from tree1, verify with tree2 */ startTicks = gos_GetHiResTime(); { TreeIteratorOf<TreeTestPlug*, int> iterator1(&tree1); TreeIteratorOf<TreeTestPlug*, int> iterator2(&tree2); Test_Assumption( iterator1.GetSize() == TEST_COUNT ); Test_Assumption( iterator2.GetSize() == TEST_COUNT ); i = 0; while ((testPlug1 = iterator1.ReadAndNext()) != NULL) { Test_Assumption( testPlug1->value == i ); i++; Unregister_Object(testPlug1); delete(testPlug1); } Test_Assumption( i == TEST_COUNT ); Test_Assumption( iterator1.GetSize() == 0 ); Test_Assumption( iterator2.GetSize() == 0 ); } SPEW(( GROUP_STUFF_TEST, "TreeTestNode::RunTest Destroy = %f", gos_GetHiResTime() - startTicks )); return true; }
bool SafeChainTestNode::RunProfile() { SafeChainTestPlug *testPlug1; int i; Time startTicks; // //-------------------------------------------------------------------- // Run timing tests //-------------------------------------------------------------------- // /* * Create plugs and add to both sockets */ startTicks = gos_GetHiResTime(); for (i = 0; i < TEST_COUNT; i++) { testPlug1 = new SafeChainTestPlug(i); Register_Object( testPlug1 ); chain1.Add(testPlug1); chain2.Add(testPlug1); } SPEW(( GROUP_STUFF_TEST, "SafeChainTestNode::RunTest Create = %f", gos_GetHiResTime() - startTicks )); /* * Iterate over both sockets */ startTicks = gos_GetHiResTime(); { SafeChainIteratorOf<SafeChainTestPlug*> iterator1(&chain1); SafeChainIteratorOf<SafeChainTestPlug*> iterator2(&chain2); Test_Assumption( iterator1.GetSize() == TEST_COUNT ); Test_Assumption( iterator2.GetSize() == TEST_COUNT ); i = 0; while ((testPlug1 = iterator1.ReadAndNext()) != NULL) { Test_Assumption( testPlug1->value == i ); i++; } Test_Assumption( i == TEST_COUNT ); i = 0; while ((testPlug1 = iterator2.ReadAndNext()) != NULL) { Test_Assumption( testPlug1->value == i ); i++; } Test_Assumption( i == TEST_COUNT ); } SPEW(( GROUP_STUFF_TEST, "SafeChainTestNode::RunTest Iterate = %f", gos_GetHiResTime() - startTicks )); /* * Destroy from chain1, verify with chain2 */ startTicks = gos_GetHiResTime(); { SafeChainIteratorOf<SafeChainTestPlug*> iterator1(&chain1); SafeChainIteratorOf<SafeChainTestPlug*> iterator2(&chain2); Test_Assumption( iterator1.GetSize() == TEST_COUNT ); Test_Assumption( iterator2.GetSize() == TEST_COUNT ); i = 0; while ((testPlug1 = iterator1.ReadAndNext()) != NULL) { Test_Assumption( testPlug1->value == i ); i++; Unregister_Object( testPlug1 ); delete(testPlug1); } Test_Assumption( i == TEST_COUNT ); Test_Assumption( iterator1.GetSize() == 0 ); Test_Assumption( iterator2.GetSize() == 0 ); } SPEW(( GROUP_STUFF_TEST, "SafeChainTestNode::RunTest Destroy = %f", gos_GetHiResTime() - startTicks )); return true; }