TaskMaster::print_queue(ofs);
#endif
+ ofs << get_progress();
+
ofs.close();
BEESNOTE("renaming status file '" << status_file << "'");
}
}
+void
+BeesContext::set_progress(const string &str)
+{
+ unique_lock<mutex> lock(m_progress_mtx);
+ m_progress_str = str;
+}
+
+string
+BeesContext::get_progress()
+{
+ unique_lock<mutex> lock(m_progress_mtx);
+ return m_progress_str;
+}
+
void
BeesContext::show_progress()
{
BEESLOGINFO("\ttid " << t.first << ": " << t.second);
}
+ // No need to log progress here, it is logged when set
+
lastStats = thisStats;
}
}
auto avg_rates = thisStats / m_ctx->total_timer().age();
graph_blob << "\t" << avg_rates << "\n";
+ graph_blob << m_ctx->get_progress();
+
BEESLOGINFO(graph_blob.str());
catch_all([&]() {
m_stats_file.write(graph_blob.str());
});
BEESCOUNT(progress_ok);
}
- ostringstream oss;
- eta.left("PROGRESS: ");
- eta.mid(" ");
- eta.right("");
eta.insert_row(0, vector<Table::Content> {
Table::Text("done"),
Table::Text(pretty(fs_size)),
});
const auto dash_fill = Table::Fill('-');
eta.insert_row(1, vector<Table::Content>(eta.cols().size(), dash_fill));
- oss << eta;
- BEESLOGDEBUG(oss.str());
+ eta.left("");
+ eta.mid(" ");
+ eta.right("");
+
+ // One for publication through beesstats.txt and $BEESSTATUS
+ {
+ ostringstream progress_oss;
+ progress_oss << eta;
+ m_ctx->set_progress(progress_oss.str());
+ }
+
+ // One for the debug log
+ {
+ eta.left("PROGRESS: ");
+ ostringstream log_oss;
+ log_oss << eta;
+ BEESLOGINFO(log_oss.str());
+ }
}
void
shared_ptr<BeesThread> m_progress_thread;
shared_ptr<BeesThread> m_status_thread;
+ mutex m_progress_mtx;
+ string m_progress_str;
+
void set_root_fd(Fd fd);
BeesResolveAddrResult resolve_addr_uncached(BeesAddress addr);
void dump_status();
void show_progress();
+ void set_progress(const string &str);
+ string get_progress();
void start();
void stop();