00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkThreadSafeLog.h,v $ 00005 Language: C++ 00006 00007 00008 Copyright (c) 1993-1998 Ken Martin, Will Schroeder, Bill Lorensen. 00009 00010 This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen. 00011 The following terms apply to all files associated with the software unless 00012 explicitly disclaimed in individual files. This copyright specifically does 00013 not apply to the related textbook "The Visualization Toolkit" ISBN 00014 013199837-4 published by Prentice Hall which is covered by its own copyright. 00015 00016 The authors hereby grant permission to use, copy, and distribute this 00017 software and its documentation for any purpose, provided that existing 00018 copyright notices are retained in all copies and that this notice is included 00019 verbatim in any distributions. Additionally, the authors grant permission to 00020 modify this software and its documentation for any purpose, provided that 00021 such modifications are not distributed without the explicit consent of the 00022 authors and that existing copyright notices are retained in all copies. Some 00023 of the algorithms implemented by this software are patented, observe all 00024 applicable patent law. 00025 00026 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR 00027 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT 00028 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, 00029 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 00031 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, 00032 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 00033 PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN 00034 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE 00035 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 00036 00037 00038 =========================================================================*/ 00048 #ifndef __vtkThreadSafeLog_h 00049 #define __vtkThreadSafeLog_h 00050 00051 00052 #include "vtkObject.h" 00053 #include "vtkTimerLog.h" 00054 00055 00056 #define VTK_THREAD_SAFE_LOG_MAX 1000 00057 00058 class VTK_EXPORT vtkThreadSafeLog : public vtkObject 00059 { 00060 public: 00061 static vtkThreadSafeLog *New(); 00062 const char *GetClassName() {return "vtkThreadSafeLog";}; 00063 00065 void StartTimer() { this->Timer->StartTimer();} 00066 void StopTimer() { this->Timer->StopTimer();} 00067 double GetElapsedTime() { return this->Timer->GetElapsedTime();} 00068 00070 void AddEntry(char *tag, float value); 00071 00075 void DumpLog(char *filename, int mode = ios::out); 00076 00077 protected: 00078 00079 vtkThreadSafeLog(); //insure constructur/destructor protected 00080 ~vtkThreadSafeLog(); 00081 vtkThreadSafeLog(const vtkThreadSafeLog&) {}; 00082 void operator=(const vtkThreadSafeLog&) {}; 00083 00084 00085 char *Tags[VTK_THREAD_SAFE_LOG_MAX]; 00086 float Values[VTK_THREAD_SAFE_LOG_MAX]; 00087 int NumberOfEntries; 00088 00089 vtkTimerLog *Timer; 00090 }; 00091 00092 00093 00094 #endif