Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:17:40

0001 // Copyright 2020, Jefferson Science Associates, LLC.
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 
0004 
0005 #include <JANA/JEventProcessor.h>
0006 
0007 #include <map>
0008 using std::map;
0009 
0010 class TTree;
0011 
0012 class JEventProcessorJANARATE:public JEventProcessor
0013 {
0014     public:
0015 
0016     JEventProcessorJANARATE(JApplication* app): JEventProcessor(app) {}
0017 
0018     virtual void Init(void);
0019     virtual void Process(const std::shared_ptr<const JEvent>& aEvent);
0020     virtual void Finish(void);
0021 
0022         pthread_mutex_t mutex;
0023         bool initialized;
0024         bool finalized;
0025         int prescale;
0026         
0027         struct itimerval start_tmr;
0028         struct itimerval end_tmr;
0029 //      struct itimerval last_tmr;
0030         
0031         unsigned int Ncalls;
0032 //      unsigned int last_Ncalls;
0033 //      unsigned int PERIOD_EVENTS;
0034         
0035         typedef struct{
0036             double tot_rate;            ///< Instantaneous rate due to all threads
0037             double tot_integrated_rate; ///< Total integrated rate for entire job due to all threads
0038             double thread_rate;         ///< Last instantaneous rate of this thread (updated every 2 seconds)
0039             double thread_delta_sec;    ///< Time to process the previous event (not this one!)
0040             double cpu;
0041             double mem_MB;
0042             unsigned int threadid;      ///< pthreadid of this thread
0043         }rate_t;
0044         
0045         rate_t rate;
0046         
0047         TTree *rate_tree;
0048 };