00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Andrew Clinton 00008 * Side Effects Software Inc 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: UT_TimerTable.h ( UT Library, C++) 00015 * 00016 * COMMENTS: Class to keep track of cumulative time spent in different 00017 * algorithms. 00018 */ 00019 00020 #ifndef __UT_TimerTable__ 00021 #define __UT_TimerTable__ 00022 00023 #include "UT_API.h" 00024 00025 class UT_WorkBuffer; 00026 00027 // Add new algorithms here. There must be a matching entry in theUsers in 00028 // the UT_TimerTable.C 00029 enum UT_TimerTableUser { 00030 UT_TIMER_DEBUG = 0, 00031 00032 UT_TIMER_VRAY_SAMPLING, 00033 UT_TIMER_VRAY_RAYTRACING, 00034 UT_TIMER_VMAT_OCCLUSION, 00035 UT_TIMER_VRAY_DUMPSAMPLES, 00036 UT_TIMER_VRAY_SPUSAMPLING, 00037 00038 UT_MAX_TIMER_USERS // Sentinal 00039 }; 00040 00041 class UT_API UT_TimerTable { 00042 public: 00043 // Start a timer. Nested timers are ignored. 00044 static void start(UT_TimerTableUser user); 00045 static void stop(UT_TimerTableUser user); 00046 00047 static void printUsage(UT_WorkBuffer &buf, int indent=3); 00048 }; 00049 00050 // Automatically starts and stops a timer within the scope of a 00051 // UT_AutoTimerTable object. 00052 class UT_API UT_AutoTimerTable { 00053 public: 00054 UT_AutoTimerTable(UT_TimerTableUser user) 00055 : myUser(user) 00056 { 00057 UT_TimerTable::start(myUser); 00058 } 00059 ~UT_AutoTimerTable() 00060 { 00061 UT_TimerTable::stop(myUser); 00062 } 00063 00064 private: 00065 UT_TimerTableUser myUser; 00066 }; 00067 00068 #endif
1.5.9