コード例 #1
0
		size_t size() const
		{
			size_t size = 0;
			m_cs.Enter();
			size = m_queue.size();
			m_cs.Exit();

			return size;
		}
コード例 #2
0
		bool dequeue( _Tx *out )
		{
			bool success = false;
			m_cs.Enter();
			if (m_queue.size() > 0) {
				*out = m_queue.front();
				m_queue.pop();
				success = true;
			}
			m_cs.Exit();
			return success;
		}
コード例 #3
0
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();
}
コード例 #4
0
//printing the report
std::string ProfileMapToString(){
	//PROFILE_SECTION();
	profileCritSec.Enter();
	//IntVec2 startReportPos = IntVec2(50, 800);

	std::string outputProfileMap ="\n//===========================================================================================================\n";
	
	ProfileReports profileReportsInMap;
	if (CreateProfileReportsFromProfileMap(profileReportsInMap, true)) {
		for (ProfileReport& report : profileReportsInMap) {
			outputProfileMap += report.ProfileReportToString();
		}
	}

	//clear profile map
	s_profileMap.clear();

	outputProfileMap += "\n//===========================================================================================================\n";
	
	profileCritSec.Exit();

	return outputProfileMap;
}
コード例 #5
0
		void enqueue( _Tx &item ) 
		{
			m_cs.Enter();
			m_queue.push( item );
			m_cs.Exit();
		}
コード例 #6
0
	~CriticalSectionScope(){
		critSec->Exit();
	}