D:/WorkDir/SugoiProjects/SugoiTracer/include/SugoiTracer/function.h

Go to the documentation of this file.
00001 /* LICENSE_BEGIN
00002 SutoiTracer library supply support profiling functions, class, or evet simple 
00003 piece of code. It is part of the SugoiEngine project.
00004 Copyright (C) 2006 Allusse Yannick (yannick dot allusse at laposte dot net)
00005 
00006 This program is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU General Public License
00008 as published by the Free Software Foundation; either version 2
00009 of the License, or (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019 LICENSE_END
00020 */
00021 #ifndef _SG_TRC_FUNCTION_H
00022 #define _SG_TRC_FUNCTION_H
00023 
00024 #include "SugoiTracer\config.h"
00025 
00026 #ifdef __cplusplus
00027         #include "SugoiTracer\timer.h"
00028         //#include "SugoiTracer\function.h"
00029         #include "SugoiTracer\class.h"
00030         #include "SugoiTracer\appli.h"
00031         #include <Time.h>
00032         #include <sys/timeb.h> 
00033         #include <SugoiTools\cl_base_obj.h>
00034         #include <SugoiTools\cl_xml_mngr.h>
00035 
00036 
00037 #if SG_TLS_MEMORY_MANAGER
00038         #include "SugoiTools\debug_new.h"
00039 #endif 
00040 
00041 namespace SG_TRC{
00042 /* \class CL_FUNCT_TRC
00043 *\brief This class is used to store all the records corresponding to one function and all its set of paremeters.
00044 *\todo Add an example
00045 */
00046 template <typename TracerType = SG_TRC_Default_Trc_Type> 
00047         class CL_FUNCT_TRC
00048                 :public CL_XML_OBJ,
00049                 public CL_BASE_OBJ<std::string>
00050 {
00051 public:
00052 //Type definitions =================================
00053 /*#if _SG_TLS_SMARTPTR
00054         typedef typename SGE::CSmartPtr<CL_FUNCT_TRC<TracerType> >                      TplSmartP;
00055         typedef typename SGE::CSmartPtr<CL_CLASS_TRACER<TracerType> >           TplClassP;
00056 #else
00057         typedef CL_FUNCT_TRC<TracerType> *                      TplSmartP;
00058         typedef CL_CLASS_TRACER<TracerType> *           TplClassP;
00059 #endif*/
00060         typedef CL_FUNCT_TRC<TracerType>                *TplFctHdle;
00061         typedef CL_CLASS_TRACER<TracerType>             *TplClassHdle;
00062         typedef CL_FUNCT_TRC<TracerType>                *TplFctObj;
00063         typedef CL_CLASS_TRACER<TracerType>             *TplClassObj;
00064 //==================================================
00065                 
00066 private:
00067         bool                    TracingEnable;                  
00068         bool                    Modified;                               
00069         TracerType              *TotalTime;
00070         TracerType              *MinTime;
00071         TracerType              *MaxTime;
00072         TplClassHdle    ParentClass;                    
00073         int                             MaxRecords;                             
00074         
00075 
00076 public:
00077         int TotalRecords;
00078         bool                    UseMinMaxTot;
00079         CL_XML_MNGR<CL_TRACER_RECORD<TracerType> , std::string>         *TracerRecorded;        
00080         std::vector<CL_TRACER<TracerType>*>             TracerToProccess;       
00081 
00082 /*
00083         void EnableMinMaxTot(bool _val)
00084         {
00085                 UseMinMaxTot = _val;
00086         }
00087 
00088         bool GetMinMaxTotUse()
00089         {
00090                 return UseMinMaxTot;
00091         }
00092 */
00093 public:
00095         CL_FUNCT_TRC(std::string _Name)
00096                 :CL_XML_OBJ("Function"),
00097                 CL_BASE_OBJ<std::string>(_Name),
00098                 ParentClass(NULL),
00099                 Modified(true), //so it will be processed the first time
00100                 TracingEnable(true),//enable tracing
00101                 MinTime(new TracerType()),
00102                 MaxTime(new TracerType()),
00103                 TotalTime(new TracerType()),
00104                 UseMinMaxTot(true),//??? see how to optimise this...???
00105                 TracerRecorded(new CL_XML_MNGR<CL_TRACER_RECORD<TracerType>, std::string>(NULL, "RecordList","Records", XML_TAG_VAL_ID)),
00106                 MaxRecords(-1)
00107         {
00108                 Clear();
00109         }
00110 
00112         ~CL_FUNCT_TRC()
00113         {
00114                 //?? why it does not work? 
00115                 delete(TracerRecorded);
00116                 delete MinTime;
00117                 delete MaxTime;
00118                 delete TotalTime;
00119         }                                                                       
00120         
00122         void Clear()
00123         {
00124                 MaxTime->Clear();
00125                 TotalTime->Clear();
00126                 TotalRecords =0;        
00127                 MinTime->SetToMax();
00128                 TracerRecorded->DeleteAllLocal();
00129 
00130                 //delete all the data from the vector...
00131                 TracerToProccess.clear();//cause we use a smart pointer, unreferences objects will be destroyed automatically
00132                 //---------------------------------------
00133         }
00134                                                                                 
00136         void SetParrentClass(TplClassHdle _ParentClass)   
00137                 {ParentClass =_ParentClass;}
00138 
00139         void SetMaxRecords(int _size)
00140                 {MaxRecords = _size;}
00141 
00143         void AddTracerToProccess(CL_TRACER<TracerType> *_NewTracer)
00144         {
00145                 SG_Assert(_NewTracer, "CL_FUNCT_TRC<TracerType>::AddTracerToProccess() : Empty Tracer.");
00146                 TracerToProccess.push_back(_NewTracer);
00147                 Modified = true;
00148         }
00149 
00151         //return number of tracer processed     
00152         int Process()
00153         {
00154                 int i=0;
00155                 std::vector <CL_TRACER<TracerType>* >::iterator iTracer = TracerToProccess.begin();
00156 /*              
00157                 SG_NOTICE_LOG("\nProcessing function");
00158                 SG_NOTICE_LOG(this->GetID());
00159                 SG_NOTICE_LOG("====================================\n");
00160                 SG_NOTICE_LOG("=> Records to process : ");
00161                 int Size = TracerToProccess.size();
00162                 SG_NOTICE_LOG(IntToString(Size));
00163 */              
00164                 while(iTracer != TracerToProccess.end())
00165                         //; iTracer != TracerToProccess.end( ) ; iTracer++ )
00166                 {
00167                         if (!(*iTracer)->GetReady())
00168                                 break;//the function is still benchmarking...
00169 
00170                         AddTracerProccessed(*iTracer); 
00171                         //SG_NOTICE_LOG("\n");
00172                         //SG_NOTICE_LOG(IntToString(i));
00173                         //delete(*iTracer);
00174                         TracerToProccess.erase(iTracer);
00175                         i++;
00176                         iTracer = TracerToProccess.begin();
00177                 }
00178                 TracerToProccess.clear();
00179                 
00180                 return i;
00181         }
00182         //int GetAllRecordNumbers();                    //!< Not used qnymore...remove it ????????????
00183 
00184         const TracerType & GetMin(){return *MinTime;}
00185         const TracerType & GetMax(){return *MaxTime;}
00186         const TracerType & GetTotal(){return *TotalTime;}
00187         bool IsModified() {return Modified;}
00188         
00189 private:                
00191         CL_TRACER_RECORD<TracerType> *
00192                 AddTracerProccessed(CL_TRACER<TracerType>* _NewTracer)
00193                 {
00194                         SG_Assert(_NewTracer, "CL_FUNCT_TRC<TracerType>::AddTracerProccessed() : Empty Tracer.");
00195 
00196                         //create a unique srting with _tracer parameters
00197                         std::string ParamUniqName;
00198                         if (_NewTracer->GetParams())
00199                                 ParamUniqName = _NewTracer->GetParams()->Params;
00200                         else
00201                                 ParamUniqName = "empty";
00202                         
00203                         //look into the TracerRecorded List to find the correct function with the right parameters
00204                         //SGE::CSmartPtr<CL_TRACER_RECORD<TracerType> > CurTracer = TracerRecorded->Get(ParamUniqName);
00205                         CL_XML_MNGR<CL_TRACER_RECORD<TracerType> , std::string>::TplHdle CurTracer = TracerRecorded->Get(ParamUniqName);
00206                         
00207                         if (!CurTracer)
00208                         {//not valide, we create it...
00209                                 CurTracer = TracerRecorded->Add(ParamUniqName);
00210                                 CurTracer->SetParentFunction(this);
00211                                 CurTracer->SetParams(_NewTracer->GetParams());
00212                                 if (MaxRecords!=-1)
00213                                         CurTracer->SetMaxRecords(MaxRecords);
00214                         }
00215                 /*      else
00216                                 //here can can delete the params object, cause we have already one recorded
00217                                 delete(_NewTracer->Params);
00218                 */
00219                         CurTracer->AddTracer(_NewTracer);
00220                         return CurTracer;
00221                 }
00222         
00223 #if _SG_TLS_XML
00224 public:
00225         _SG_TLS_INLINE 
00226                 TiXmlElement* 
00227                 XMLLoad(TiXmlElement* _XML_ROOT)
00228                 {
00229                         SG_Assert(_XML_ROOT, "No XML root");
00230                         Process();
00231 
00232                         if (UseMinMaxTot)
00233                         {
00234                                 //TotalTime, min and maxtime
00235                                 TotalTime->XMLLoad(_XML_ROOT, "TotalTime");
00236                                 MinTime->XMLLoad(_XML_ROOT, "MinTime");
00237                                 MaxTime->XMLLoad(_XML_ROOT, "MaxTime");
00238                         }
00239                                 
00240                         XMLReadVal(_XML_ROOT, "TotalRecords", TotalRecords);
00241                         XMLReadVal(_XML_ROOT, "MaxRecords", MaxRecords);
00242 
00243                         //load all the records
00244                         TracerRecorded->XMLLoad(_XML_ROOT);
00245 
00246                         //affect the function
00247                         CL_XML_MNGR<CL_TRACER_RECORD<TracerType> , std::string>::iterator itRecord;
00248                         for(itRecord = TracerRecorded->GetFirstIter();  itRecord != TracerRecorded->GetLastIter(); itRecord++)
00249                         {
00250                                 (*itRecord).second->SetParentFunction(this);
00251                                 if (MaxRecords!=-1)
00252                                         (*itRecord).second->SetMaxRecords(MaxRecords);
00253 
00254                         }
00255 
00256                         return _XML_ROOT;
00257                 }
00258 
00259         _SG_TLS_INLINE 
00260                 TiXmlElement* 
00261                 XMLSave(TiXmlElement* _XML_ROOT)
00262                 {
00263                         SG_Assert(_XML_ROOT, "No XML root");
00264 
00265                         Process();
00266 
00267                         if (UseMinMaxTot)
00268                         {
00269                                 //TotalTime, min and maxtime
00270                                 TotalTime->XMLSave(_XML_ROOT, "TotalTime");
00271                                 MinTime->XMLSave(_XML_ROOT, "MinTime");
00272                                 MaxTime->XMLSave(_XML_ROOT, "MaxTime");
00273                         }
00274                         
00275                         XMLWriteVal(_XML_ROOT, "TotalRecords", TotalRecords);
00276                         if (MaxRecords!=-1)
00277                                 XMLWriteVal(_XML_ROOT, "MaxRecords", MaxRecords);
00278 
00279                         //..
00280                         _SG_DEBUG_XML(cout << "Function : " << GetIDStr() << " => record nbr : " << TracerRecorded->GetCount() << endl);
00281                         _SG_DEBUG_XML(cout << "Record to process : " << TracerToProccess.size() << endl);
00282 
00283                         TracerRecorded->XMLSave(_XML_ROOT);
00284 
00285 
00286                         //why this,,..>????
00287                         if (TracerRecorded->GetCount() == 1)
00288                         {
00289                                 if (TracerRecorded->GetFirstIter()->second->GetParams() == NULL)
00290                                         return _XML_ROOT;
00291                                 else if  (TracerRecorded->GetFirstIter()->second->GetParams()->Params == "EMPTY")
00292                                         return _XML_ROOT;
00293                         }
00294         
00295                         return _XML_ROOT;
00296                 }
00297 #endif
00298 
00299 #if _SG_TRC_SVG
00300         bool SaveToSVGFile()
00301         {
00302 
00303 #ifdef _CVG_SVG_CREATE_FILES
00304         if (CurFct)
00305         { 
00306                 string Svg;
00307                 string Filename;
00308                 char TempBuff[256];
00309                 CurFct->Sort();
00310                 vector <CL_FCT_SUB_ARGS*> Records;      
00311                 CL_FCT_SUB_ARGS * ActiveRec=NULL;
00312                 CL_TimerVal * CurTime =NULL;
00313                 CL_TimerVal Average;
00314                 long int maxvalue;
00315                 int NParamsEqual=1;
00316                 int NbParamsFirst=true;
00317                 int pst[12];
00318                 struct Pts {
00319                            unsigned int ImgSize[2];
00320                            unsigned long int time;
00321                 }ChartPts[128];
00322                 string ActiveParams="";
00323                 string Params="";
00324 
00325  
00326                 for (unsigned int i=0; i<CurFct->Records.size(); i+=NParamsEqual)
00327                 {
00328                 //if (ActiveParams!=CurFct->Records[i]->Params)ActiveParams = CurFct->Records[i]->Params;
00329                 
00330                             
00331                         if (NParamsEqual==1)
00332                         {
00333                                 ActiveRec = CurFct->Records[i];
00334                                 for (unsigned int j=i+1; j<CurFct->Records.size(); j++)
00335                                         if (ActiveRec->Params == CurFct->Records[j]->Params)
00336                                            NParamsEqual++;
00337                                 NbParamsFirst=true;
00338                         }
00339                         
00340                         for (unsigned int t=i; t<i+NParamsEqual; t++)
00341                         {  
00342                                 ActiveRec = CurFct->Records[t];
00343                                 //printf("\n%s - %s - %s %d",CurFct->FCT_NAME.data(),  ActiveRec->Params.data(), ActiveRec->Type.data(), ActiveRec->SizeIn[0]);
00344                                 Average = ActiveRec->TotalTime;
00345                                 Average/= ActiveRec->NbrOfTime;
00346                                 ChartPts[t-i].time = Average.GetValue();
00347                         }
00348          
00349         
00350                         Filename = _CVG_SVG_EXPORT_PATH;
00351                         Filename += "\\"+CurFct->FCT_NAME+"_"+ActiveRec->Params+".svg";
00352                         
00353                         OpenFile((char *)Filename.data());
00354                         if (!File) return -1;
00355                         //this->Sort();
00356                         
00357                         Svg = "<svg width='550' height='425'>\n";
00358                         
00359                         Svg+="<line x1='49' x2='480' y1='350' y2='350'  style='stroke-width:3 ; fill:none; stroke:black'/>\n";
00360                         Svg+="<line x1='470' x2='480' y1='347' y2='350'  style='stroke-width:3 ; fill:none; stroke:black'/>\n";
00361                         Svg+="<line x1='470' x2='480' y1='353' y2='350'  style='stroke-width:3 ; fill:none; stroke:black'/>\n";
00362                         fwrite( Svg.data(), strlen(Svg.data())*sizeof(unsigned char),1,File);
00363                         
00364                         for(unsigned int j=0,ps=400;j<6;j++)
00365                         {
00366                                 sprintf(TempBuff, "<line x1='%d' x2='%d' y1='347' y2='350'  style='stroke-width:2 ; fill:none; stroke:black'/>\n",50+ps,50+ps); 
00367                                 fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00368                                 ps/=4;
00369                         }
00370                         
00371                         Svg="<line x1='50' x2='47' y1='25' y2='35'  style='stroke-width:3 ; fill:none; stroke:black'/>\n";
00372                         Svg+="<line x1='50' x2='53' y1='25' y2='35'  style='stroke-width:3 ; fill:none; stroke:black'/>\n";
00373                         Svg+="<line x1='50' x2='50' y1='351' y2='25'  style='stroke-width:3 ; fill:none; stroke:black'/>\n";
00374                         fwrite( Svg.data(), strlen(Svg.data())*sizeof(unsigned char),1,File);
00375    
00376                         for(unsigned int j=0;j<5;j++)
00377                         {
00378                                 sprintf(TempBuff, "<line x1='50' x2='53' y1='%d' y2='%d'  style='stroke-width:2 ; fill:none; stroke:black'/>\n",50+60*j,50+60*j); 
00379                                 fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00380                         }
00381 
00382                         Svg="<g style='font-size:16;fill:black'>\n";
00383                         Svg+="<text x='20'  y='25'>Time(ms)</text>\n"; 
00384                         Svg+="<text x='460' y='365'>Size(pixels)</text>\n"; 
00385                         Svg+="</g>\n";
00386                         fwrite( Svg.data(), strlen(Svg.data())*sizeof(unsigned char),1,File);
00387                         
00388                         Svg="<g style='font-size:13'>\n";
00389                         Svg+="<text x='20' y='355'>0</text>\n";
00390                         Svg+="<g transform='rotate(90)'>\n";
00391                         fwrite( Svg.data(), strlen(Svg.data())*sizeof(unsigned char),1,File); 
00392    
00393                         for(unsigned int j=0,pp=2048,ps=400;j<4;j++)
00394                         {
00395                                 sprintf(TempBuff, "<text x='355' y='%d'>%d*%d</text>\n",(-1)*(ps+46),pp,pp); 
00396                                 fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00397                                 pp/=2;
00398                                 ps/=4;
00399                         }
00400                         Svg="</g>\n";
00401                         Svg+="</g>\n";
00402                         fwrite( Svg.data(), strlen(Svg.data())*sizeof(unsigned char),1,File);
00403                         
00404                         maxvalue=0;
00405                         for (unsigned int j=0;j<NParamsEqual;j++)
00406                                 if (ChartPts[j].time>maxvalue) 
00407                                    maxvalue=ChartPts[j].time;
00408                         
00409                         
00410                         if (maxvalue<=2500) maxvalue=2500;
00411                         else if (maxvalue<=5000) maxvalue=5000;
00412                         else if (maxvalue<=10000) maxvalue=10000;
00413                         else if (maxvalue<=20000) maxvalue=20000;
00414                         else if (maxvalue<=30000) maxvalue=30000;
00415                         else if (maxvalue<=40000) maxvalue=40000;
00416                         else if (maxvalue<=50000) maxvalue=50000;
00417                         else if (maxvalue<=60000) maxvalue=60000;
00418                         else if (maxvalue<=70000) maxvalue=70000;
00419                         else if (maxvalue<=80000) maxvalue=80000;
00420                         else if (maxvalue<=90000) maxvalue=90000;
00421                         else if (maxvalue<=100000) maxvalue=100000;
00422                         else if (maxvalue<=110000) maxvalue=110000;
00423                         else if (maxvalue<=120000) maxvalue=120000;
00424                         else if (maxvalue<=130000) maxvalue=130000;
00425                         else if (maxvalue<=140000) maxvalue=140000;
00426                         else if (maxvalue<=150000) maxvalue=150000;
00427                         else if (maxvalue<=160000) maxvalue=160000;
00428                         else if (maxvalue<=170000) maxvalue=170000;
00429                         else if (maxvalue<=180000) maxvalue=180000;
00430                         else if (maxvalue<=190000) maxvalue=190000;
00431                         else if (maxvalue<=200000) maxvalue=200000;
00432                         
00433                         for (unsigned int j=0;j<NParamsEqual;j++)        
00434                                 pst[j]=350-300*ChartPts[j].time/maxvalue;       
00435                         
00436                         sprintf(TempBuff, "<text x='225'  y='25' style='font-family:Verdana; font-size:20; fill:black'>%s</text>\n",CurFct->FCT_NAME.data());
00437                         fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00438                         sprintf(TempBuff, "<text x='225'  y='45' style='font-family:Verdana; font-size:13; fill:black'>%s</text>\n",ActiveRec->Params.data());
00439                         fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00440                         
00441                         Svg="<g style='stroke:black; fill:black' >\n";
00442                         fwrite( Svg.data(), strlen(Svg.data())*sizeof(unsigned char),1,File);
00443                         
00444                         for (unsigned int j=0,ps=400;j<6;j++)
00445                         { 
00446                                 sprintf(TempBuff, "<circle cx='%d'  cy='%d' r='3'  />\n",ps+50,pst[2*j]);
00447                                 fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00448                                 sprintf(TempBuff, "<circle cx='%d'  cy='%d' r='3'  />\n",ps+50,pst[2*j+1]);
00449                                 fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00450                                 ps/=4;
00451                         }
00452                         Svg="</g>\n";
00453                         fwrite( Svg.data(), strlen(Svg.data())*sizeof(unsigned char),1,File);
00454 
00455                         Svg="<g style='font-size:10; fill:black' >\n";
00456                         fwrite( Svg.data(), strlen(Svg.data())*sizeof(unsigned char),1,File);
00457                         for (unsigned int j=0,ps=400;j<3;j++)
00458                         { 
00459                                 sprintf(TempBuff, "<text x='%d'  y='%d'>(%dus)</text>\n",ps+55,pst[2*j]+10,ChartPts[2*j].time);
00460                                 fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00461                                 sprintf(TempBuff, "<text x='%d'  y='%d'>(%dus)</text>\n",ps+55,pst[2*j+1]+10,ChartPts[2*j+1].time);
00462                                 fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00463                                 ps/=4;
00464                         }  
00465                         Svg="</g>\n";
00466                         fwrite( Svg.data(), strlen(Svg.data())*sizeof(unsigned char),1,File);  
00467   
00468                         sprintf(TempBuff, "<polyline points='51,%d,52,%d,56,%d,75,%d,150,%d,450,%d' style='stroke-width:3 ; fill:none; stroke:orange'/>\n",pst[10],pst[8],pst[6],pst[4],pst[2],pst[0]);
00469                         fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00470                         sprintf(TempBuff, "<polyline points='51,%d,52,%d,56,%d,75,%d,150,%d,450,%d' style='stroke-width:3 ; fill:none; stroke:blue'/>\n",pst[11],pst[9],pst[7],pst[5],pst[3],pst[1]);
00471                         fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00472                         
00473                         sprintf(TempBuff, "<text x='460'  y='%d' style='font-family:Verdana; font-size:15; fill:orange'>OpenCV</text>\n",pst[0]); 
00474                         fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00475                         sprintf(TempBuff, "<text x='460'  y='%d' style='font-family:Verdana; font-size:15; fill:blue'>GPUCV</text>\n",pst[1]); 
00476                         fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00477     
00478                         Svg="<g style='font-size:13'>\n"; 
00479                         fwrite( Svg.data(), strlen(Svg.data())*sizeof(unsigned char),1,File); 
00480                         if (maxvalue>3000)  
00481                         {
00482                                 for (unsigned int j=1,yy=295; j<6;j++)
00483                                 {
00484                                         sprintf(TempBuff, "<text x='20' y='%d'>%d</text>\n",yy,j*maxvalue/5000); 
00485                                         fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00486                                         yy-=60;
00487                                 }
00488                         }
00489                         else 
00490                         {
00491                                 for (unsigned int j=1,yy=295; j<6;j++)
00492                                 {
00493                                         float m=maxvalue;
00494                                         sprintf(TempBuff, "<text x='20' y='%d'>%.1f</text>\n",yy,j*m/5000); 
00495                                         fwrite( TempBuff, strlen(TempBuff)*sizeof(unsigned char),1,File);
00496                                         yy-=60;
00497                                 }
00498                         } 
00499   
00500                         Svg="</g>\n";    
00501                         Svg+="<!-- Your SVG elements -->\n";
00502                         Svg+="</svg>\n";
00503                         fwrite( Svg.data(), strlen(Svg.data())*sizeof(unsigned char),1,File);
00504                         
00505                         CloseFile();
00506                 }//end for
00507         }//end  if (CurFct)
00508 return 1;
00509 #else
00510         printf("\n_CVG_SVG_CREATE_FILES flag is not defined in definitions.h, SVG files not created...");
00511         return 0;
00512 #endif
00513 
00514 }//end  this function
00515 #endif//_SG_TRC_SVG
00516 };
00517 //================================================================
00518 
00519 };//namespace SG_TRC
00520 #endif //__cplusplus
00521 
00522 #if SG_TLS_MEMORY_MANAGER
00523         #include "SugoiTools\debug_new_off.h"
00524 #endif 
00525 
00526 #endif//_SG_TRC_FUNCTION_H

Generated on Mon Mar 19 23:16:20 2007 for SugoiTracer by  doxygen 1.4.6-NO