Ignore:
Timestamp:
04/28/03 09:52:57 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r2009 r2015  
    251251    // Check System time (don't loose too much time by updates)
    252252    //
    253     static TTime t0 = gSystem->Now();
    254 
    255     const TTime t1 = gSystem->Now();
    256     if (t1-t0 < (TTime)20)
     253
     254    // FIXME: Not thread safe
     255    static Int_t start = num;
     256    static TTime t1 = gSystem->Now();
     257    static TTime t2 = t1;
     258
     259    //
     260    // No update < 20ms
     261    //
     262    const TTime t0 = gSystem->Now();
     263    if (t0-t1 < (TTime)20)
    257264        return rc;
    258 
    259     t0 = t1;
     265    t1 = t0;
     266
     267    //
     268    // Update current speed each second
     269    //
     270    if (t0-t2 > (TTime)1000)
     271    {
     272        const Int_t speed = 1000*(num-start)/(long int)(t0-t2);
     273        TString txt = "Processing...";
     274        if (speed>0)
     275        {
     276            txt += " (";
     277            txt += speed;
     278            txt += "Evts/s)";
     279        }
     280        fDisplay->SetStatusLine1(txt);
     281        start = num;
     282        t2 = t1;
     283    }
    260284
    261285    //
  • trunk/MagicSoft/Mars/mbase/MGGroupFrame.h

    r1664 r2015  
    3737    virtual Bool_t ProcessMessage(Long_t msg, Long_t param1, Long_t param2);
    3838
    39     ClassDef(MGGroupFrame, 0) // A interface to widgets in a group frame (makes live easier)
     39    ClassDef(MGGroupFrame, 0) // An interface to widgets in a group frame (makes live easier)
    4040};
    4141
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r1936 r2015  
    6969
    7070#include <fstream.h>
     71#include <TBaseClass.h>
    7172
    7273#include "MLog.h"
     
    317318     out << "   " << GetUniqueName() << ".SetFilter(&" << fFilter->GetUniqueName() <<");" << endl;
    318319}
     320
     321// --------------------------------------------------------------------------
     322//
     323// Check whether the class given in the argument overwrites MTask::Process.
     324// This function calls itself recursively. If you want to call it,
     325// leave out the argument.
     326//
     327Bool_t MTask::OverwritesProcess(TClass *cls) const
     328{
     329    if (!cls)
     330        cls = IsA();
     331
     332    //
     333    // Check whether we reached the base class MTask
     334    //
     335    if (TString(cls->GetName())=="MTask")
     336        return kFALSE;
     337
     338    //
     339    // Check whether the class cls overwrites Process
     340    //
     341    if (cls->GetMethodAny("Process"))
     342        return kTRUE;
     343
     344    //
     345    // If the class itself doesn't overload it check all it's base classes
     346    //
     347    TBaseClass *base=NULL;
     348    TIter NextBase(cls->GetListOfBases());
     349    while ((base=(TBaseClass*)NextBase()))
     350    {
     351        if (OverwritesProcess(base->GetClassPointer()))
     352            return kTRUE;
     353    }
     354
     355    return kFALSE;
     356}
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r1661 r2015  
    8080    const TList *GetListOfBranches() const { return fListOfBranches; }
    8181
     82    Bool_t OverwritesProcess(TClass *cls=NULL) const;
     83
    8284    void SavePrimitive(ofstream &out, Option_t *o="");
    8385
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r1965 r2015  
    6060
    6161#include <TClass.h>
    62 #include <TBaseClass.h>
    6362#include <TOrdCollection.h>
    6463
     
    322321// --------------------------------------------------------------------------
    323322//
    324 // Check whether this task (or one of it's base classes) overloads
    325 // MTask::Process. Only if this function is overloaded this task is
    326 // added to the fTaskProcess-List. This makes the execution of the
    327 // tasklist a little bit (only a little bit) faster, bacause tasks
    328 // doing no Processing are not Processed.
    329 //
    330 Bool_t MTaskList::CheckClassForProcess(TClass *cls)
    331 {
    332     //
    333     // Check whether the class itself overloads the Process function
    334     //
    335     if (cls->GetName()=="MTask")
    336         return kFALSE;
    337 
    338     if (cls->GetMethodAny("Process"))
    339         return kTRUE;
    340 
    341     //
    342     // If the class itself doesn't overload it check all it's base classes
    343     //
    344     TBaseClass *base=NULL;
    345     TIter NextBase(cls->GetListOfBases());
    346     while ((base=(TBaseClass*)NextBase()))
    347     {
    348         if (CheckClassForProcess(base->GetClassPointer()))
    349             return kTRUE;
    350     }
    351 
    352     return kFALSE;
    353 }
    354 
    355 // --------------------------------------------------------------------------
    356 //
    357323//  do pre processing (before eventloop) of all tasks in the task-list
     324//  Only if a task overwrites the Process function the task is
     325//  added to the fTaskProcess-List. This makes the execution of the
     326//  tasklist a little bit (only a little bit) faster, bacause tasks
     327//  doing no Processing are not Processed.
    358328//
    359329Bool_t MTaskList::PreProcess(MParList *pList)
     
    410380    //
    411381    while ((task=(MTask*)Next()))
    412         if (CheckClassForProcess(task->IsA()))
     382        if (task->OverwritesProcess())
    413383            fTasksProcess.Add(task);
    414384
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r1965 r2015  
    3131
    3232    void   Remove(MTask *task);
    33     Bool_t CheckClassForProcess(TClass *cls);
    34 
    35     void StreamPrimitive(ofstream &out) const;
    36 
     33    void   StreamPrimitive(ofstream &out) const;
    3734    Bool_t CheckAddToList(MTask *task, const char *tType, const MTask *where=NULL) const;
    3835
Note: See TracChangeset for help on using the changeset viewer.