00001 00002 // 00003 // YASA timing parser 00004 // 00005 // Project: Yasa 2 00006 // Author : Jan Blumenthal 00007 // Start : 2002/02/28 00008 // $Header: /sources/yasa/yasagui/timingparser.h,v 1.4 2003/01/24 15:47:43 bj Exp $ 00009 // 00011 // 00012 // This program is free software; you can redistribute it and/or modify 00013 // it under the terms of the GNU General Public License as published by 00014 // the Free Software Foundation; either version 2 of the License, or 00015 // (at your option) any later version. 00016 // 00017 // This program is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU General Public License for more details. 00021 // 00022 // You should have received a copy of the GNU General Public License 00023 // along with this program (See the included file COPYING); 00024 // if not, write to the Free Software Foundation, Inc., 00025 // 675 Mass Ave, Cambridge, MA 02139, USA. 00026 // 00028 // This file contains all information about timing parser which are used to parse the logfile list 00029 // to extract the needed information 00031 #ifndef YASAGUI_TIMING_PARSER_INCLUDE 00032 #define YASAGUI_TIMING_PARSER_INCLUDE 00033 00034 00036 #include "timingsettings.h" 00037 #include "timingpainter.h" 00038 #include "logfile.h" 00039 00041 class YTimings; 00042 class YTimingHandler; 00043 00044 00045 00047 class YTimingParser : public YLoggingParser 00048 { YPainter *painter; 00049 YTimings *timings; 00050 public: YTimingParser() : 00051 painter(0), 00052 timings(0) 00053 {} 00054 void SetPainter(YPainter *p) { painter=p; } 00055 YPainter* GetPainter() const { return painter; } 00056 void SetTimings(YTimings *t) { timings=t; } 00059 void EvaluateLoggingEntry(YLogAction *action); 00061 virtual bool TimingFilter(const YLogAction *) const; // { return true; } 00064 // virtual bool PrintDurationAllowed(const YLogAction *) const { return false; } 00067 virtual void PrepareLogfilePainting(); 00069 virtual int GetTimingRow(YLogAction *action) const; 00071 }; 00072 00073 00074 00075 00076 00077 00080 class YTaskTimingParser : public YTimingParser 00081 {public: 00082 // virtual bool PrintDurationAllowed(const YLogAction *) const { return false; } 00083 virtual void PrepareLogfilePainting(); 00084 }; 00086 class YTaskProjectTimingParser : public YTaskTimingParser 00087 {}; 00089 class YTaskEnvironmentTimingParser : public YTaskTimingParser 00090 {public: virtual int GetTimingRow(YLogAction *action) const { return action->GetThread()->GetNumber(); } 00091 }; 00092 00093 00094 00095 00096 00097 00100 class YMutexTimingParser : public YTimingParser 00101 {public: 00102 virtual bool TimingFilter(const YLogAction *action) const { if (action->GetAction() >=YASAL_MUTEX_CREATED && 00103 action->GetAction() <=YASAL_MUTEX_PRIORITY_CHANGED ) 00104 return YTimingParser::TimingFilter(action); 00105 return false; } 00106 // virtual bool PrintDurationAllowed(const YLogAction *) const { return false; } 00107 virtual void PrepareLogfilePainting(); 00108 }; 00110 class YMutexProjectTimingParser : public YMutexTimingParser 00111 {}; 00113 class YMutexEnvironmentTimingParser : public YMutexTimingParser 00114 {public:virtual int GetTimingRow(YLogAction *action) const { if ( action->GetMutex() ) 00115 return action->GetMutex()->GetNumber(); 00116 return 0; } 00117 }; 00118 00119 00120 00121 00122 00123 00124 00127 class YCPUTimingParser : public YTimingParser 00128 {public:virtual bool TimingFilter(const YLogAction *action) const { if ( action->GetAction() == YASAL_THREAD_EXCLUDED || 00129 action->GetAction() == YASAL_THREAD_EXIT ) 00130 return false; 00131 return YTimingParser::TimingFilter(action); } 00132 // virtual bool PrintDurationAllowed(const YLogAction *) { return false; } 00133 virtual void PrepareLogfilePainting(); 00134 }; 00136 class YCPUProjectTimingParser : public YCPUTimingParser 00137 {}; 00139 class YCPUEnvironmentTimingParser : public YCPUTimingParser 00140 {public:virtual int GetTimingRow(YLogAction *) const { return GetCPULogFile()->GetCPU(); } 00141 }; 00142 00143 00145 #endif // ifndef YASAGUI_TIMING_PARSER_INCLUDE