* Add existing files.
[matthijs/ABM2.git] / ABM2 / Engine / ProfileLogHandler.cpp
1 // ProfileLogHandler.cpp: implementation of the CProfileLogHandler class.\r
2 //\r
3 //////////////////////////////////////////////////////////////////////\r
4 \r
5 #include "engine.h"\r
6 #include "ProfileLogHandler.h"\r
7 \r
8 //////////////////////////////////////////////////////////////////////\r
9 // Construction/Destruction\r
10 //////////////////////////////////////////////////////////////////////\r
11 \r
12 void CProfileLogHandler::BeginOutput(float tTime)\r
13 {\r
14         CLog::Get().Write(LOG_APP,IDS_PROFILE_HEADER1,tTime, 60.0f/tTime);\r
15         CLog::Get().Write(LOG_APP,IDS_PROFILE_HEADER2);\r
16 }\r
17 \r
18 void CProfileLogHandler::Sample(float fMin, float fAvg, float fMax, float tAvg, int callCount, std::string name, int parentCount)\r
19 {\r
20         //char szBuf[100];\r
21         //for(int i=0;i<parentCount;i++){szBuf[i]=' ';}\r
22         //szBuf[parentCount]=0;\r
23         char namebuf[256], indentedName[256];\r
24         char avg[16], min[16], max[16], num[16], time[16];\r
25 \r
26         sprintf_s(avg,16, "%3.1f", fAvg);\r
27         sprintf_s(min,16, "%3.1f", fMin);\r
28         sprintf_s(max,16, "%3.1f", fMax);\r
29         sprintf_s(time,16,"%3.1f", tAvg);\r
30         sprintf_s(num,16, "%3d",   callCount);\r
31 \r
32         strcpy_s( indentedName,256, name.c_str());\r
33         for( int indent=0; indent<parentCount; ++indent )\r
34         {\r
35                 sprintf_s(namebuf,256, " %s", indentedName);\r
36                 strcpy_s( indentedName,256, namebuf);\r
37         }\r
38 \r
39         CLog::Get().Write(LOG_APP,IDS_PROFILE_SAMPLE,min,avg,max,time,num,indentedName);\r
40 }\r
41 \r
42 void CProfileLogHandler::EndOutput()\r
43 {\r
44         CLog::Get().Write(LOG_APP,"\n");\r
45 }