00001 /** 00002 * @file Tools/Debugging/Watchdog.cpp 00003 * 00004 * This file implements the view classes. 00005 * 00006 * @author <A href=mailto:schumann@germanteam.org>Michael Wachter / Carsten Schumann</A> 00007 */ 00008 #include "Watchdog.h" 00009 #include "Platform/GTAssert.h" 00010 #include "Tools/Debugging/Debugging.h" 00011 #include "Platform/SystemCall.h" 00012 00013 Watchdog::Watchdog(){ 00014 top=-1; 00015 operations++; 00016 } 00017 00018 void Watchdog::enter(int i){ 00019 top++; 00020 if (top < stackSize){ 00021 stack[top]=i; 00022 } 00023 operations++; 00024 } 00025 00026 void Watchdog::leave(int i){ 00027 if (top < stackSize){ 00028 if (stack[top]!=i){ 00029 #ifdef APERIOS1_3_2 00030 00031 PRINT ("Watchdog symbol mismatch. Expected"); 00032 PRINT (stack[top]); 00033 PRINT ("got"); 00034 PRINT (i); 00035 #endif 00036 } 00037 } 00038 top --; 00039 } 00040 00041 void Watchdog::dump(){ 00042 if (SystemCall::getCurrentSystemTime() - lastDump > 10000){ 00043 PRINT ("WatchdogDump Begin"); 00044 OUTPUT(idText,text,"WatchdogDump Begin"); 00045 OUTPUT(idText,text,operations); 00046 for (int i=0; i<=top && i<stackSize; i++){ 00047 #ifdef APERIOS1_3_2 00048 PRINT (stack[i]); 00049 #endif 00050 OUTPUT(idText,text,i<<": "<<stack[i]); 00051 } 00052 PRINT ("WatchdogDump End"); 00053 OUTPUT(idText,text,"WatchdogDump End"); 00054 lastDump=SystemCall::getCurrentSystemTime(); 00055 } 00056 } 00057 00058 Watchdog watchdog;
1.3.6