ENH: CLI: add time estimation for non-cache slicing

JIRA: XXXX
Change-Id: Ifed2d70e8d6355087694df96e413cdbcf792d6d9
This commit is contained in:
lane.wei 2023-10-07 22:15:31 +08:00 committed by Lane.Wei
parent 04552e4c9b
commit 165bb96e35
6 changed files with 29 additions and 8 deletions

View file

@ -10,6 +10,7 @@
#include "ShortestPath.hpp"
#include "SupportMaterial.hpp"
#include "Thread.hpp"
#include "Time.hpp"
#include "GCode.hpp"
#include "GCode/WipeTower.hpp"
#include "Utils.hpp"
@ -1479,8 +1480,12 @@ std::map<ObjectID, unsigned int> getObjectExtruderMap(const Print& print) {
}
// Slicing process, running at a background thread.
void Print::process(bool use_cache)
void Print::process(long long *time_cost_with_cache, bool use_cache)
{
long long start_time = 0, end_time = 0;
if (time_cost_with_cache)
*time_cost_with_cache = 0;
name_tbb_thread_pool_threads_set_locale();
//compute the PrintObject with the same geometries
@ -1680,6 +1685,9 @@ void Print::process(bool use_cache)
if (this->set_started(psSkirtBrim)) {
this->set_status(70, L("Generating skirt & brim"));
if (time_cost_with_cache)
start_time = (long long)Slic3r::Utils::get_current_time_utc();
m_skirt.clear();
m_skirt_convex_hull.clear();
m_first_layer_convex_hull.points.clear();
@ -1764,6 +1772,11 @@ void Print::process(bool use_cache)
this->finalize_first_layer_convex_hull();
this->set_done(psSkirtBrim);
if (time_cost_with_cache) {
end_time = (long long)Slic3r::Utils::get_current_time_utc();
*time_cost_with_cache = *time_cost_with_cache + end_time - start_time;
}
}
//BBS
for (PrintObject *obj : m_objects) {