Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-01 22:41:10

0001 #include "FWCore/Utilities/interface/Exception.h"
0002 #include "Utilities/StorageFactory/interface/Storage.h"
0003 #include "Utilities/StorageFactory/test/Test.h"
0004 #include <cassert>
0005 
0006 int main(int, char ** /*argv*/) try {
0007   initTest();
0008 
0009   using namespace edm::storage;
0010   std::unique_ptr<Storage> s = StorageFactory::get()->open(
0011       "http://cern.ch/cmsbuild/cms/Run2011A/PhotonHad/AOD"
0012       "/12Oct2013-v1/00000/024938EB-3445-E311-A72B-002590593920.root");
0013   assert(s);
0014 
0015   IOSize totalVecs = 6;
0016   char *buf[4096] = {NULL};
0017   int sizes[] = {20, 100, 50, 1024, 2222};
0018   int offset[] = {1000, 2, 19, 100, 500};
0019 
0020   for (IOSize i = 1; i < totalVecs; i++) {
0021     std::cout << i;
0022     std::vector<IOPosBuffer> iov;
0023     iov.reserve(i);
0024     for (IOSize j = 0; j < i; j++) {
0025       iov.push_back(IOPosBuffer(offset[j], buf, sizes[j]));
0026     }
0027     s->readv(&iov[0], iov.size());
0028     std::cout << "stats " << i << ":\n" << StorageAccount::summaryText() << std::endl;
0029   }
0030 
0031   s->close();
0032 
0033   std::cout << "final stats:\n" << StorageAccount::summaryText() << std::endl;
0034   return EXIT_SUCCESS;
0035 } catch (cms::Exception const &e) {
0036   std::cerr << e.explainSelf() << std::endl;
0037   return EXIT_FAILURE;
0038 } catch (std::exception const &e) {
0039   std::cerr << e.what() << std::endl;
0040   return EXIT_FAILURE;
0041 }