mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-06 05:47:23 +08:00
ENABLE_GCODE_VIEWER_STATISTICS - Fixed calculation of time required by GCodeProcessor
This commit is contained in:
parent
a115da6334
commit
fe8e2ae0d1
@ -1213,7 +1213,7 @@ void GCodeProcessor::process_file(const std::string& filename, std::function<voi
|
|||||||
CNumericLocalesSetter locales_setter;
|
CNumericLocalesSetter locales_setter;
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
auto start_time = std::chrono::high_resolution_clock::now();
|
m_start_time = std::chrono::high_resolution_clock::now();
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
|
||||||
// pre-processing
|
// pre-processing
|
||||||
@ -1261,16 +1261,16 @@ void GCodeProcessor::process_file(const std::string& filename, std::function<voi
|
|||||||
});
|
});
|
||||||
|
|
||||||
this->finalize();
|
this->finalize();
|
||||||
|
|
||||||
// post-process to add M73 lines into the gcode
|
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
|
||||||
m_result.time = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start_time).count();
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCodeProcessor::initialize(const std::string& filename)
|
void GCodeProcessor::initialize(const std::string& filename)
|
||||||
{
|
{
|
||||||
assert(is_decimal_separator_point());
|
assert(is_decimal_separator_point());
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
m_start_time = std::chrono::high_resolution_clock::now();
|
||||||
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
|
||||||
// process gcode
|
// process gcode
|
||||||
m_result.filename = filename;
|
m_result.filename = filename;
|
||||||
m_result.id = ++s_result_id;
|
m_result.id = ++s_result_id;
|
||||||
@ -1317,6 +1317,9 @@ void GCodeProcessor::finalize()
|
|||||||
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||||
|
|
||||||
m_time_processor.post_process(m_result.filename, m_result.moves, m_result.lines_ends);
|
m_time_processor.post_process(m_result.filename, m_result.moves, m_result.lines_ends);
|
||||||
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
m_result.time = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - m_start_time).count();
|
||||||
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
}
|
}
|
||||||
|
|
||||||
float GCodeProcessor::get_time(PrintEstimatedStatistics::ETimeMode mode) const
|
float GCodeProcessor::get_time(PrintEstimatedStatistics::ETimeMode mode) const
|
||||||
|
@ -497,6 +497,9 @@ namespace Slic3r {
|
|||||||
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
#if ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
||||||
size_t m_last_default_color_id;
|
size_t m_last_default_color_id;
|
||||||
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
#endif // ENABLE_FIX_IMPORTING_COLOR_PRINT_VIEW_INTO_GCODEVIEWER
|
||||||
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
std::chrono::time_point<std::chrono::high_resolution_clock> m_start_time;
|
||||||
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
|
||||||
enum class EProducer
|
enum class EProducer
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user