88 testESSource_(testESSource) {}
93 throw cms::Exception(
"TestFailure") <<
"TestESSourceTestResolver::getImpl," 94 <<
" functions in mutex should not run concurrently";
116 <<
"TestESSourceTestResolver::initializeForNewIOV";
124 iterations_(
pset.getParameter<unsigned
int>(
"iterations")),
126 expectedNumberOfConcurrentIOVs_(
pset.getParameter<unsigned
int>(
"expectedNumberOfConcurrentIOVs")),
127 checkIOVInitialization_(
pset.getParameter<
bool>(
"checkIOVInitialization")) {
128 std::vector<unsigned int>
temp(
pset.getParameter<std::vector<unsigned int>>(
"firstValidLumis"));
133 findingRecord<ESTestRecordI>();
134 usingRecord<ESTestRecordI>();
141 std::vector<unsigned int> emptyVector;
142 desc.add<
unsigned int>(
"iterations", 10 * 1000 * 1000);
143 desc.add<
bool>(
"checkIOVInitialization",
false);
144 desc.add<
unsigned int>(
"expectedNumberOfConcurrentIOVs", 0);
145 desc.add<std::vector<unsigned int>>(
"firstValidLumis", emptyVector);
152 std::lock_guard<std::mutex> guard(
mutex_);
158 throw cms::Exception(
"TestFailure") <<
"TestESSource::setIntervalFor," 159 <<
" unexpected number of IOV initializations";
165 throw cms::Exception(
"TestFailure") <<
"TestESSource::setIntervalFor," 166 <<
" functions in mutex should not run concurrently";
176 std::pair<std::set<edm::IOVSyncValue>::iterator, std::set<edm::IOVSyncValue>::iterator> itFound =
179 if (itFound.first == itFound.second) {
180 if (itFound.first ==
setOfIOV_.begin()) {
201 throw cms::Exception(
"TestFailure") <<
"TestESSource::registerResolvers," 202 <<
" unexpected number of concurrent IOVs";
207 keyedResolversVector.emplace_back(dataKey, std::make_shared<TestESSourceTestResolver>(
this));
209 return keyedResolversVector;
214 <<
"Start TestESSource::initConcurrentIOVs " << nConcurrentIOVs <<
" " <<
key.name();
215 if (EventSetupRecordKey::makeKey<ESTestRecordI>() !=
key) {
216 throw cms::Exception(
"TestFailure") <<
"TestESSource::initConcurrentIOVs," 217 <<
" unexpected EventSetupRecordKey";
220 throw cms::Exception(
"TestFailure") <<
"TestESSource::initConcurrentIOVs," 221 <<
" unexpected number of concurrent IOVs";
231 sum += stepSize *
cos(
i * stepSize);
233 edm::LogAbsolute(
"TestESSource::busyWait") <<
"Stop TestESSource::busyWait " <<
msg <<
" " << sum;
const IOVSyncValue & last() const
LuminosityBlockNumber_t luminosityBlockNumber() const
const IOVSyncValue & first() const
std::set< edm::IOVSyncValue > setOfIOV_
void const * getAfterPrefetchImpl() const override
unsigned int iovIndex() const
unsigned int expectedNumberOfConcurrentIOVs_
static const IOVSyncValue & endOfTime()
KeyedResolversVector registerResolvers(EventSetupRecordKey const &, unsigned int iovIndex) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
unsigned long long cacheIdentifier() const
std::pair< Time_t, Time_t > ValidityInterval
unsigned int nConcurrentIOVs_
void prefetch(edm::eventsetup::DataKey const &, edm::EventSetupRecordDetails) override
edm::SerialTaskQueue queue_
std::atomic< unsigned int > count1_
TestESSource(edm::ParameterSet const &)
ValidityInterval validityInterval() const
std::atomic< unsigned int > count_
void initConcurrentIOVs(EventSetupRecordKey const &, unsigned int nConcurrentIOVs) override
void addDefault(ParameterSetDescription const &psetDescription)
bool isConcurrentFinder() const override
unsigned int iovStartLumi_
Cos< T >::type cos(const T &t)
bool checkIOVInitialization_
void busyWait(char const *msg) const
void setIntervalFor(EventSetupRecordKey const &, edm::IOVSyncValue const &, edm::ValidityInterval &) override
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
unsigned long long cacheIdentifier_
TestESSourceTestResolver(TestESSource *testESSource)
static EventNumber_t maxEventNumber()
std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >> KeyedResolversVector
const unsigned int iterations_
static const ValidityInterval & invalidInterval()
Log< level::System, true > LogAbsolute
void initializeForNewIOV() override
std::atomic< unsigned int > count2_
TestESSource * testESSource_