1117 std::unordered_map<XrdCl::File*, std::string> filenames;
1118 std::unordered_map<XrdCl::File*, double> synchronicity;
1119 std::unordered_map<XrdCl::File*, size_t> responseerrors;
1127 std::vector<std::thread> threads;
1128 std::unordered_map<XrdCl::File*, XrdCl::ActionMetrics> metrics;
1129 threads.reserve(actions.size());
1133 bool sampling_error =
false;
1135 for (
auto& action : actions)
1137 metrics[action.first].
fname = filenames[action.first];
1138 metrics[action.first].synchronicity = synchronicity[action.first];
1139 metrics[action.first].errors = responseerrors[action.first];
1140 if (metrics[action.first].errors)
1142 sampling_error =
true;
1148 std::cerr <<
"Warning: IO file contains unsuccessful samples!" << std::endl;
1149 if (!opt.suppress_error())
1151 std::cerr <<
"... run with [-f] or [--suppress] option to suppress unsuccessful IO events!"
1161 for (
auto& action : actions)
1164 threads.emplace_back(
ExecuteActions(std::unique_ptr<XrdCl::File>(action.first),
1165 std::move(action.second),
1168 metrics[action.first],
1172 for (
auto& t : threads)
1177 std::cout <<
"{" << std::endl;
1178 if (opt.longformat())
1179 std::cout <<
" \"metrics\": [" << std::endl;
1182 for (
auto& metric : metrics)
1184 if (opt.longformat())
1186 std::cout << metric.second.Dump(opt.json());
1188 summetric.
add(metric.second);
1192 std::cout << summetric.
Dump(opt.json());
1196 if (opt.longformat())
1197 std::cout <<
" ]," << std::endl;
1200 double tbench = timer.
elapsed();
1205 std::cout <<
" \"iosummary\": { " << std::endl;
1208 std::cout <<
" \"player::runtime\": " << tbench <<
"," << std::endl;
1210 std::cout <<
" \"player::speed\": " << opt.speed() <<
"," << std::endl;
1211 std::cout <<
" \"sampled::runtime\": " << t1 - t0 <<
"," << std::endl;
1212 std::cout <<
" \"volume::totalread\": " << summetric.
getBytesRead() <<
"," << std::endl;
1213 std::cout <<
" \"volume::totalwrite\": " << summetric.
getBytesWritten() <<
","
1215 std::cout <<
" \"volume::read\": " << summetric.
ios[
"Read::b"] <<
"," << std::endl;
1216 std::cout <<
" \"volume::write\": " << summetric.
ios[
"Write::b"] <<
"," << std::endl;
1217 std::cout <<
" \"volume::pgread\": " << summetric.
ios[
"PgRead::b"] <<
"," << std::endl;
1218 std::cout <<
" \"volume::pgwrite\": " << summetric.
ios[
"PgWrite::b"] <<
"," << std::endl;
1219 std::cout <<
" \"volume::vectorread\": " << summetric.
ios[
"VectorRead::b"] <<
","
1221 std::cout <<
" \"volume::vectorwrite\": " << summetric.
ios[
"VectorWrite::b"] <<
","
1223 std::cout <<
" \"iops::read\": " << summetric.
ios[
"Read::n"] <<
"," << std::endl;
1224 std::cout <<
" \"iops::write\": " << summetric.
ios[
"Write::n"] <<
"," << std::endl;
1225 std::cout <<
" \"iops::pgread\": " << summetric.
ios[
"PgRead::n"] <<
"," << std::endl;
1226 std::cout <<
" \"iops::pgwrite\": " << summetric.
ios[
"PgRead::n"] <<
"," << std::endl;
1227 std::cout <<
" \"iops::vectorread\": " << summetric.
ios[
"VectorRead::n"] <<
","
1229 std::cout <<
" \"iops::vectorwrite\": " << summetric.
ios[
"VectorRead::n"] <<
","
1231 std::cout <<
" \"files::read\": " << summetric.
ios[
"OpenR::n"] <<
"," << std::endl;
1232 std::cout <<
" \"files::write\": " << summetric.
ios[
"OpenW::n"] <<
"," << std::endl;
1233 std::cout <<
" \"datasetsize::read\": " << summetric.
ios[
"Read::o"] <<
"," << std::endl;
1234 std::cout <<
" \"datasetsize::write\": " << summetric.
ios[
"Write::o"] <<
"," << std::endl;
1237 std::cout <<
" \"bandwidth::mb::read\": "
1238 << summetric.
getBytesRead() / tbench / 1000000.0 <<
"," << std::endl;
1239 std::cout <<
" \"bandwdith::mb::write\": "
1240 << summetric.
getBytesWritten() / tbench / 1000000.0 <<
"," << std::endl;
1241 std::cout <<
" \"performancemark\": " << (100.0 * (t1 - t0) / tbench) <<
","
1243 std::cout <<
" \"gain::read\":"
1244 << (100.0 * summetric.
delays[
"Read::tnomi"] / summetric.
delays[
"Read::tmeas"])
1245 <<
"," << std::endl;
1246 std::cout <<
" \"gain::write\":"
1247 << (100.0 * summetric.
delays[
"Write::tnomi"] / summetric.
delays[
"Write::tmeas"])
1250 std::cout <<
" \"synchronicity::read\":"
1252 std::cout <<
" \"synchronicity::write\":"
1254 std::cout <<
" \"response::error:\":" << summetric.
ios[
"All::e"] << std::endl;
1255 std::cout <<
" }" << std::endl;
1256 std::cout <<
"}" << std::endl;
1261 std::cout <<
"# =============================================" << std::endl;
1263 std::cout <<
"# IO Summary" << std::endl;
1265 std::cout <<
"# IO Summary (print mode)" << std::endl;
1266 std::cout <<
"# =============================================" << std::endl;
1269 std::cout <<
"# Total Runtime : " << std::fixed << tbench <<
" s" << std::endl;
1271 std::cout <<
"# Sampled Runtime : " << std::fixed << t1 - t0 <<
" s" << std::endl;
1272 std::cout <<
"# Playback Speed : " << std::fixed << std::setprecision(2) << opt.speed()
1274 std::cout <<
"# IO Volume (R) : " << std::fixed
1279 <<
" ] " << std::endl;
1280 std::cout <<
"# IO Volume (W) : " << std::fixed
1285 <<
" ] " << std::endl;
1286 std::cout <<
"# IOPS (R) : " << std::fixed << summetric.
getIopsRead()
1287 <<
" [ std:" << summetric.
ios[
"Read::n"]
1288 <<
" vec:" << summetric.
ios[
"VectorRead::n"]
1289 <<
" page:" << summetric.
ios[
"PgRead::n"] <<
" ] " << std::endl;
1290 std::cout <<
"# IOPS (W) : " << std::fixed << summetric.
getIopsWrite()
1291 <<
" [ std:" << summetric.
ios[
"Write::n"]
1292 <<
" vec:" << summetric.
ios[
"VectorWrite::n"]
1293 <<
" page:" << summetric.
ios[
"PgWrite::n"] <<
" ] " << std::endl;
1294 std::cout <<
"# Files (R) : " << std::fixed << summetric.
ios[
"OpenR::n"] << std::endl;
1295 std::cout <<
"# Files (W) : " << std::fixed << summetric.
ios[
"OpenW::n"] << std::endl;
1296 std::cout <<
"# Datasize (R) : " << std::fixed
1298 std::cout <<
"# Datasize (W) : " << std::fixed
1302 std::cout <<
"# IO BW (R) : " << std::fixed << std::setprecision(2)
1303 << summetric.
getBytesRead() / tbench / 1000000.0 <<
" MB/s" << std::endl;
1304 std::cout <<
"# IO BW (W) : " << std::fixed << std::setprecision(2)
1305 << summetric.
getBytesRead() / tbench / 1000000.0 <<
" MB/s" << std::endl;
1307 std::cout <<
"# ---------------------------------------------" << std::endl;
1308 std::cout <<
"# Quality Estimation" << std::endl;
1309 std::cout <<
"# ---------------------------------------------" << std::endl;
1312 std::cout <<
"# Performance Mark : " << std::fixed << std::setprecision(2)
1313 << (100.0 * (t1 - t0) / tbench) <<
"%" << std::endl;
1314 std::cout <<
"# Gain Mark(R) : " << std::fixed << std::setprecision(2)
1315 << (100.0 * summetric.
delays[
"Read::tnomi"] / summetric.
delays[
"Read::tmeas"])
1316 <<
"%" << std::endl;
1317 std::cout <<
"# Gain Mark(W) : " << std::fixed << std::setprecision(2)
1318 << (100.0 * summetric.
delays[
"Write::tnomi"] / summetric.
delays[
"Write::tmeas"])
1319 <<
"%" << std::endl;
1321 std::cout <<
"# Synchronicity(R) : " << std::fixed << std::setprecision(2)
1323 std::cout <<
"# Synchronicity(W) : " << std::fixed << std::setprecision(2)
1327 std::cout <<
"# ---------------------------------------------" << std::endl;
1328 std::cout <<
"# Response Errors : " << std::fixed << summetric.
ios[
"All::e"] << std::endl;
1329 std::cout <<
"# =============================================" << std::endl;
1330 if (summetric.
ios[
"All::e"])
1332 std::cerr <<
"Error: replay job failed with IO errors!" << std::endl;
1336 if (opt.create() || opt.verify())
1338 std::cout <<
"# ---------------------------------------------" << std::endl;
1341 std::cout <<
"# Creating Dataset ..." << std::endl;
1345 std::cout <<
"# Verifying Dataset ..." << std::endl;
1347 uint64_t created_sofar = 0;
1348 for (
auto& metric : metrics)
1350 if (metric.second.getBytesRead() && !metric.second.getBytesWritten())
1352 std::cout <<
"# ............................................." << std::endl;
1353 std::cout <<
"# file: " << metric.second.fname << std::endl;
1354 std::cout <<
"# size: "
1358 << std::setprecision(2) <<
" ( "
1359 << 100.0 * created_sofar / summetric.
ios[
"Read::o"] <<
"% )" << std::endl;
1361 metric.second.fname, metric.second.ios[
"Read::o"], opt.truncate(), opt.verify()))
1369 std::cerr <<
"Error: failed to assure that file " << metric.second.fname
1370 <<
" is stored with a size of "
1381 catch (
const std::invalid_argument& ex)
1383 std::cout << ex.what() << std::endl;
Args parse for XrdClReplay.
std::unordered_map< File *, action_list > ParseInput(const std::string &path, double &t0, double &t1, std::unordered_map< File *, std::string > &filenames, std::unordered_map< File *, double > &synchronicity, std::unordered_map< File *, size_t > &responseerrors, const std::vector< std::string > &option_regex)
std::thread ExecuteActions(std::unique_ptr< File > file, action_list &&actions, double t0, double speed, ActionMetrics &metric, bool simulate)
bool AssureFile(const std::string &url, uint64_t size, bool viatruncate, bool verify)
AssureFile creates input data files on the fly if required.
double ReadSynchronicity() const
double WriteSynchronicity() const
Metrics struct storing all timing and IO information of an action.
synchronicity_t aggregated_synchronicity
void add(const ActionMetrics &other)
std::map< std::string, uint64_t > ios
size_t getBytesRead() const
std::map< std::string, double > delays
size_t getBytesWritten() const
std::string Dump(bool json) const
size_t getIopsWrite() const
size_t getIopsRead() const
static std::string humanreadable(uint64_t insize)
static double timeNow()
Get curretn unix time in ns precision as a double.