Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:53

0001 #include "FWCore/Utilities/interface/Exception.h"
0002 #include "Utilities/StorageFactory/test/Test.h"
0003 #include "Utilities/StorageFactory/interface/Storage.h"
0004 #include <boost/thread/thread.hpp>
0005 #include <vector>
0006 
0007 static void dump()
0008 {
0009   std::vector<char> buf(10000,'1');
0010   Storage *s = StorageFactory::get ()->open
0011     ("/dev/null", IOFlags::OpenWrite|IOFlags::OpenAppend);
0012 
0013   for (int i = 0; i < 10000; ++i)
0014     s->write(&buf[0], buf.size());
0015 
0016   s->close();
0017   delete s;
0018 }
0019 
0020 int main (int, char **) try
0021 {
0022   initTest();
0023 
0024   std::cout << "start StorageFactory thread test\n";
0025 
0026   static const int NUMTHREADS = 10;
0027   boost::thread_group threads;
0028   for (int i = 0; i < NUMTHREADS; ++i)
0029     threads.create_thread(&dump);
0030   threads.join_all();
0031 
0032   std::cout << StorageAccount::summaryText (true) << std::endl;
0033   return EXIT_SUCCESS;
0034 } catch(cms::Exception const& e) {
0035   std::cerr << e.explainSelf() << std::endl;
0036   return EXIT_FAILURE;
0037 } catch(std::exception const& e) {
0038   std::cerr << e.what() << std::endl;
0039   return EXIT_FAILURE;
0040 }