Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:00:32

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2021 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #ifndef GAUDIKERNEL_ISCHEDULER_H
0012 #define GAUDIKERNEL_ISCHEDULER_H
0013 
0014 // Framework include files
0015 #include "GaudiKernel/EventContext.h"
0016 #include "GaudiKernel/IInterface.h"
0017 
0018 // C++ include files
0019 #include <chrono>
0020 #include <functional>
0021 #include <memory>
0022 #include <vector>
0023 
0024 /**@class IScheduler IScheduler.h GaudiKernel/IScheduler.h
0025  *
0026  *  General interface for algorithm scheduler.
0027  *
0028  *  @author  Danilo Piparo
0029  *  @author  Benedikt Hegner
0030  *  @version 1.1
0031  */
0032 class GAUDI_API IScheduler : virtual public IInterface {
0033 public:
0034   /// InterfaceID
0035   DeclareInterfaceID( IScheduler, 1, 0 );
0036 
0037   /// Make an event available to the scheduler
0038   virtual StatusCode pushNewEvent( EventContext* eventContext ) = 0;
0039 
0040   /// Make a list of events available to the scheduler
0041   /// This method makes a bunch creation of new events atomic to the scheduler
0042   virtual StatusCode pushNewEvents( std::vector<EventContext*>& eventContexts ) = 0;
0043 
0044   /// Retrieve a finished event from the scheduler
0045   virtual StatusCode popFinishedEvent( EventContext*& eventContext ) = 0;
0046 
0047   /// Try to retrieve a finished event from the scheduler
0048   virtual StatusCode tryPopFinishedEvent( EventContext*& eventContext ) = 0;
0049 
0050   /// Get the free event processing slots
0051   virtual unsigned int freeSlots() = 0;
0052 
0053   virtual void dumpState(){};
0054 
0055   /// Method to inform the scheduler about event views
0056   virtual StatusCode scheduleEventView( const EventContext* sourceContext, const std::string& nodeName,
0057                                         std::unique_ptr<EventContext> viewContext ) = 0;
0058 
0059   /// Sample occupancy at fixed interval (ms)
0060   /// Negative value to deactivate, 0 to snapshot every change
0061   /// Each sample, apply the callback function to the result
0062   struct OccupancySnapshot {
0063     std::chrono::system_clock::time_point time;
0064     std::vector<std::vector<int>>         states;
0065   };
0066   virtual void recordOccupancy( int samplePeriod, std::function<void( OccupancySnapshot )> callback ) = 0;
0067 };
0068 #endif