|
@@ -31,6 +31,7 @@
|
|
#ifndef dataset_hpp
|
|
#ifndef dataset_hpp
|
|
#define dataset_hpp
|
|
#define dataset_hpp
|
|
#include <iostream>
|
|
#include <iostream>
|
|
|
|
+#include <sstream>
|
|
#include <functional>
|
|
#include <functional>
|
|
|
|
|
|
#include <sys/time.h>
|
|
#include <sys/time.h>
|
|
@@ -68,6 +69,8 @@ namespace fv {
|
|
|
|
|
|
timeval start_time;
|
|
timeval start_time;
|
|
bool stop_requested;
|
|
bool stop_requested;
|
|
|
|
+ bool silent;
|
|
|
|
+ bool batch;
|
|
|
|
|
|
void print_status() {
|
|
void print_status() {
|
|
size_t m_used = fv_util::getCurrentRSS() / 1024 / 1024;
|
|
size_t m_used = fv_util::getCurrentRSS() / 1024 / 1024;
|
|
@@ -92,8 +95,20 @@ namespace fv {
|
|
if (secs_remaining > 0) {
|
|
if (secs_remaining > 0) {
|
|
time_remaining << secs_remaining << "S";
|
|
time_remaining << secs_remaining << "S";
|
|
}
|
|
}
|
|
- std::cout << "\rprocessing event: " << current_event + 1 << "/" << get_events()
|
|
|
|
- << " of file: " << get_current_file().filename
|
|
|
|
|
|
+ if (batch) {
|
|
|
|
+ std::cout << "\n";
|
|
|
|
+ } else {
|
|
|
|
+ std::cout << "\r";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ std::string filename = get_current_file().filename;
|
|
|
|
+ if (filename.size() > 80) {
|
|
|
|
+ std::stringstream ss;
|
|
|
|
+ ss << filename.substr(0,27) << "..." << filename.substr(filename.size() - 50);
|
|
|
|
+ filename = ss.str();
|
|
|
|
+ }
|
|
|
|
+ std::cout << "processing event: " << current_event + 1 << "/" << get_events()
|
|
|
|
+ << " of file: " << filename
|
|
<< ", " << m_used << "MB used "
|
|
<< ", " << m_used << "MB used "
|
|
<< ", " << time_remaining.str() << " est. time remaining"
|
|
<< ", " << time_remaining.str() << " est. time remaining"
|
|
<< std::flush;
|
|
<< std::flush;
|
|
@@ -122,8 +137,11 @@ namespace fv {
|
|
|
|
|
|
public:
|
|
public:
|
|
DataSet() : stop_requested(false){
|
|
DataSet() : stop_requested(false){
|
|
- max_events = fv_util::the_config->get_max_events();
|
|
|
|
|
|
+ using fv_util::the_config;
|
|
|
|
+ max_events = the_config->get_max_events();
|
|
the_dataset = this;
|
|
the_dataset = this;
|
|
|
|
+ silent = the_config->get("silent").as<bool>(false);
|
|
|
|
+ batch = the_config->get("batch").as<bool>(false);
|
|
|
|
|
|
signal(SIGINT, request_stop_callback);
|
|
signal(SIGINT, request_stop_callback);
|
|
signal(SIGTERM, request_stop_callback);
|
|
signal(SIGTERM, request_stop_callback);
|
|
@@ -133,7 +151,7 @@ namespace fv {
|
|
if (stop_requested) return false;
|
|
if (stop_requested) return false;
|
|
int current_event = get_current_event();
|
|
int current_event = get_current_event();
|
|
if (current_event == 0) gettimeofday(&start_time, nullptr);
|
|
if (current_event == 0) gettimeofday(&start_time, nullptr);
|
|
- if (verbose and (((current_event + 1) % 500) == 0 or current_event+1 == get_events())) print_status();
|
|
|
|
|
|
+ if (!silent and (((current_event + 1) % 500) == 0 or current_event+1 == get_events())) print_status();
|
|
GenValue::reset();
|
|
GenValue::reset();
|
|
return load_next();
|
|
return load_next();
|
|
}
|
|
}
|