当前位置: 首页>>代码示例>>C++>>正文


C++ FilePtr::Write方法代码示例

本文整理汇总了C++中FilePtr::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePtr::Write方法的具体用法?C++ FilePtr::Write怎么用?C++ FilePtr::Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FilePtr的用法示例。


在下文中一共展示了FilePtr::Write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OutputInfo

	void Profiling::OutputInfo(FilePtr _pFile)
	{
		const float fTotal = s_fStopTime - s_fStartTime;
		if (0.0f < fTotal)
		{
			const int sSize = _snprintf_s(s_szBuffer, s_uBufferSize, s_uBufferSize, "calls\n");
			_pFile->Write(s_szBuffer, sSize);
			TagInfoMap::iterator iPair = s_mTags.begin();
			TagInfoMap::iterator iEnd = s_mTags.end();
			while (iEnd != iPair)
			{
				TagInfoRef rTagInfo = iPair->second;
				const float fAverage = (0 < rTagInfo.m_uCount) ? rTagInfo.m_fTotal / float(rTagInfo.m_uCount) : 0.0f;
				const int sSize = _snprintf_s(s_szBuffer, s_uBufferSize, s_uBufferSize,
					"%s : %u calls total=%f(%5.2f%%) min=%f max=%f avg=%f\n",
					rTagInfo.m_strName.c_str(),
					rTagInfo.m_uCount,
					rTagInfo.m_fTotal,
					(rTagInfo.m_fTotal / fTotal) * 100.0f,
					rTagInfo.m_fShortest,
					rTagInfo.m_fLongest,
					fAverage);

				_pFile->Write(s_szBuffer, sSize);

				++iPair;
			}

			{
				const int sSize = _snprintf_s(s_szBuffer, s_uBufferSize, s_uBufferSize, "callstack\n");
				_pFile->Write(s_szBuffer, sSize);
				OutputInfoCallStack(s_mCallStacks, 0, _pFile);
			}
		}
	}
开发者ID:mentaldease,项目名称:bastionlandscape,代码行数:35,代码来源:Profiling.cpp

示例2: OutputInfoCallStack

	void Profiling::OutputInfoCallStack(CallInfoMapRef _rmCallStack, UInt _uDepth, FilePtr _pFile)
	{
		const float fTotal = s_fStopTime - s_fStartTime;
		if (0.0f < fTotal)
		{
			CallInfoMap::iterator iPair = _rmCallStack.begin();
			CallInfoMap::iterator iEnd = _rmCallStack.end();
			while (iEnd != iPair)
			{
				CallInfoRef rCallInfo = iPair->second;
				TagInfoRef rTagInfo = s_mTags[iPair->first];
				const float fAverage = (0 < rCallInfo.m_uCount) ? rCallInfo.m_fTotal / float(rCallInfo.m_uCount) : 0.0f;

				for (UInt i = 0 ; (_uDepth > i) && (s_uBufferSize > i) ; ++i)
				{
					s_szBuffer[i] = '\t';
				}

				const int sSize = _snprintf_s(s_szBuffer + _uDepth, s_uBufferSize - _uDepth, s_uBufferSize - _uDepth,
					"%s : %u calls total=%f(%5.2f%%) min=%f max=%f avg=%f\n",
					rTagInfo.m_strName.c_str(),
					rCallInfo.m_uCount,
					rCallInfo.m_fTotal,
					(rCallInfo.m_fTotal / fTotal) * 100.0f,
					rCallInfo.m_fShortest,
					rCallInfo.m_fLongest,
					fAverage);

				_pFile->Write(s_szBuffer, sSize + _uDepth);

				if (false == rCallInfo.m_mChildrenCalls.empty())
				{
					OutputInfoCallStack(rCallInfo.m_mChildrenCalls, _uDepth + 1, _pFile);
				}

				++iPair;
			}
		}
	}
开发者ID:mentaldease,项目名称:bastionlandscape,代码行数:39,代码来源:Profiling.cpp


注:本文中的FilePtr::Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。