$treeview $search $mathjax $extrastylesheet
artdaq
v3_04_01
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef ARTDAQ_TEST_DAQRATE_TRANSFERTEST_HH 00002 #define ARTDAQ_TEST_DAQRATE_TRANSFERTEST_HH 00003 00004 #include <vector> 00005 #include <string> 00006 #include <chrono> 00007 #include <cmath> 00008 00009 #include "fhiclcpp/ParameterSet.h" 00010 #include "artdaq-utilities/Plugins/MetricManager.hh" 00011 00012 namespace artdaq 00013 { 00017 class TransferTest 00018 { 00019 public: 00037 explicit TransferTest(fhicl::ParameterSet psi); 00038 00043 int runTest(); 00044 00045 private: 00046 std::pair<size_t, double> do_sending(int thread_index); 00047 00048 std::pair<size_t, double> do_receiving(); 00049 00050 //Helper functions 00051 const std::vector<std::string> suffixes{" B", " KB", " MB", " GB", " TB"}; 00052 00053 std::string formatBytes(double bytes, size_t suffixIndex = 0); 00054 00055 int senders_; 00056 int receivers_; 00057 int sending_threads_; 00058 int sends_each_sender_; 00059 int receives_each_receiver_; // Should be sends_each_sender * sending_threads * sending_ranks / receiving_ranks 00060 int buffer_count_; 00061 int error_count_max_; 00062 size_t fragment_size_; 00063 std::chrono::steady_clock::time_point start_time_; 00064 fhicl::ParameterSet ps_; 00065 bool validate_mode_; 00066 int partition_number_; 00067 }; 00068 00069 inline std::string TransferTest::formatBytes(double bytes, size_t suffixIndex) 00070 { 00071 auto b = fabs(bytes); 00072 00073 if (b > 1024.0 && suffixIndex < suffixes.size()) 00074 { 00075 return formatBytes(bytes / 1024.0, suffixIndex + 1); 00076 } 00077 00078 return std::to_string(bytes) + suffixes[suffixIndex]; 00079 } 00080 } 00081 #endif //ARTDAQ_TEST_DAQRATE_TRANSFERTEST_HH