示例#1
0
// See if we can insert some tags
TEST(ThreadProfile, InsertTagsNoWrap) {
  PseudoStack* stack = new PseudoStack();
  Thread::tid_t tid = 1000;
  ThreadInfo info("testThread", tid, true, stack, nullptr);
  ThreadProfile tp(&info, 100);
  int test_size = 50;
  for (int i = 0; i < test_size; i++) {
    tp.addTag(ProfileEntry('t', i));
  }
  ASSERT_TRUE(tp.mEntries != nullptr);
  int readPos = tp.mReadPos;
  while (readPos != tp.mWritePos) {
    ASSERT_TRUE(tp.mEntries[readPos].mTagName == 't');
    ASSERT_TRUE(tp.mEntries[readPos].mTagInt == readPos);
    readPos = (readPos + 1) % tp.mEntrySize;
  }
}
示例#2
0
// See if we can insert some tags
TEST(ThreadProfile, InsertTagsNoWrap) {
  PseudoStack* stack = PseudoStack::create();
  Thread::tid_t tid = 1000;
  ThreadInfo info("testThread", tid, true, stack, nullptr);
  RefPtr<ProfileBuffer> pb = new ProfileBuffer(100);
  int test_size = 50;
  for (int i = 0; i < test_size; i++) {
    pb->addTag(ProfileEntry('t', i));
  }
  ASSERT_TRUE(pb->mEntries != nullptr);
  int readPos = pb->mReadPos;
  while (readPos != pb->mWritePos) {
    ASSERT_TRUE(pb->mEntries[readPos].mTagName == 't');
    ASSERT_TRUE(pb->mEntries[readPos].mTagInt == readPos);
    readPos = (readPos + 1) % pb->mEntrySize;
  }
}
示例#3
0
void ThreadProfile::addTag(ProfileEntry aTag)
{
  // Called from signal, call only reentrant functions
  mEntries[mWritePos] = aTag;
  mWritePos = mWritePos + 1;
  if (mWritePos >= mEntrySize) {
    mPendingGenerationFlush++;
    mWritePos = mWritePos % mEntrySize;
  }
  if (mWritePos == mReadPos) {
    // Keep one slot open
    mEntries[mReadPos] = ProfileEntry();
    mReadPos = (mReadPos + 1) % mEntrySize;
  }
  // we also need to move the flush pos to ensure we
  // do not pass it
  if (mWritePos == mLastFlushPos) {
    mLastFlushPos = (mLastFlushPos + 1) % mEntrySize;
  }
}
void ProfileSection::AddProfileToMap(const std::string& profileName){
	profileCritSec.Enter();
	ProfileMapIterator profileEntry = s_profileMap.find(profileName);
	//if entry exists, increment existing entry
	if (profileEntry != s_profileMap.end()){
		ProfileReport& existingProfile = (profileEntry->second);

		//assumes elapsed time already set
		existingProfile.m_totalElapsedTime += elapsedTime;
		existingProfile.m_numCalls++;//= numCalls;
		
		existingProfile.SetAverageElapsedTime();
	}
	else{
		//numCalls++;
		//add entry
		s_profileMap.insert(ProfileEntry(profileName, ProfileReport(profileName, totalElapsedTime, numCalls)));
		//Access violation reading location 0xBAADF00D. serious memory corruption here O.o
	}
	profileCritSec.Exit();
}
示例#5
0
// See if wrapping works as it should in the basic case
TEST(ThreadProfile, InsertTagsWrap) {
  PseudoStack* stack = new PseudoStack();
  Thread::tid_t tid = 1000;
  // we can fit only 24 tags in this buffer because of the empty slot
  int tags = 24;
  int buffer_size = tags + 1;
  ThreadInfo info("testThread", tid, true, stack, nullptr);
  ThreadProfile tp(&info, buffer_size);
  int test_size = 43;
  for (int i = 0; i < test_size; i++) {
    tp.addTag(ProfileEntry('t', i));
  }
  ASSERT_TRUE(tp.mEntries != nullptr);
  int readPos = tp.mReadPos;
  int ctr = 0;
  while (readPos != tp.mWritePos) {
    ASSERT_TRUE(tp.mEntries[readPos].mTagName == 't');
    // the first few tags were discarded when we wrapped
    ASSERT_TRUE(tp.mEntries[readPos].mTagInt == ctr + (test_size - tags));
    ctr++;
    readPos = (readPos + 1) % tp.mEntrySize;
  }
}
示例#6
0
//=============================================================================
BundleFile::BundleFile( PROFILES p )  //: iniFile( 0 )
{
   switch ( p )
   {
      case epLOGGERPROFILE:

         entries.push_back( ProfileEntry( elpPreloadFile, "PreloadFile", ".\\Configuration\\Preload.ini", "hint" ) );
         entries.push_back( ProfileEntry( elpPreloadSection, "PreloadSection", "Default", "hint" ) );
         entries.push_back( ProfileEntry( elpDisplayFile, "DisplayFile", ".\\Configuration\\Display.ini", "hint" ) );
         entries.push_back( ProfileEntry( elpDisplaySection, "DisplaySection", "Default", "hint" ) );
         entries.push_back( ProfileEntry( elpOperatorFile, "OperatorFile", ".\\Configuration\\Operator.ini", "hint" ) );
         entries.push_back( ProfileEntry( elpOperatorSection, "OperatorSection", "Default", "hint" ) );
         entries.push_back( ProfileEntry( elpListDirectory, "List Directory", ".\\Lists", "hint" ) );
         entries.push_back( ProfileEntry( elpLogDirectory, "Log Directory", ".\\Logs", "hint" ) );

         entries.push_back( ProfileEntry( elpEntryFile, "EntryFile", ".\\Configuration\\Entry.ini", "hint" ) );
         entries.push_back( ProfileEntry( elpContestFile, "ContestsFile", ".\\Configuration\\Contests.ini", "hint" ) );
         entries.push_back( ProfileEntry( elpStationFile, "StationFile", ".\\Configuration\\Station.ini", "hint" ) );
         entries.push_back( ProfileEntry( elpQTHFile, "QTHFile", ".\\Configuration\\QTH.ini", "hint" ) );
         break;
      case epPRELOADPROFILE:
         entries.push_back( ProfileEntry( eppCurrent, "Current", 0, "hint" ) );
         entries.push_back( ProfileEntry( epp1, "1", "", "hint" ) );
         entries.push_back( ProfileEntry( epp2, "2", "", "hint" ) );
         entries.push_back( ProfileEntry( epp3, "3", "", "hint" ) );
         entries.push_back( ProfileEntry( epp4, "4", "", "hint" ) );
         entries.push_back( ProfileEntry( epp5, "5", "", "hint" ) );
         entries.push_back( ProfileEntry( epp6, "6", "", "hint" ) );
         entries.push_back( ProfileEntry( epp7, "7", "", "hint" ) );
         entries.push_back( ProfileEntry( epp8, "8", "", "hint" ) );
         entries.push_back( ProfileEntry( epp9, "9", "", "hint" ) );
         entries.push_back( ProfileEntry( epp10, "10", "", "hint" ) );
         break;
      case epDISPLAYPROFILE:
         //         entries.push_back( ProfileEntry( edpFontName, "FontName", "Verdana", "Font name" ) );
         //         entries.push_back( ProfileEntry( edpFontSize, "FontSize", 8, "Font Size (points)" ) );
         entries.push_back( ProfileEntry( edpTop, "Top", 10, "Top of Logger window" ) );
         entries.push_back( ProfileEntry( edpLeft, "Left", 25, "Left of Logger window" ) );
         entries.push_back( ProfileEntry( edpWidth, "Width", 750, "Width of Logger window" ) );
         entries.push_back( ProfileEntry( edpHeight, "Height", 590, "Height of Logger window" ) );
         entries.push_back( ProfileEntry( edpShowContinentEU, "ShowContinentEU", true, "hint" ) );
         entries.push_back( ProfileEntry( edpShowContinentAS, "ShowContinentAS", false, "hint" ) );
         entries.push_back( ProfileEntry( edpShowContinentAF, "ShowContinentAF", false, "hint" ) );
         entries.push_back( ProfileEntry( edpShowContinentOC, "ShowContinentOC", false, "hint" ) );
         entries.push_back( ProfileEntry( edpShowContinentSA, "ShowContinentSA", false, "hint" ) );
         entries.push_back( ProfileEntry( edpShowContinentNA, "ShowContinentNA", false, "hint" ) );
         entries.push_back( ProfileEntry( edpShowWorked, "ShowWorked", true, "hint" ) );
         entries.push_back( ProfileEntry( edpShowUnworked, "ShowUnworked", true, "hint" ) );
         entries.push_back( ProfileEntry( edpNextContactDetailsOnLeft, "ShowNextContactDetailsOnLeft", false, "hint" ) );
         entries.push_back( ProfileEntry( edpEditor, "Editor", "Notepad.exe", "Default editor" ) );
         entries.push_back( ProfileEntry( edpAutoBandMapTuneAmount, "AutoBandMapTuneAmount", 2000, "Send to band map on tune more than x Hz " ) );
         entries.push_back( ProfileEntry( edpAutoBandMapTune, "AutoBandMapTune", false, "Enable send to band map on tune" ) );
         entries.push_back( ProfileEntry( edpAutoBandMapTimeLapse, "AutoBandMapTimeLapse", 20, "Send to band map on leaving more than x seconds " ) );
         entries.push_back( ProfileEntry( edpAutoBandMapTime, "AutoBandMapTime", false, "Enable send to band map on time lapse" ) );
         entries.push_back( ProfileEntry( edpStatisticsPeriod1, "Statistics Period 1", 10, "Statistics Period 1" ) );
         entries.push_back( ProfileEntry( edpStatisticsPeriod2, "Statistics Period 2", 60, "Statistics Period 2" ) );
         break;
      case epENTRYPROFILE:
         entries.push_back( ProfileEntry( eepCall, "Call", "", "Call sign used" ) );
         entries.push_back( ProfileEntry( eepEntrant, "Entrant", "", "Name of club/group" ) );
         entries.push_back( ProfileEntry( eepMyName, "MyName", "", "Name of responsible operator" ) );
         entries.push_back( ProfileEntry( eepMyCall, "MyCall", "", "Callsign of responsible operator" ) );

         entries.push_back( ProfileEntry( eepMyAddress1, "MyAddress1", "", "Address line 1 of responsible operator" ) );
         entries.push_back( ProfileEntry( eepMyAddress2, "MyAddress2", "", "Address line 2 of responsible operator" ) );
         entries.push_back( ProfileEntry( eepMyCity, "MyCity", "", "City of responsible operator" ) );
         entries.push_back( ProfileEntry( eepMyCountry, "MyCountry", "", "Country of responsible operator" ) );
         entries.push_back( ProfileEntry( eepMyPostCode, "MyPostCode", "", "Post Code of responsible operator" ) );
         entries.push_back( ProfileEntry( eepMyPhone, "MyPhone", "", "Phone no. of responsible operator" ) );
         entries.push_back( ProfileEntry( eepMyEmail, "MyEmail", "", "eMail address of responsible operator" ) );
         break;
      case epCONTESTPROFILE:
         entries.push_back( ProfileEntry( ecpName, "ContestName", "", "Contest name" ) );
         entries.push_back( ProfileEntry( ecpBands, "Bands", "", "List of Contest Bands" ) );
         entries.push_back( ProfileEntry( ecpSections, "Sections", "", "List of Contest sections" ) );
         entries.push_back( ProfileEntry( ecpScoreKmQSO, "ScoreKms", true, "0 = pt/QSO, 1 = Score pt/Km" ) );
         entries.push_back( ProfileEntry( ecpStart, "Start", "", "Date/time of contest start" ) );
         entries.push_back( ProfileEntry( ecpEnd, "End", "", "Date/time of contest start" ) );
         entries.push_back( ProfileEntry( ecpDistrictMult, "DistrictMult", false, "1 = District Mult" ) );
         entries.push_back( ProfileEntry( ecpDXCCMult, "DXCCMult", false, "1 = DXCC Mult" ) );
         entries.push_back( ProfileEntry( ecpLocMult, "LocMult", false, "1 = LOC Mult" ) );
         entries.push_back( ProfileEntry( ecpQTHReq, "QTHReq", false, "1 = QTH Required" ) );
         entries.push_back( ProfileEntry( ecpAllowLoc4, "allowLoc4", false, "1 = Short (4 char) locators allowed" ) );
         entries.push_back( ProfileEntry( ecpAllowLoc8, "allowLoc8", false, "1 = Long (8 char) locators allowed" ) );

         break;
      case epQTHPROFILE:
         entries.push_back( ProfileEntry( eqpLocator, "Locator", "", "Locator" ) );
         entries.push_back( ProfileEntry( eqpDistrict, "District", "", "District Exchange" ) );
         entries.push_back( ProfileEntry( eqpLocation, "Location", "", "Descriptive Location Exchange" ) );
         entries.push_back( ProfileEntry( eqpStationQTH1, "StationQTH1", "", "Address line 1/2 of station" ) );
         entries.push_back( ProfileEntry( eqpStationQTH2, "StationQTH2", "", "Address line 2/2 of station" ) );
         entries.push_back( ProfileEntry( eqpASL, "ASL", 0, "QTH height ASL (metres)" ) );
         break;
      case epSTATIONPROFILE:
         entries.push_back( ProfileEntry( espPower, "Power", 0, "Transmit Power (Watts)" ) );
         entries.push_back( ProfileEntry( espTransmitter, "Transmitter", "", "Transmit Equipment" ) );
         entries.push_back( ProfileEntry( espReceiver, "Receiver", "", "Receive Equipment" ) );
         entries.push_back( ProfileEntry( espAntenna, "Antenna", "", "Antenna details" ) );
         entries.push_back( ProfileEntry( espAGL, "AGL", 0, "Antenna Height AGL (metres)" ) );
         break;
   }
}