Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Examples  

logfilestatistics.h

Go to the documentation of this file.
00001 
00002 //
00003 // YASA logfile parser
00004 //
00005 // Project: Yasa 2
00006 // Author : Jan Blumenthal
00007 // Start  : 2002/02/28
00008 // $Header: /sources/yasa/yasagui/logfilestatistics.h,v 1.5 2003/01/24 15:47:41 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 #ifndef YASAGUI_LOGFILESTATISTICS_PARSER_INCLUDE
00029 #define YASAGUI_LOGFILESTATISTICS_PARSER_INCLUDE
00030 
00031 #include <qstring.h>
00032 #include <yasagui/yasagui.h>
00033 #include "datatypes.h"
00034 
00035 
00037 class YLogFileTask;
00038 class YLogFileMutex;
00039 class YProjectLogFile;
00040 class YCPULogFile;
00041 class YEnvironmentLogFileSet;
00042 
00043 
00045 class YStatisticBaseEntry
00046 {
00047 public: virtual     ~YStatisticBaseEntry()                  {                                               }
00049     virtual bool    IsValid() const =0;
00051     virtual void    Invalid() =0;
00053     virtual void    Reset() =0;
00055     virtual QString GetVisibleString() const =0;
00057     virtual QString GetKey() const =0;
00059     virtual void    IncContent()                            {                                               }
00061     static QString  GetUnknownString()                      {   return MSGP_NOT_APPLICABLE;                 }
00063     static QString  GetInvalidString()                      {   return MSGP_NOT_APPLICABLE;                 }
00064 };
00065 
00067 template<class T>
00068 class YStatisticEntry : public YStatisticBaseEntry
00069 {
00071     bool            initvalid;
00073     T               initcontent;
00075     bool            valid;
00077     T               content;
00078 protected:
00080     virtual QString _GetVisibleString() const =0;
00082     virtual QString _GetKey() const                         {   return GetVisibleString();                  }
00083 public:             YStatisticEntry() : initvalid(false), valid(false)                                      { }
00084                     YStatisticEntry(const T &t) : initvalid(true), initcontent(t), valid(true), content(t)  { }
00086     virtual bool    IsValid() const                         {   return valid;                               }
00088     virtual void    Invalid()                               {   valid=false;                                }
00090     virtual void    Reset()                                 {   content=initcontent;
00091                                                                 valid=initvalid;                            }
00093     const T &       SetContent(const T &t)                  {   content=t;
00094                                                                 valid=true;
00095                                                                 return content;                             }
00097     const T &       GetContent() const                      {   return content;                             }
00099     virtual QString GetVisibleString() const                {   if (valid)
00100                                                                     return _GetVisibleString();
00101                                                                 return GetInvalidString();                  }
00102     virtual QString GetKey() const                          {   if (valid)
00103                                                                     return _GetKey();
00104                                                                 //return QString::null;                     }
00105                                                                 return QString(LOWEST_STRING);              }
00106     virtual const T & operator = (const T &t)               {   return SetContent(t);                       }
00107     /*  virtual const T & operator ++(void)                         {   if ( IsValid() )
00108                                                                     SetContent( content+1 );
00109                                                                 return content;                             }
00110     virtual const T & operator ++(int i)                        {   if ( IsValid() )
00111                                                                     SetContent( content+i );
00112                                                                 return content;                             }
00113 */
00114 };
00115 
00117 class YYasaTimeStatisticEntry : public YStatisticEntry<YASA_TIME>
00118 {public:            YYasaTimeStatisticEntry() : YStatisticEntry<YASA_TIME>()                                { }
00119                     YYasaTimeStatisticEntry(const YASA_TIME &t) : YStatisticEntry<YASA_TIME>(t)             { }
00120 protected:
00123     virtual QString _GetVisibleString() const               {   return YTIME::GetVisibleContentString( GetContent() ); }
00124     virtual QString _GetKey() const;
00125 };
00126 
00129 class YZeroYasaTimeStatisticEntry : public YYasaTimeStatisticEntry
00130 {public:            YZeroYasaTimeStatisticEntry() : YYasaTimeStatisticEntry(0)                                  { }
00131 };
00134 class YInfinityYasaTimeStatisticEntry : public YYasaTimeStatisticEntry
00135 {public:            YInfinityYasaTimeStatisticEntry() : YYasaTimeStatisticEntry(YASA_TIME_INFINITY)         { }
00136 };
00137 
00138 
00140 class YBoolStatisticEntry : public YStatisticEntry<bool>
00141 {public:            YBoolStatisticEntry() : YStatisticEntry<bool>()                                         { }
00142                     YBoolStatisticEntry(const bool &b) : YStatisticEntry<bool>(b)                           { }
00143 protected:
00146     virtual QString _GetVisibleString() const               {   if ( GetContent() )
00147                                                                     return MSGP_ERROR_YES;
00148                                                                 else
00149                                                                 return MSGP_ERROR_NO;                       }
00150 };
00151 
00152 
00155 class YStringStatisticEntry : public YStatisticEntry<QString>
00156 {public:            YStringStatisticEntry(const QString &s=QString::null) : YStatisticEntry<QString>(s)     { }
00157 protected:
00160     virtual QString _GetVisibleString() const               {   return GetContent();                        }
00161 };
00162 
00163 
00166 class YIntStatisticEntry : public YStatisticEntry<int>
00167 {public:            YIntStatisticEntry(const int &i=0) : YStatisticEntry<int>(i)                            { }
00168 protected:
00171     virtual QString _GetVisibleString() const               {   return QString::number( GetContent() );     }
00173     virtual void    IncContent()                            {   if ( IsValid() )
00174                                                                     SetContent( GetContent()+1 );           }
00175     virtual QString _GetKey() const;
00176 };
00177 
00180 class YPriorityStatisticEntry : public YStatisticEntry<int>
00181 {public:            YPriorityStatisticEntry(const int &i=0) : YStatisticEntry<int>(i)                       { }
00182 protected:
00185     virtual QString _GetVisibleString() const               {   return QString::number( GetContent() );     }
00186     virtual QString _GetKey() const;
00187 };
00188 
00189 
00190 #define PERCENTTYPE double
00193 class YPercentStatisticEntry : public YStatisticEntry<PERCENTTYPE>
00194 {public:            YPercentStatisticEntry() : YStatisticEntry<PERCENTTYPE>()                               { }
00195                     YPercentStatisticEntry(const PERCENTTYPE &i) : YStatisticEntry<PERCENTTYPE>(i)          { }
00196 protected:
00199     virtual QString _GetVisibleString() const                               {   return QString("%1 %").arg( ((float)((int)(GetContent()*100)))/100 );   }
00200 public:
00201     void            CalcContent( YASA_TIME G, YASA_TIME W)                  {   if ( G )
00202                                                                                     SetContent( (PERCENTTYPE)( W*100) / G );    }
00203     void            CalcContent( int G, int W)                              {   if ( G )
00204                                                                                     SetContent( (PERCENTTYPE)( W*100) / G );    }
00205     void            CalcContent( double G, double W)                        {   if ( G )
00206                                                                                     SetContent( (PERCENTTYPE)( W*100) / G );    }
00207     virtual QString _GetKey() const;
00208 };
00209 
00210 
00213 class YVersionStatisticEntry : public YStatisticEntry<double>
00214 {public:            YVersionStatisticEntry() : YStatisticEntry<double>()                                    { }
00215                     YVersionStatisticEntry(const double &i) : YStatisticEntry<double>(i)                    { }
00216 protected:
00219     virtual QString _GetVisibleString() const               {   return QString::number( GetContent() );     }
00220     virtual QString _GetKey() const;
00221 };
00222 
00223 
00224 
00225 
00226 
00227 
00228 
00229 
00232 class YLogFileStatistics
00233 {protected:
00234     QArray<YStatisticBaseEntry*>properties;
00235     void                    CheckProperties()
00236                             {
00237                                 for ( int count=0; count<(int)properties.count(); count++ )
00238                                 {   if ( properties[count]==0 )
00239                                         qWarning("YLogFileStatistics::CheckProperties() failed!");
00240                                 }
00241                             }
00242 public:                     YLogFileStatistics(int number) : properties(number)                         { }
00243     virtual                 ~YLogFileStatistics()                                                       { }
00244     int                     GetMaxProperties() const
00245                             {
00246                                 return properties.count();
00247                             }
00248     virtual void            ResetStatistics()
00249                             {
00250                                 for ( int count=0; count<(int)properties.count(); count++ )
00251                                 {   if ( properties[count]!=0 )
00252                                         properties[count]->Reset();
00253                                 }
00254                             }
00255     virtual YStatisticBaseEntry& GetStatisticProperty(int number) const     {   return *properties[number]; }
00256     virtual QStringList     GetPropertyNames() const=0;
00257     void                    CalculateTimingValues(YEnvironmentLogFileSet &envlogfile, QList<YASA_TIME> &list, int firstproperty, int propertycount);
00258     bool                    IsValid(int number) const
00259                             {
00260                                 if ( number < (int)properties.count() )
00261                                     return properties[number]->IsValid();
00262                                 return false;
00263                             }
00264 };
00265 
00268 class YTaskLogFileStatistics : public YLogFileStatistics
00269 {   YLogFileTask *          task;
00270     QList<YASA_TIME>        computationtimes;
00271     QList<YASA_TIME>        jittertimes;
00272     QList<YASA_TIME>        reactiontimes;
00273 public: enum TASK_PROPERTIES {
00274                             ID=0,                       // Id of task
00275                             PERIOD,                     // period of thread
00276                             DEADLINE,                   // deadline of thread
00277                             ACTIVATIONS,                // number of activations in scheduling period
00278                             STARTS,                     // number of starting periods in scheduling period
00279                             THREADS_SUSPENDED,          // how many times the thread was suspended
00280                             PREEMPTIONS,                // number of preemptions
00281                             CPU_LOSSES,                 // number of cpu losses
00282                             EXCLUSIONS,                 // number of exclusion (ELLF)
00283                             MATCHED_DEADLINES,          // number of matched deadlines
00284                             MISSED_DEADLINES,           // number of missed deadlines
00285                             DETECTED_DEADLINE_MISSES,   // number of discovered deadline misses
00286                             DEADLINE_TOLERANCE_STARTS,  // number of tolerance deadline starts
00287                             DEADLINE_TOLERANCE_MISSES,  // number of tolerance deadline misses
00288                             //DETECTED_TOLERANCE_MISSES,// number of detected tolerance deadline misses
00289                             SYNCHRONIZATION_OFFSET,     // synchronization offset
00290     /* do not change the order --> */
00291                             MIN_COMPUTATION_TIME,       // min computation time
00292                             MAX_COMPUTATION_TIME,       // max computation time
00293                             AVERAGE_COMPUTATION_TIME,   // average computation time
00294                             COMPUTATION_TIME,           // computation time of this task in the scheduling interval
00295                             UTILIZATION,                // utilization in scheduling period
00296                             MIN_REACTION_TIME,          // min. time until thread finished since activation
00297                             MAX_REACTION_TIME,          // max. time until thread finished since activation
00298                             AVERAGE_REACTION_TIME,      // average time until thread finished since activation
00299                             MIN_JITTER,
00300                             MAX_JITTER,
00301                             AVERAGE_JITTER,
00302                             //JITTER_PERCENT,
00303     /* <-- do not change the order */
00304                             SKIPPED_THREADS,            // skipped threads
00305                             EMERGENCY_THREADS,          // how many times an emergency thread was started
00306                             LOCKED_MUTEXES,             // number of locked mutexes
00307                             UNLOCKED_MUTEXES,           // number of unlocked mutexes
00308                             RELOCKED_MUTEXES,           // locked a mutex twice or more ?
00309                             BLOCKED_MUTEXES,
00310                             MAX_PRIORITY_CEILING,       // max. priority ceiling
00311                             NUMBER_OF_PRIORITY_CHANGES,// number of priority changes (How many times did a task change its priority)
00312                             MAX_PROPERTIES
00313                         };
00314 
00315                         YTaskLogFileStatistics() : YLogFileStatistics(MAX_PROPERTIES), task(0)
00316                         {
00317                             computationtimes.setAutoDelete(true);
00318                             jittertimes.setAutoDelete(true);
00319                             reactiontimes.setAutoDelete(true);
00320                             properties[ID]                          = new YIntStatisticEntry;           // id of task
00321                             properties[PERIOD]                      = new YInfinityYasaTimeStatisticEntry;  // period of thread
00322                             properties[DEADLINE]                    = new YInfinityYasaTimeStatisticEntry;  // deadline of thread
00323                             properties[ACTIVATIONS]                 = new YIntStatisticEntry;           // number of activations in scheduling period
00324                             properties[STARTS]                      = new YIntStatisticEntry;           // number of starting periods in scheduling period
00325                             properties[THREADS_SUSPENDED]           = new YIntStatisticEntry;           // how many times the thread was suspended
00326                             properties[PREEMPTIONS]                 = new YIntStatisticEntry;           // number of preemptions
00327                             properties[EXCLUSIONS]                  = new YIntStatisticEntry;           // number of exclusion (ELLF)
00328                             properties[CPU_LOSSES]                  = new YIntStatisticEntry;           // number of exclusion (ELLF)
00329                             properties[MATCHED_DEADLINES]           = new YIntStatisticEntry;           // number of matched deadlines
00330                             properties[MISSED_DEADLINES]            = new YIntStatisticEntry;           // number of missed deadlines
00331                             properties[DETECTED_DEADLINE_MISSES]    = new YIntStatisticEntry;           // number of discovered deadline misses
00332                             properties[DEADLINE_TOLERANCE_STARTS]   = new YIntStatisticEntry;           // number of tolerance deadline starts
00333                             properties[DEADLINE_TOLERANCE_MISSES]   = new YIntStatisticEntry;           // number of tolerance deadline misses
00334                             //properties[DETECTED_TOLERANCE_MISSES] = new YIntStatisticEntry;           // number of detected tolerance deadline misses
00335                             properties[SYNCHRONIZATION_OFFSET]      = new YZeroYasaTimeStatisticEntry;  // synchronization offset
00336                             properties[MIN_COMPUTATION_TIME]        = new YZeroYasaTimeStatisticEntry;  // min computation time
00337                             properties[MAX_COMPUTATION_TIME]        = new YZeroYasaTimeStatisticEntry;  // max computation time
00338                             properties[AVERAGE_COMPUTATION_TIME]    = new YZeroYasaTimeStatisticEntry;  // average computation time
00339                             properties[COMPUTATION_TIME]            = new YZeroYasaTimeStatisticEntry;  // computation time of this task in the scheduling interval
00340                             properties[UTILIZATION]                 = new YPercentStatisticEntry;       // utilization in scheduling period
00341                             properties[MIN_REACTION_TIME]           = new YZeroYasaTimeStatisticEntry;  // min. time until thread finished since activation
00342                             properties[MAX_REACTION_TIME]           = new YZeroYasaTimeStatisticEntry;  // max. time until thread finished since activation
00343                             properties[AVERAGE_REACTION_TIME]       = new YZeroYasaTimeStatisticEntry;  // average time until thread finished since activation
00344                             properties[MIN_JITTER]                  = new YZeroYasaTimeStatisticEntry;
00345                             properties[MAX_JITTER]                  = new YZeroYasaTimeStatisticEntry;
00346                             properties[AVERAGE_JITTER]              = new YZeroYasaTimeStatisticEntry;
00347                             //properties[JITTER_PERCENT]                = new YPercentStatisticEntry;
00348                             properties[SKIPPED_THREADS]             = new YIntStatisticEntry;           // skipped threads
00349                             properties[EMERGENCY_THREADS]           = new YIntStatisticEntry;           // how many times an emergency thread was started
00350                             properties[LOCKED_MUTEXES]              = new YIntStatisticEntry;           // number of locked mutexes
00351                             properties[UNLOCKED_MUTEXES]            = new YIntStatisticEntry;           // number of unlocked mutexes
00352                             properties[RELOCKED_MUTEXES]            = new YIntStatisticEntry;           // locked a mutex twice or more ?
00353                             properties[BLOCKED_MUTEXES]             = new YIntStatisticEntry;
00354                             properties[MAX_PRIORITY_CEILING]        = new YPriorityStatisticEntry;      // max. priority ceiling
00355                             properties[NUMBER_OF_PRIORITY_CHANGES]  = new YIntStatisticEntry;           //number of priority changes (How many times did a task change its priority)
00356                             CheckProperties();
00357                         }
00358     void                SetTask(YLogFileTask *t)                    {   task=t;                         }
00359     void                ResetStatistics()                           {   computationtimes.clear();
00360                                                                         jittertimes.clear();
00361                                                                         reactiontimes.clear();
00362                                                                         YLogFileStatistics::ResetStatistics();}
00363     int                 CalculateStatistics(YEnvironmentLogFileSet &);
00364     virtual QStringList GetPropertyNames() const                    {   return CreatePropertyNames();   }
00365     static unsigned int GetMaxProperties()                          {   return MAX_PROPERTIES;          }
00366     static QStringList  CreatePropertyNames()
00367                         {   QStringList list;
00368                             list<<MSGP_TP_ID;                       // id of task
00369                             list<<MSGP_TP_PERIOD;                   // period of thread
00370                             list<<MSGP_TP_DEADLINE;                 // deadline of thread
00371                             list<<MSGP_TP_ACTIVATIONS;              // number of activations in scheduling period
00372                             list<<MSGP_TP_STARTS;                   // number of starting periods in scheduling period
00373                             list<<MSGP_TP_THREADS_SUSPENDED;        // how many times the thread was suspended
00374                             list<<MSGP_TP_PREEMPTIONS;              // number of preemptions
00375                             list<<MSGP_TP_CPU_LOSSES;               // number of cpu losts
00376                             list<<MSGP_TP_EXCLUSIONS;               // number of exclusion (ELLF)
00377                             list<<MSGP_TP_MATCHED_DEADLINES;        // number of matched deadlines
00378                             list<<MSGP_TP_MISSED_DEADLINES;         // number of missed deadlines
00379                             list<<MSGP_TP_DETECTED_DEADLINE_MISSES; // number of discovered deadline misses
00380                             list<<MSGP_TP_DEADLINE_TOLERANCE_STARTS;// number of tolerance deadline starts
00381                             list<<MSGP_TP_DEADLINE_TOLERANCE_MISSES;// number of tolerance deadline misses
00382                             //list<<MSGP_TP_DETECTED_TOLERANCE_MISSED;// number of detected tolerance deadline misses
00383                             list<<MSGP_TP_SYNCHRONIZATION_OFFSET;   // synchronization offset
00384                             list<<MSGP_TP_MIN_COMPUTATION_TIME;     // min computation time
00385                             list<<MSGP_TP_MAX_COMPUTATION_TIME;     // max computation time
00386                             list<<MSGP_TP_AVERAGE_COMPUTATION_TIME; // average computation time
00387                             list<<MSGP_TP_COMPUTATION_TIME,         // computation time of this task in the scheduling interval
00388                             list<<MSGP_TP_UTILIZATION;              // utilization in scheduling period
00389                             list<<MSGP_TP_MIN_REACTION_TIME;        // min. time until thread finished since activation
00390                             list<<MSGP_TP_MAX_REACTION_TIME;        // max. time until thread finished since activation
00391                             list<<MSGP_TP_AVERAGE_REACTION_TIME;    // average time until thread finished since activation
00392                             list<<MSGP_TP_MIN_JITTER;
00393                             list<<MSGP_TP_MAX_JITTER;
00394                             list<<MSGP_TP_AVERAGE_JITTER;
00395                             //list<<MSGP_TP_JITTER_PERCENT;
00396                             list<<MSGP_TP_SKIPPED_THREADS;          // skipped threads
00397                             list<<MSGP_TP_EMERGENCY_THREADS;        // how many times an emergency threads were started
00398                             list<<MSGP_TP_LOCKED_MUTEXES;           // number of locked mutexes
00399                             list<<MSGP_TP_UNLOCKED_MUTEXES;         // number of unlocked mutexes
00400                             list<<MSGP_TP_RELOCKED_MUTEXES;         // locked a mutex twice or more ?
00401                             list<<MSGP_TP_BLOCKED_MUTEXES;
00402                             list<<MSGP_TP_MAX_PRIORITY_CEILING;     // max. priority ceiling
00403                             list<<MSGP_TP_NUMBER_OF_PRIORITY_CHANGES; // number of priority changes (How many times did a task change its priority)
00404                             return list;
00405                         }
00406     void                IncActivations()                            {   properties[ACTIVATIONS]->IncContent();              }
00407     int                 GetActivations() const                      {   if ( properties[ACTIVATIONS]->IsValid() )
00408                                                                             return ((YIntStatisticEntry*)properties[ACTIVATIONS])->GetContent();
00409                                                                         return 0;                                           }
00410     void                IncStarts()                                 {   properties[STARTS]->IncContent();                   }
00411     int                 GetStarts() const                           {   if ( properties[STARTS]->IsValid() )
00412                                                                             return ((YIntStatisticEntry*)properties[STARTS])->GetContent();
00413                                                                         return 0;                                           }
00414     void                IncCPULosses()                              {   properties[CPU_LOSSES]->IncContent();                   }
00415     int                 GetCPULosses() const                            {   if ( properties[CPU_LOSSES]->IsValid() )
00416                                                                             return ((YIntStatisticEntry*)properties[CPU_LOSSES])->GetContent();
00417                                                                         return 0;                                           }
00418     void                IncPreemptions()                            {   properties[PREEMPTIONS]->IncContent();              }
00419     int                 GetPreemptions() const                      {   if ( properties[PREEMPTIONS]->IsValid() )
00420                                                                             return ((YIntStatisticEntry*)properties[PREEMPTIONS])->GetContent();
00421                                                                         return 0;                                           }
00422     void                IncMatchedDeadlines()                       {   properties[MATCHED_DEADLINES]->IncContent();        }
00423     void                IncMissedDeadlines()                        {   properties[MISSED_DEADLINES]->IncContent();         }
00424     void                IncDetetectedDeadlineMisses()               {   properties[DETECTED_DEADLINE_MISSES]->IncContent(); }
00425     void                IncDeadlineToleranceStarts()                {   properties[DEADLINE_TOLERANCE_STARTS]->IncContent();}
00426     void                IncDeadlineToleranceMisses()                {   properties[DEADLINE_TOLERANCE_MISSES]->IncContent();}
00427     //void              IncDetectedDeadlineToleranceMisses()        {   properties[DETECTED_TOLERANCE_MISSES]->IncContent();}
00428     void                IncExclusions()                             {   properties[EXCLUSIONS]->IncContent();               }
00429     int                 GetExclusions() const                       {   if ( properties[EXCLUSIONS]->IsValid() )
00430                                                                             return ((YIntStatisticEntry*)properties[EXCLUSIONS])->GetContent();
00431                                                                         return 0;                                           }
00432     void                IncSkippedThreads()                         {   properties[SKIPPED_THREADS]->IncContent();          }
00433     int                 GetSkippedThreads() const                   {   if ( properties[SKIPPED_THREADS]->IsValid() )
00434                                                                             return ((YIntStatisticEntry*)properties[SKIPPED_THREADS])->GetContent();
00435                                                                         return 0;                                           }
00436     void                IncSuspendedThreads()                       {   properties[THREADS_SUSPENDED]->IncContent();        }
00437     int                 GetSuspendedThreads() const                 {   if ( properties[THREADS_SUSPENDED]->IsValid() )
00438                                                                             return ((YIntStatisticEntry*)properties[THREADS_SUSPENDED])->GetContent();
00439                                                                         return 0;                                           }
00440     void                IncEmergencyThreads()                       {   properties[EMERGENCY_THREADS]->IncContent();        }
00441     int                 GetEmergencyThreads() const                 {   if ( properties[EMERGENCY_THREADS]->IsValid() )
00442                                                                             return ((YIntStatisticEntry*)properties[EMERGENCY_THREADS])->GetContent();
00443                                                                         return 0;                                           }
00444     void                IncLockedMutexes()                          {   properties[LOCKED_MUTEXES]->IncContent();           }
00445     void                IncUnlockedMutexes()                        {   properties[UNLOCKED_MUTEXES]->IncContent();         }
00446     void                IncRelockedMutexes()                        {   properties[RELOCKED_MUTEXES]->IncContent();         }
00447     void                IncBlockedMutexes()                         {   properties[BLOCKED_MUTEXES]->IncContent();          }
00448     void                SetPeriod(YASA_TIME t)                      {   ((YInfinityYasaTimeStatisticEntry*)properties[PERIOD])->SetContent(t);          }
00449     void                SetDeadline(YASA_TIME t)                    {   ((YInfinityYasaTimeStatisticEntry*)properties[DEADLINE])->SetContent(t);        }
00450     YASA_TIME           GetPeriod() const                           {   return ((YInfinityYasaTimeStatisticEntry*)properties[PERIOD])->GetContent();    }
00451     YASA_TIME           GetDeadline() const                         {   return ((YInfinityYasaTimeStatisticEntry*)properties[DEADLINE])->GetContent();  }
00452     void                SetMaxPriorityCeiling(int p)                {   if ( ! (properties[MAX_PRIORITY_CEILING])->IsValid() || ((YIntStatisticEntry*)properties[MAX_PRIORITY_CEILING])->GetContent() < p )
00453                                                                             ((YIntStatisticEntry*)properties[MAX_PRIORITY_CEILING])->SetContent(p);     }
00454     void                SetSynchronizationOffset(YASA_TIME t)       {   ((YYasaTimeStatisticEntry*)properties[SYNCHRONIZATION_OFFSET])->SetContent(t);  }
00455     void                InvalidSynchronizationOffset()              {   ((YYasaTimeStatisticEntry*)properties[SYNCHRONIZATION_OFFSET])->Invalid();      }
00456     void                InvalidJitter()                             {   ((YYasaTimeStatisticEntry*)properties[MIN_JITTER])->Invalid();
00457                                                                         ((YYasaTimeStatisticEntry*)properties[MAX_JITTER])->Invalid();
00458                                                                         ((YYasaTimeStatisticEntry*)properties[AVERAGE_JITTER])->Invalid();              }
00459     void                InvalidPeriod()                             {   ((YYasaTimeStatisticEntry*)properties[PERIOD])->Invalid();                      }
00460     void                InvalidDeadline()                           {   ((YYasaTimeStatisticEntry*)properties[DEADLINE])->Invalid();                    }
00461     void                InvalidPreemptions()                        {   ((YIntStatisticEntry*)properties[PREEMPTIONS])->Invalid();                      }
00462     void                InvalidCPULosts()                           {   ((YIntStatisticEntry*)properties[CPU_LOSSES])->Invalid();                       }
00463     void                InvalidMatchedDeadlines()                   {   ((YIntStatisticEntry*)properties[MATCHED_DEADLINES])->Invalid();                }
00464     void                InvalidMissedDeadlines()                    {   ((YIntStatisticEntry*)properties[MISSED_DEADLINES])->Invalid();                 }
00465     void                InvalidDetectedDeadlineMissed()             {   ((YIntStatisticEntry*)properties[DETECTED_DEADLINE_MISSES])->Invalid();         }
00466     void                InvalidDeadlineToleranceStarts()            {   ((YIntStatisticEntry*)properties[DEADLINE_TOLERANCE_STARTS])->Invalid();        }
00467     void                InvalidDeadlineToleranceMisses()            {   ((YIntStatisticEntry*)properties[DEADLINE_TOLERANCE_MISSES])->Invalid();        }
00468     void                InvalidReactionTime()                       {   ((YYasaTimeStatisticEntry*)properties[MIN_REACTION_TIME])->Invalid();
00469                                                                         ((YYasaTimeStatisticEntry*)properties[MAX_REACTION_TIME])->Invalid();
00470                                                                         ((YYasaTimeStatisticEntry*)properties[AVERAGE_REACTION_TIME])->Invalid();       }
00471     void                InvalidExclusions()                         {   ((YIntStatisticEntry*)properties[EXCLUSIONS])->Invalid();                       }
00472     void                InvalidSkipped()                            {   ((YIntStatisticEntry*)properties[SKIPPED_THREADS])->Invalid();                  }
00473     void                InvalidSuspended()                          {   ((YIntStatisticEntry*)properties[THREADS_SUSPENDED])->Invalid();                }
00474     void                InvalidEmergencyThreads()                   {   ((YIntStatisticEntry*)properties[EMERGENCY_THREADS])->Invalid();                }
00475     void                InvalidLockedMutexes()                      {   ((YIntStatisticEntry*)properties[LOCKED_MUTEXES])->Invalid();                   }
00476     void                InvalidUnlockedMutexes()                    {   ((YIntStatisticEntry*)properties[UNLOCKED_MUTEXES])->Invalid();                 }
00477     void                InvalidMutexesRelocked()                    {   ((YIntStatisticEntry*)properties[RELOCKED_MUTEXES])->Invalid();                 }
00478     void                InvalidBlockedByMutexes()                   {   ((YIntStatisticEntry*)properties[BLOCKED_MUTEXES])->Invalid();                  }
00479     void                InvalidMaxPriorityCeiling()                 {   ((YPriorityStatisticEntry*)properties[MAX_PRIORITY_CEILING])->Invalid();        }
00480     void                InvalidNumberOfPriorityChanges()            {   ((YIntStatisticEntry*)properties[NUMBER_OF_PRIORITY_CHANGES])->Invalid();       }
00481     YASA_TIME           GetComputationTime() const                  {   return ((YZeroYasaTimeStatisticEntry*)properties[COMPUTATION_TIME])->GetContent();}
00482     void                AddComputationTime(YASA_TIME t)             {   computationtimes.append( new YASA_TIME(t) );                                    }
00483     void                AddJitterTime(YASA_TIME t)                  {   jittertimes.append( new YASA_TIME(t) );                                         }
00484     void                AddReactionTime(YASA_TIME t)                {   reactiontimes.append( new YASA_TIME(t) );                                       }
00485     void                IncNumberOfPriorityChanges()                {   properties[NUMBER_OF_PRIORITY_CHANGES]->IncContent();                           }
00486 };
00487 
00488 
00489 
00490 
00493 class YMutexLogFileStatistics : public YLogFileStatistics
00494 {   enum MUTEX_PROPERTIES { LOCKED=0,                   // number of lock
00495                             RELOCKED,                   // number of allready locked mutexes
00496                             UNLOCKED,                   // number of unlocked mutexes
00497                             BLOCKED,                    // threads blocked
00498                             MAX_PRIORITY_CEILING,       // max. priority ceiling of this mutex
00499                             NUMBER_OF_PRIORITY_CHANGES, // number of priority changes (How many times did a task change its priority)
00500                             MIN_LOCKING_TIME,           // min. locking time of mutex
00501                             MAX_LOCKING_TIME,           // max. locking time of mutex
00502                             AVERAGE_LOCKING_TIME,       // average locking time of mutex
00503                             MAX_PROPERTIES
00504                         };
00505     YLogFileMutex *     mutex;
00506     QList<YASA_TIME>    lockingtimes;
00507 public:                 YMutexLogFileStatistics() : YLogFileStatistics(MAX_PROPERTIES), mutex(0)
00508                         {
00509                             properties[LOCKED]                      = new YIntStatisticEntry;
00510                             properties[RELOCKED]                    = new YIntStatisticEntry;
00511                             properties[UNLOCKED]                    = new YIntStatisticEntry;
00512                             properties[BLOCKED]                     = new YIntStatisticEntry;
00513                             properties[MAX_PRIORITY_CEILING]        = new YPriorityStatisticEntry;
00514                             properties[NUMBER_OF_PRIORITY_CHANGES]  = new YIntStatisticEntry;
00515                             properties[MIN_LOCKING_TIME]            = new YZeroYasaTimeStatisticEntry;
00516                             properties[MAX_LOCKING_TIME]            = new YZeroYasaTimeStatisticEntry;
00517                             properties[AVERAGE_LOCKING_TIME]        = new YZeroYasaTimeStatisticEntry;
00518                             CheckProperties();
00519                         }
00520     void                SetMutex(YLogFileMutex *m)                  {   mutex=m;                            }
00521     void                IncMutexLocked()                            {   properties[LOCKED]->IncContent();   }
00522     void                IncMutexRelocked()                          {   properties[RELOCKED]->IncContent(); }
00523     void                IncMutexUnlocked()                          {   properties[UNLOCKED]->IncContent(); }
00524     void                IncMutexBlocked()                           {   properties[BLOCKED]->IncContent();  }
00525     void                SetMaxPriorityCeiling(int p)                {   if ( ! (properties[MAX_PRIORITY_CEILING])->IsValid() || ((YIntStatisticEntry*)properties[MAX_PRIORITY_CEILING])->GetContent() < p )
00526                                                                             ((YIntStatisticEntry*)properties[MAX_PRIORITY_CEILING])->SetContent(p);     }
00527     void                IncNumberOfPriorityChanges()                {   properties[NUMBER_OF_PRIORITY_CHANGES]->IncContent();   }
00528     int                 CalculateStatistics(YEnvironmentLogFileSet &);
00529     virtual QStringList GetPropertyNames() const                    {   return CreatePropertyNames();   }
00530     static unsigned int GetMaxProperties()                          {   return MAX_PROPERTIES;          }
00531     void                AddLockingTime(YASA_TIME t)                 {   lockingtimes.append( new YASA_TIME(t) );    }
00532     static QStringList  CreatePropertyNames()
00533                         {   QStringList list;
00534                             list<<MSGP_MP_LOCKED;
00535                             list<<MSGP_MP_RELOCKED;
00536                             list<<MSGP_MP_UNLOCKED;
00537                             list<<MSGP_MP_BLOCKED;
00538                             list<<MSGP_MP_MAX_PRIORITY_CEILING;
00539                             list<<MSGP_MP_NUMBER_OF_PRIORITY_CHANGES;
00540                             list<<MSGP_MP_MIN_LOCKING_TIME;
00541                             list<<MSGP_MP_MAX_LOCKING_TIME;
00542                             list<<MSGP_MP_AVERAGE_LOCKING_TIME;
00543                             return list;
00544                         }
00545 };
00546 
00547 
00550 class YCPULogFileStatistics : public YLogFileStatistics
00551 {   enum CPU_PROPERTIES {   SCHEDULER_NAME=0,                   // name of scheduler
00552                             SCHEDULER_VERSION,                  // version of scheduler
00553                             NUMBER_OF_CPU,                      // number of CPU
00554                             EXECUTION_START,                    // time of start
00555                             SCHEDULED_EXECUTION_END,            // scheduled execution end
00556                             EXECUTION_END,                      // time of end
00557                             EXECUTION_DURATION,                 // duration of scheduling
00558                             SCHEDULER_TICK,                     // scheduling tick
00559                             CALC_PREEMPTION_TIME,               // calc preemption time enabled ?
00560                             SIZE_OF_LOGBUFFER,                  // usage of logfile buffer (bytes)
00561                             USAGE_OF_LOGBUFFER,                 // usage of logfile buffer (bytes)
00562                             USAGE_OF_LOGBUFFER_PERCENT,         // usage of logfile buffer (percent)
00563                             NUMBER_OF_TASKS,                    // number of tasks
00564                             TASK_SWITCHES,                      // task switches
00565                             TASK_CPU_SWITCHES,                  // switches of task's between cpus (How many times did any task change between this and other cpu's)
00566                             MATCHED_DEADLINES,                  // matched deadlines
00567                             MISSED_DEADLINES,                   // missed deadlines
00568                             DETECTED_DEADLINE_MISSES,           // detected deadline misses
00569                             MISSED_TOLERANCE_DEADLINES,         // missed tolerance deadlines
00570                             UTILIZATION,                        // Utilization of cpu
00571                             UTILIZATION_PERCENT,                // Utilization of cpu (%)
00572                             IDLE,                               // idle time
00573                             IDLE_PERCENT,                       // idle time (percent)
00574                             SCHEDULER_CALLS,                    // number of scheduler calls
00575                             TIME_OF_SCHEDULING,                 // time of scheduling
00576                             TIME_OF_SCHEDULING_PERCENT,         // time of scheduling(percent)
00577                             MUTEX_LOCKED,                       // locked mutexes on this cpu
00578                             MUTEX_RELOCKED,                     // relocked mutexes on this cpu
00579                             MUTEX_UNLOCKED,                     // unlocked mutexes on this cpu
00580                             MUTEX_BLOCKED,                      // blocked mutexes on this cpu
00581                             MUTEX_MAX_PRIORITY_CEILING,         // max. priority changed through mutexes
00582                             MUTEX_NUMBER_OF_PRIORITY_CHANGES,   // number priority changed on this cpu
00583                             MAX_PROPERTIES
00584                         };
00585 public:                 YCPULogFileStatistics() : YLogFileStatistics(MAX_PROPERTIES)    //, cpulogfile(0)
00586                         {
00587                             properties[SCHEDULER_NAME]              = new YStringStatisticEntry;        // name of scheduler
00588                             properties[SCHEDULER_VERSION]           = new YVersionStatisticEntry;       // version of scheduler
00589                             properties[NUMBER_OF_CPU]               = new YIntStatisticEntry;           // number of CPU
00590                             properties[EXECUTION_START]             = new YZeroYasaTimeStatisticEntry;  // time of start
00591                             properties[SCHEDULED_EXECUTION_END]     = new YInfinityYasaTimeStatisticEntry;  // scheduled execution time
00592                             properties[EXECUTION_END]               = new YInfinityYasaTimeStatisticEntry;  // time of end
00593                             properties[EXECUTION_DURATION]          = new YInfinityYasaTimeStatisticEntry;  // duration
00594                             properties[SCHEDULER_TICK]              = new YZeroYasaTimeStatisticEntry;  // scheduling tick
00595                             properties[CALC_PREEMPTION_TIME]        = new YBoolStatisticEntry;          // calc preemption time enabled ?
00596                             properties[SIZE_OF_LOGBUFFER]           = new YIntStatisticEntry;           // usage of logfile buffer (bytes)
00597                             properties[USAGE_OF_LOGBUFFER]          = new YIntStatisticEntry;           // usage of logfile buffer (bytes)
00598                             properties[USAGE_OF_LOGBUFFER_PERCENT]  = new YPercentStatisticEntry;       // usage of logfile buffer (percent)
00599                             properties[NUMBER_OF_TASKS]             = new YIntStatisticEntry;           // number of tasks
00600                             properties[TASK_SWITCHES]               = new YIntStatisticEntry;           // task switches
00601                             properties[TASK_CPU_SWITCHES]           = new YIntStatisticEntry;           // switches of task's between cpus (How many times did any task change between this and other cpu's)
00602                             properties[MATCHED_DEADLINES]           = new YIntStatisticEntry;           // matched deadlines
00603                             properties[MISSED_DEADLINES]            = new YIntStatisticEntry;           // missed deadlines
00604                             properties[DETECTED_DEADLINE_MISSES]    = new YIntStatisticEntry;           // detected deadlines misses
00605                             properties[MISSED_TOLERANCE_DEADLINES]  = new YIntStatisticEntry;           // missed tolerance deadlines
00606                             properties[UTILIZATION]                 = new YZeroYasaTimeStatisticEntry;  // utilization
00607                             properties[UTILIZATION_PERCENT]         = new YPercentStatisticEntry;       // utilization (percent)
00608                             properties[IDLE]                        = new YZeroYasaTimeStatisticEntry;  // idle time
00609                             properties[IDLE_PERCENT]                = new YPercentStatisticEntry;       // idle time (percent)
00610                             properties[SCHEDULER_CALLS]             = new YIntStatisticEntry;           // number of scheduler calls
00611                             properties[TIME_OF_SCHEDULING]          = new YZeroYasaTimeStatisticEntry;  // time of scheduling
00612                             properties[TIME_OF_SCHEDULING_PERCENT]  = new YPercentStatisticEntry;       // time of scheduling(percent)
00613                             properties[MUTEX_LOCKED]                = new YIntStatisticEntry;
00614                             properties[MUTEX_RELOCKED]              = new YIntStatisticEntry;
00615                             properties[MUTEX_UNLOCKED]              = new YIntStatisticEntry;
00616                             properties[MUTEX_BLOCKED]               = new YIntStatisticEntry;
00617                             properties[MUTEX_MAX_PRIORITY_CEILING]  = new YPriorityStatisticEntry;
00618                             properties[MUTEX_NUMBER_OF_PRIORITY_CHANGES]= new YIntStatisticEntry;
00619                             CheckProperties();
00620                         }
00621     int                 CalculateStatistics(YCPULogFile &);
00622     virtual QStringList GetPropertyNames() const                    {   return CreatePropertyNames();   }
00623     static unsigned int GetMaxProperties()                          {   return MAX_PROPERTIES;          }
00624     static QStringList  CreatePropertyNames()
00625                         {   QStringList list;
00626                             list<<MSGP_CP_SCHEDULER_NAME;
00627                             list<<MSGP_CP_SCHEDULER_VERSION;
00628                             list<<MSGP_CP_NUMBER_OF_CPU;
00629                             list<<MSGP_CP_EXECUTION_START;
00630                             list<<MSGP_CP_SCHEDULES_EXECUTION_END;
00631                             list<<MSGP_CP_EXECUTION_END;
00632                             list<<MSGP_CP_EXECUTION_DURATION;
00633                             list<<MSGP_CP_SCHEDULER_TICK;
00634                             list<<MSGP_CP_CALC_PREEMPTION_TIME;
00635                             list<<MSGP_CP_SIZE_OF_LOGBUFFER;
00636                             list<<MSGP_CP_USAGE_OF_LOGBUFFER;
00637                             list<<MSGP_CP_USAGE_OF_LOGBUFFER_PERCENT;
00638                             list<<MSGP_CP_NUMBER_OF_TASKS;
00639                             list<<MSGP_CP_TASK_SWITCHES;
00640                             list<<MSGP_CP_TASK_CPU_SWITCHES;
00641                             list<<MSGP_CP_MATCHED_DEADLINES;
00642                             list<<MSGP_CP_MISSED_DEADLINES;
00643                             list<<MSGP_CP_DETECTED_DEADLINE_MISSES;
00644                             list<<MSGP_CP_MISSED_TOLERANCE_DEADLINES;
00645                             list<<MSGP_CP_UTILIZATION;
00646                             list<<MSGP_CP_UTILIZATION_PERCENT;
00647                             list<<MSGP_CP_IDLE;
00648                             list<<MSGP_CP_IDLE_PERCENT;
00649                             list<<MSGP_CP_SCHEDULER_CALLS;
00650                             list<<MSGP_CP_TIME_OF_SCHEDULING;
00651                             list<<MSGP_CP_TIME_OF_SCHEDULING_PERCENT;
00652                             list<<MSGP_CP_LOCKED;
00653                             list<<MSGP_CP_RELOCKED;
00654                             list<<MSGP_CP_UNLOCKED;
00655                             list<<MSGP_CP_BLOCKED;
00656                             list<<MSGP_CP_MAX_PRIORITY_CEILING;
00657                             list<<MSGP_CP_NUMBER_OF_PRIORITY_CHANGES;
00658                             return list;
00659                         }
00660     void                SetSchedulerVersion(double v)               {   ((YVersionStatisticEntry*)properties[SCHEDULER_VERSION])->SetContent(v);        }
00661     void                SetSchedulerName(const QString &name)       {   ((YStringStatisticEntry*)properties[SCHEDULER_NAME])->SetContent(name);         }
00662     void                SetNumberOfCPU(int cpu)                     {   ((YIntStatisticEntry*)properties[NUMBER_OF_CPU])->SetContent(cpu);              }
00663     int                 GetNumberOfCPU() const                      {   return ((YIntStatisticEntry*)properties[NUMBER_OF_CPU])->GetContent();          }
00664     void                SetExecutionStart(YASA_TIME time)           {   ((YYasaTimeStatisticEntry*)properties[EXECUTION_START])->SetContent(time);      }
00665     void                SetScheduledExecutionEnd(YASA_TIME time)    {   ((YYasaTimeStatisticEntry*)properties[SCHEDULED_EXECUTION_END])->SetContent(time);      }
00666     YASA_TIME           GetScheduledExecutionEnd() const            {   return ((YYasaTimeStatisticEntry*)properties[SCHEDULED_EXECUTION_END])->GetContent();   }
00667     void                SetExecutionEnd(YASA_TIME time)             {   ((YYasaTimeStatisticEntry*)properties[EXECUTION_END])->SetContent(time);        }
00668     YASA_TIME           GetExecutionEnd() const                     {   return ((YYasaTimeStatisticEntry*)properties[EXECUTION_END])->GetContent();     }
00669     void                SetExecutionDuration(YASA_TIME time)        {   ((YYasaTimeStatisticEntry*)properties[EXECUTION_DURATION])->SetContent(time);   }
00670     YASA_TIME           GetExecutionDuration() const                {   return ((YYasaTimeStatisticEntry*)properties[EXECUTION_DURATION])->GetContent();}
00671     void                SetSchedulerTick(YASA_TIME time)            {   ((YYasaTimeStatisticEntry*)properties[SCHEDULER_TICK])->SetContent(time);       }
00672     YASA_TIME           GetSchedulerTick() const                    {   return ((YYasaTimeStatisticEntry*)properties[SCHEDULER_TICK])->GetContent();    }
00673     void                SetCalcPreemptionTime(bool b)               {   ((YBoolStatisticEntry*)properties[CALC_PREEMPTION_TIME])->SetContent(b);        }
00674     void                SetLogBufferSize(int s)                     {   ((YIntStatisticEntry*)properties[SIZE_OF_LOGBUFFER])->SetContent(s);            }
00675     int                 GetLogBufferSize() const                    {   return ((YIntStatisticEntry*)properties[SIZE_OF_LOGBUFFER])->GetContent();      }
00676     int                 GetUsedLogBufferSize() const                {   return ((YIntStatisticEntry*)properties[USAGE_OF_LOGBUFFER])->GetContent();     }
00677     void                SetUsedLogBufferSize(int s)                 {   ((YIntStatisticEntry*)properties[USAGE_OF_LOGBUFFER])->SetContent(s);
00678                                                                         if ( properties[SIZE_OF_LOGBUFFER]->IsValid() )
00679                                                                         {
00680                                                                             ((YPercentStatisticEntry*)properties[USAGE_OF_LOGBUFFER_PERCENT])->CalcContent( ((YIntStatisticEntry*)properties[SIZE_OF_LOGBUFFER])->GetContent(), s );
00681                                                                         }
00682                                                                     }
00683     void                SetNumberOfTasks(int n)                     {   ((YIntStatisticEntry*)properties[NUMBER_OF_TASKS])->SetContent(n);              }
00684     //int                   GetNumberOfTasks() const                {   return ((YIntStatisticEntry*)properties[NUMBER_OF_TASKS])->GetContent();        }
00685     void                SetTaskSwitches(int sw)                     {   ((YIntStatisticEntry*)properties[TASK_SWITCHES])->SetContent(sw);               }
00686     int                 GetTaskSwitches()                           {   return ((YIntStatisticEntry*)properties[TASK_SWITCHES])->GetContent();          }
00687     void                SetMatchedDeadlines(int md)                 {   ((YIntStatisticEntry*)properties[MATCHED_DEADLINES])->SetContent(md);           }
00688     int                 GetMatchedDeadlines() const                 {   return ((YIntStatisticEntry*)properties[MATCHED_DEADLINES])->GetContent();      }
00689     void                SetMissedDeadlines(int md)                  {   ((YIntStatisticEntry*)properties[MISSED_DEADLINES])->SetContent(md);            }
00690     int                 GetMissedDeadlines() const                  {   return ((YIntStatisticEntry*)properties[MISSED_DEADLINES])->GetContent();       }
00691     void                SetDetectedDeadlineMisses(int ddm)          {   ((YIntStatisticEntry*)properties[DETECTED_DEADLINE_MISSES])->SetContent(ddm);   }
00692     int                 GetDetectedDeadlineMisses() const           {   return ((YIntStatisticEntry*)properties[DETECTED_DEADLINE_MISSES])->GetContent(); }
00693     void                SetDeadlineToleranceMisses(int md)          {   ((YIntStatisticEntry*)properties[MISSED_TOLERANCE_DEADLINES])->SetContent(md);  }
00694     int                 GetDeadlineToleranceMisses() const          {   return ((YIntStatisticEntry*)properties[MISSED_TOLERANCE_DEADLINES])->GetContent(); }
00695     void                SetTaskCPUSwitches(int sw)                  {   ((YIntStatisticEntry*)properties[TASK_CPU_SWITCHES])->SetContent(sw);           }
00696     int                 GetTaskCPUSwitches() const                  {   return ((YIntStatisticEntry*)properties[TASK_CPU_SWITCHES])->GetContent();      }
00697     YASA_TIME           GetUtilization() const                      {   return ((YYasaTimeStatisticEntry*)properties[UTILIZATION])->GetContent();       }
00698     PERCENTTYPE         GetUtilizationPercent() const               {   return ((YPercentStatisticEntry*)properties[UTILIZATION_PERCENT])->GetContent();}
00699     void                SetUtilization(YASA_TIME time)              {   ((YYasaTimeStatisticEntry*)properties[UTILIZATION])->SetContent(time);
00700                                                                         if ( properties[EXECUTION_DURATION]->IsValid() )
00701                                                                         {
00702                                                                             ((YPercentStatisticEntry*)properties[UTILIZATION_PERCENT])->CalcContent( ((YYasaTimeStatisticEntry*)properties[EXECUTION_DURATION])->GetContent(), time );
00703                                                                         }
00704                                                                     }
00705     YASA_TIME           GetIdleTime() const                         {   return ((YYasaTimeStatisticEntry*)properties[IDLE])->GetContent();              }
00706     void                SetIdleTime(YASA_TIME time)                 {   ((YYasaTimeStatisticEntry*)properties[IDLE])->SetContent(time);
00707                                                                         if ( properties[EXECUTION_DURATION]->IsValid() )
00708                                                                         {
00709                                                                             ((YPercentStatisticEntry*)properties[IDLE_PERCENT])->CalcContent( ((YYasaTimeStatisticEntry*)properties[EXECUTION_DURATION])->GetContent(), time );
00710                                                                         }
00711                                                                     }
00712     void                SetSchedulerCalls(int sc)                   {   ((YIntStatisticEntry*)properties[SCHEDULER_CALLS])->SetContent(sc);             }
00713     int                 GetSchedulerCalls() const                   {   return ((YIntStatisticEntry*)properties[SCHEDULER_CALLS])->GetContent();        }
00714     YASA_TIME           GetTimeOfScheduling() const                 {   return ((YYasaTimeStatisticEntry*)properties[TIME_OF_SCHEDULING])->GetContent();}
00715     void                SetTimeOfScheduling(YASA_TIME time)         {   ((YYasaTimeStatisticEntry*)properties[TIME_OF_SCHEDULING])->SetContent(time);
00716                                                                         if ( properties[EXECUTION_DURATION]->IsValid() )
00717                                                                         {
00718                                                                             ((YPercentStatisticEntry*)properties[TIME_OF_SCHEDULING_PERCENT])->CalcContent( ((YYasaTimeStatisticEntry*)properties[EXECUTION_DURATION])->GetContent(), time );
00719                                                                         }
00720                                                                     }
00721     void                IncMutexLocked()                            {   properties[MUTEX_LOCKED]->IncContent();                                         }
00722     int                 GetMutexLocked() const                      {   return ((YIntStatisticEntry*)properties[MUTEX_LOCKED])->GetContent();           }
00723     void                IncMutexRelocked()                          {   properties[MUTEX_RELOCKED]->IncContent();                                       }
00724     int                 GetMutexRelocked() const                    {   return ((YIntStatisticEntry*)properties[MUTEX_RELOCKED])->GetContent();         }
00725     void                IncMutexUnlocked()                          {   properties[MUTEX_UNLOCKED]->IncContent();                                       }
00726     int                 GetMutexUnlocked() const                    {   return ((YIntStatisticEntry*)properties[MUTEX_UNLOCKED])->GetContent();         }
00727     void                IncMutexBlocked()                           {   properties[MUTEX_BLOCKED]->IncContent();                                        }
00728     int                 GetMutexBlocked() const                     {   return ((YIntStatisticEntry*)properties[MUTEX_BLOCKED])->GetContent();          }
00729     void                SetMaxPriorityCeiling(int p)                {   if ( ! properties[MUTEX_MAX_PRIORITY_CEILING]->IsValid() || ((YPriorityStatisticEntry*)properties[MUTEX_MAX_PRIORITY_CEILING])->GetContent() < p )
00730                                                                             ((YPriorityStatisticEntry*)properties[MUTEX_MAX_PRIORITY_CEILING])->SetContent(p);      }
00731     int                 GetMaxPriorityCeiling() const               {   return ((YPriorityStatisticEntry*)properties[MUTEX_MAX_PRIORITY_CEILING])->GetContent();    }
00732     void                IncNumberOfPriorityChanges()                {   properties[MUTEX_NUMBER_OF_PRIORITY_CHANGES]->IncContent();                             }
00733     int                 GetNumberOfPriorityChanges() const          {   return ((YIntStatisticEntry*)properties[MUTEX_NUMBER_OF_PRIORITY_CHANGES])->GetContent();   }
00734 };
00735 
00736 
00737 
00740 class YEnvironmentLogFileStatistics : public YLogFileStatistics
00741 {
00742     enum ENVIRONMENT_PROPERTIES {
00743                             EXECUTIVE_NAME=0,           // name of executive
00744                             EXECUTIVE_VERSION,          // version of executive
00745                             LF_YASA_VERSION,            // version of yasa used in logfile
00746                             NUMBER_OF_CPUS,             // number of CPU
00747                             //UTILIZATION_OF_CPUS,      // utilization of all cpus
00748                             UTILIZATION_OF_CPUS_PERCENT,// utilization of all cpus (%)
00749                             SCHEDULER_CALLS,            // number of scheduler calls
00750                             TASK_SWITCHES,              // task switches
00751                             TASK_CPU_SWITCHES,          // switches of task's between cpus (How many times did any task change between this and other cpu's)
00752                             ACTIVATIONS,                // number of activations in scheduling period
00753                             STARTS,                     // number of starting periods in scheduling period
00754                             THREADS_SUSPENDED,          // how many times the thread was suspended
00755                             PREEMPTIONS,                // number of preemptions
00756                             CPU_LOSSES,                 // number of cpu losts
00757                             EXCLUSIONS,                 // number of exclusion (ELLF)
00758                             SKIPPED_THREADS,            // skipped threads
00759                             EMERGENCY_THREADS,          // how many times an emergency thread was started
00760                             MATCHED_DEADLINES,          // matched deadlines
00761                             MISSED_DEADLINES,           // missed deadlines
00762                             DETECTED_DEADLINE_MISSES,   // detected deadline misses
00763                             MISSED_TOLERANCE_DEADLINES, // missed tolerance deadlines
00764                             SIZE_OF_LOGBUFFER,          // usage of logfile buffer (bytes)
00765                             USAGE_OF_LOGBUFFER,         // usage of logfile buffer (bytes)
00766                             USAGE_OF_LOGBUFFER_PERCENT, // usage of logfile buffer (percent)
00767                             IDLE,                       // idle time
00768                             IDLE_PERCENT,               // idle time (percent)
00769                             TIME_OF_SCHEDULING,         // time of scheduling
00770                             TIME_OF_SCHEDULING_PERCENT, // time of scheduling(percent)
00771                             MUTEX_LOCKED,               // locked mutexes on this cpu
00772                             MUTEX_RELOCKED,             // relocked mutexes on this cpu
00773                             MUTEX_UNLOCKED,             // unlocked mutexes on this cpu
00774                             MUTEX_BLOCKED,              // blocked mutexes on this cpu
00775                             MUTEX_MAX_PRIORITY_CEILING, // max. priority changed through mutexes
00776                             MUTEX_NUMBER_OF_PRIORITY_CHANGES,   // number priority changed on this cpu
00777                             MAX_PROPERTIES
00778                         };
00779 public:                 YEnvironmentLogFileStatistics() : YLogFileStatistics(MAX_PROPERTIES)
00780                         {
00781                             properties[EXECUTIVE_NAME]              = new YStringStatisticEntry;        // name of executive
00782                             properties[EXECUTIVE_VERSION]           = new YVersionStatisticEntry;       // version of executive
00783                             properties[LF_YASA_VERSION]             = new YVersionStatisticEntry;       // version of yasa
00784                             properties[NUMBER_OF_CPUS]              = new YIntStatisticEntry;           // cpus
00785                             //properties[UTILIZATION_OF_CPUS]       = new YIntStatisticEntry;           // utilization
00786                             properties[UTILIZATION_OF_CPUS_PERCENT] = new YPercentStatisticEntry;       // utilization %
00787                             properties[SCHEDULER_CALLS]             = new YIntStatisticEntry;           // schedulercalls;
00788                             properties[TASK_SWITCHES]               = new YIntStatisticEntry;           // taskswitches;
00789                             properties[TASK_CPU_SWITCHES]           = new YIntStatisticEntry;           // taskcpuswitches;
00790                             properties[ACTIVATIONS]                 = new YIntStatisticEntry;           // number of activations in scheduling period
00791                             properties[STARTS]                      = new YIntStatisticEntry;           // number of starting periods in scheduling period
00792                             properties[THREADS_SUSPENDED]           = new YIntStatisticEntry;           // how many times the thread was suspended
00793                             properties[PREEMPTIONS]                 = new YIntStatisticEntry;           // number of preemptions
00794                             properties[CPU_LOSSES]                  = new YIntStatisticEntry;           // number of cpu losts
00795                             properties[EXCLUSIONS]                  = new YIntStatisticEntry;           // number of exclusion (ELLF)
00796                             properties[SKIPPED_THREADS]             = new YIntStatisticEntry;           // skipped threads
00797                             properties[EMERGENCY_THREADS]           = new YIntStatisticEntry;           // how many times an emergency thread was started
00798                             properties[MATCHED_DEADLINES]           = new YIntStatisticEntry;           // matched deadlines
00799                             properties[MISSED_DEADLINES]            = new YIntStatisticEntry;           // missed deadlines
00800                             properties[DETECTED_DEADLINE_MISSES]    = new YIntStatisticEntry;           // detected deadlines misses
00801                             properties[MISSED_TOLERANCE_DEADLINES]  = new YIntStatisticEntry;           // missed tolerance deadlines
00802                             properties[SIZE_OF_LOGBUFFER]           = new YIntStatisticEntry;           // logbuffersize;
00803                             properties[USAGE_OF_LOGBUFFER]          = new YIntStatisticEntry;           // usedlogbuffer;
00804                             properties[USAGE_OF_LOGBUFFER_PERCENT]  = new YPercentStatisticEntry;       // usedlogbufferpercent;
00805                             properties[IDLE]                        = new YZeroYasaTimeStatisticEntry;  // idletime;
00806                             properties[IDLE_PERCENT]                = new YPercentStatisticEntry;       // idletimepercent;
00807                             properties[TIME_OF_SCHEDULING]          = new YZeroYasaTimeStatisticEntry;  // schedulingtime;
00808                             properties[TIME_OF_SCHEDULING_PERCENT]  = new YPercentStatisticEntry;       // schedulingpercent;
00809                             properties[MUTEX_LOCKED]                = new YIntStatisticEntry;
00810                             properties[MUTEX_RELOCKED]              = new YIntStatisticEntry;
00811                             properties[MUTEX_UNLOCKED]              = new YIntStatisticEntry;
00812                             properties[MUTEX_BLOCKED]               = new YIntStatisticEntry;
00813                             properties[MUTEX_MAX_PRIORITY_CEILING]  = new YPriorityStatisticEntry;
00814                             properties[MUTEX_NUMBER_OF_PRIORITY_CHANGES]= new YIntStatisticEntry;
00815                             CheckProperties();
00816                         }
00817     void                SetYasaVersion(double v)                    {   ((YVersionStatisticEntry*)properties[LF_YASA_VERSION])->SetContent(v);      }
00818     void                SetExecutiveVersion(double v)               {   ((YVersionStatisticEntry*)properties[EXECUTIVE_VERSION])->SetContent(v);    }
00819     void                SetExecutiveName(const QString &name)       {   ((YStringStatisticEntry*)properties[EXECUTIVE_NAME])->SetContent(name);     }
00820     const QString &     GetExecutiveName() const                    {   return ((YStringStatisticEntry*)properties[EXECUTIVE_NAME])->GetContent();  }
00821     int                 CalculateStatistics(YEnvironmentLogFileSet &);
00822     virtual QStringList GetPropertyNames() const                    {   return CreatePropertyNames();   }
00823     static unsigned int GetMaxProperties()                          {   return MAX_PROPERTIES;          }
00824     static QStringList  CreatePropertyNames()
00825                         {   QStringList list;
00826                             list<<MSGP_EP_EXECUTIVE_NAME;
00827                             list<<MSGP_EP_EXECUTIVE_VERSION;
00828                             list<<MSGP_EP_YASA_VERSION;
00829                             list<<MSGP_EP_NUMBER_OF_CPUS;
00830                             //list<<MSGP_EP_UTILIZATION_OF_CPUS;
00831                             list<<MSGP_EP_UTILIZATION_OF_CPUS_PERCENT;
00832                             list<<MSGP_EP_SCHEDULER_CALLS;
00833                             list<<MSGP_EP_TASK_SWITCHES;
00834                             list<<MSGP_EP_TASK_CPU_SWITCHES;
00835                             list<<MSGP_EP_ACTIVATIONS;              // number of activations in scheduling period
00836                             list<<MSGP_EP_STARTS;                   // number of starting periods in scheduling period
00837                             list<<MSGP_EP_THREADS_SUSPENDED;        // how many times the thread was suspended
00838                             list<<MSGP_EP_PREEMPTIONS;              // number of preemptions
00839                             list<<MSGP_EP_CPU_LOSSES;                   // number of cpu losts
00840                             list<<MSGP_EP_EXCLUSIONS;               // number of exclusion (ELLF)
00841                             list<<MSGP_EP_SKIPPED_THREADS;          // skipped threads
00842                             list<<MSGP_EP_EMERGENCY_THREADS;        // how many times an emergency threads were started
00843                             list<<MSGP_EP_MATCHED_DEADLINES;
00844                             list<<MSGP_EP_MISSED_DEADLINES;
00845                             list<<MSGP_EP_DETECTED_DEADLINE_MISSES;
00846                             list<<MSGP_EP_MISSED_TOLERANCE_DEADLINES;
00847                             list<<MSGP_EP_SIZE_OF_LOGBUFFER;
00848                             list<<MSGP_EP_USAGE_OF_LOGBUFFER;
00849                             list<<MSGP_EP_USAGE_OF_LOGBUFFER_PERCENT;
00850                             list<<MSGP_EP_IDLE;
00851                             list<<MSGP_EP_IDLE_PERCENT;
00852                             list<<MSGP_EP_TIME_OF_SCHEDULING;
00853                             list<<MSGP_EP_TIME_OF_SCHEDULING_PERCENT;
00854                             list<<MSGP_EP_LOCKED;
00855                             list<<MSGP_EP_RELOCKED;
00856                             list<<MSGP_EP_UNLOCKED;
00857                             list<<MSGP_EP_BLOCKED;
00858                             list<<MSGP_EP_MAX_PRIORITY_CEILING;
00859                             list<<MSGP_EP_NUMBER_OF_PRIORITY_CHANGES;
00860                             return list;
00861                         }
00862 };
00863 
00864 
00866 #endif                                                              // ifndef YASAGUI_LOGFILESTATISTICS_PARSER_INCLUDE

Generated on Thu Feb 13 23:43:54 2003 for Yasa by doxygen1.3-rc3