00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkThreadSafeLog.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00036 #ifndef __vtkThreadSafeLog_h 00037 #define __vtkThreadSafeLog_h 00038 00039 #include "vtkObject.h" 00040 00041 #define VTK_THREAD_SAFE_LOG_MAX 1000 00042 00043 class VTK_PARALLEL_EXPORT vtkThreadSafeLog : public vtkObject 00044 { 00045 public: 00046 static vtkThreadSafeLog *New(); 00047 vtkTypeRevisionMacro(vtkThreadSafeLog, vtkObject); 00048 virtual void PrintSelf(ostream& os, vtkIndent indent); 00049 00051 00052 void StartTimer() { this->Timer->StartTimer();} 00053 void StopTimer() { this->Timer->StopTimer();} 00054 double GetElapsedTime() { return this->Timer->GetElapsedTime();} 00056 00058 void AddEntry(char *tag, float value); 00059 00063 void DumpLog(char *filename, int mode = ios::out); 00064 00065 protected: 00066 00067 vtkThreadSafeLog(); //insure constructur/destructor protected 00068 ~vtkThreadSafeLog(); 00069 00070 00071 char *Tags[VTK_THREAD_SAFE_LOG_MAX]; 00072 float Values[VTK_THREAD_SAFE_LOG_MAX]; 00073 int NumberOfEntries; 00074 00075 vtkTimerLog *Timer; 00076 private: 00077 vtkThreadSafeLog(const vtkThreadSafeLog&); // Not implemented. 00078 void operator=(const vtkThreadSafeLog&); // Not implemented. 00079 }; 00080 00081 00082 00083 #endif