|
|
Go to the documentation of this file.
18 #include <condition_variable>
45 auto const&
cv =
p.getParameter<std::vector<edm::InputTag>>(
"consumes");
47 for (
auto const&
c :
cv) {
48 tokens_.emplace_back(iCol.consumes<
int>(
c));
51 auto const& tv =
p.getParameter<std::vector<double>>(
"eventTimes");
67 desc.add<std::vector<edm::InputTag>>(
"consumes", {})->setComment(
"What event int data products to consume");
68 desc.add<std::vector<double>>(
"eventTimes")
70 "The time, in seconds, for how long the module should sleep each event. The index to use is based on a "
71 "modulo of size of the list applied to the Event ID number.");
75 std::vector<edm::EDGetTokenT<int>>
tokens_;
107 desc.add<
int>(
"ivalue")->setComment(
"Value to put into Event");
108 Sleeper::fillDescription(
desc);
139 desc.add<
int>(
"ivalue")->setComment(
"Value to put into Event");
141 Sleeper::fillDescription(
desc);
165 Sleeper::fillDescription(
desc);
215 std::lock_guard<std::mutex> lk{
mutex_};
235 std::vector<int> streamsToProcess;
237 std::unique_lock<std::mutex> lk(
mutex_);
244 long longestTime = 0;
246 for (
auto i : streamsToProcess) {
248 if (
v[1] > longestTime) {
257 for (
auto i : streamsToProcess) {
281 auto const& tv =
p.getParameter<std::vector<double>>(
"serviceInitTimes");
284 initTimes_.push_back(static_cast<useconds_t>(
t * 1E6));
288 auto const& tv =
p.getParameter<std::vector<double>>(
"serviceWorkTimes");
291 workTimes_.push_back(static_cast<useconds_t>(
t * 1E6));
295 auto const& tv =
p.getParameter<std::vector<double>>(
"serviceFinishTimes");
340 desc.add<
int>(
"ivalue")->setComment(
"Value to put into Event");
341 desc.add<std::vector<double>>(
"serviceInitTimes");
342 desc.add<std::vector<double>>(
"serviceWorkTimes");
343 desc.add<std::vector<double>>(
"serviceFinishTimes");
344 Sleeper::fillDescription(
desc);
bool readyToDoSomething()
std::vector< long > initTimes_
std::unique_ptr< std::thread > serverThread_
ExternalWorkSleepingProducer(edm::ParameterSet const &p)
std::atomic< bool > stopProcessing_
void analyze(edm::Event const &e, edm::EventSetup const &c) override
void swap(Association< C > &lhs, Association< C > &rhs)
#define DEFINE_FWK_SERVICE(type)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void watchPreStreamBeginLumi(PreStreamBeginLumi::slot_type const &iSlot)
#define DEFINE_FWK_MODULE(type)
std::vector< edm::EDGetTokenT< int > > tokens_
std::vector< int > waitingStreams_
void watchPreEndJob(PreEndJob::slot_type const &iSlot)
const edm::EDPutTokenT< int > token_
void asyncWork(edm::StreamID id, edm::WaitingTaskWithArenaHolder iTask, long initTime, long workTime, long finishTime)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
SleepingProducer(edm::ParameterSet const &p)
void watchPreStreamEndLumi(PreStreamEndLumi::slot_type const &iSlot)
std::vector< std::array< long, 3 > > waitTimesPerStream_
std::atomic< unsigned int > activeStreams_
void acquire(edm::StreamID, edm::Event const &e, edm::EventSetup const &c, edm::WaitingTaskWithArenaHolder holder) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
unsigned int maxNumberOfStreams() const
OneSleepingProducer(edm::ParameterSet const &p)
std::vector< useconds_t > eventTimes_
OneSleepingAnalyzer(edm::ParameterSet const &p)
void produce(edm::StreamID, edm::Event &e, edm::EventSetup const &c) const override
void watchPreallocate(Preallocate::slot_type const &iSlot)
const edm::EDPutTokenT< int > token_
std::vector< long > finishTimes_
TEMPL(T2) struct Divides void
const unsigned int nWaitingEvents_
std::vector< long > workTimes_
std::vector< edm::WaitingTaskWithArenaHolder > waitingTaskPerStream_
void produce(edm::Event &e, edm::EventSetup const &c) override
SleepingServer(edm::ParameterSet const &iPS, edm::ActivityRegistry &iAR)
void addDefault(ParameterSetDescription const &psetDescription)
void produce(edm::StreamID, edm::Event &e, edm::EventSetup const &c) const override
std::condition_variable condition_
const edm::EDPutTokenT< int > token_