Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Matena <lukasmatena@seznam.cz>2018-07-20 17:14:23 +0300
committerLukas Matena <lukasmatena@seznam.cz>2018-07-20 17:14:23 +0300
commit167060e4702609c135dae3d7943c32c108d9dd2d (patch)
tree80c16e83c3eb2f9e711083a4943cc10c72858d18
parent95bd2bb8f978a7573a68cbb0094f075f3c47d6cc (diff)
Added some profilling macros into GCodeTimeEstimator
-rw-r--r--xs/src/Shiny/ShinyPrereqs.h3
-rw-r--r--xs/src/Shiny/ShinyTools.c5
-rw-r--r--xs/src/libslic3r/GCodeTimeEstimator.cpp27
-rw-r--r--xs/src/libslic3r/PrintObject.cpp4
4 files changed, 36 insertions, 3 deletions
diff --git a/xs/src/Shiny/ShinyPrereqs.h b/xs/src/Shiny/ShinyPrereqs.h
index a392515c7..5a3044dbc 100644
--- a/xs/src/Shiny/ShinyPrereqs.h
+++ b/xs/src/Shiny/ShinyPrereqs.h
@@ -25,6 +25,9 @@ THE SOFTWARE.
#ifndef SHINY_PREREQS_H
#define SHINY_PREREQS_H
+
+#include <stdint.h>
+
/*---------------------------------------------------------------------------*/
#ifndef FALSE
diff --git a/xs/src/Shiny/ShinyTools.c b/xs/src/Shiny/ShinyTools.c
index bfc0bcdf5..4058e2285 100644
--- a/xs/src/Shiny/ShinyTools.c
+++ b/xs/src/Shiny/ShinyTools.c
@@ -93,8 +93,11 @@ float ShinyGetTickInvFreq(void) {
#elif SHINY_PLATFORM == SHINY_PLATFORM_POSIX
+//#include <time.h>
+//#include <sys/time.h>
+
void ShinyGetTicks(shinytick_t *p) {
- timeval time;
+ struct timeval time;
gettimeofday(&time, NULL);
*p = time.tv_sec * 1000000 + time.tv_usec;
diff --git a/xs/src/libslic3r/GCodeTimeEstimator.cpp b/xs/src/libslic3r/GCodeTimeEstimator.cpp
index f8360688b..5543b5cc9 100644
--- a/xs/src/libslic3r/GCodeTimeEstimator.cpp
+++ b/xs/src/libslic3r/GCodeTimeEstimator.cpp
@@ -486,6 +486,7 @@ namespace Slic3r {
GCodeFlavor GCodeTimeEstimator::get_dialect() const
{
+ PROFILE_FUNC();
return _state.dialect;
}
@@ -536,6 +537,7 @@ namespace Slic3r {
void GCodeTimeEstimator::add_additional_time(float timeSec)
{
+ PROFILE_FUNC();
_state.additional_time += timeSec;
}
@@ -627,8 +629,10 @@ namespace Slic3r {
_blocks.clear();
}
+
void GCodeTimeEstimator::_calculate_time()
{
+ PROFILE_FUNC();
_forward_pass();
_reverse_pass();
_recalculate_trapezoids();
@@ -797,6 +801,7 @@ namespace Slic3r {
void GCodeTimeEstimator::_processG1(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
increment_g1_line_id();
// updates axes positions from line
@@ -994,6 +999,7 @@ namespace Slic3r {
void GCodeTimeEstimator::_processG4(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
GCodeFlavor dialect = get_dialect();
float value;
@@ -1015,31 +1021,37 @@ namespace Slic3r {
void GCodeTimeEstimator::_processG20(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
set_units(Inches);
}
void GCodeTimeEstimator::_processG21(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
set_units(Millimeters);
}
void GCodeTimeEstimator::_processG28(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
// TODO
}
void GCodeTimeEstimator::_processG90(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
set_global_positioning_type(Absolute);
}
void GCodeTimeEstimator::_processG91(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
set_global_positioning_type(Relative);
}
void GCodeTimeEstimator::_processG92(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
float lengthsScaleFactor = (get_units() == Inches) ? INCHES_TO_MM : 1.0f;
bool anyFound = false;
@@ -1080,26 +1092,31 @@ namespace Slic3r {
void GCodeTimeEstimator::_processM1(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
_simulate_st_synchronize();
}
void GCodeTimeEstimator::_processM82(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
set_e_local_positioning_type(Absolute);
}
void GCodeTimeEstimator::_processM83(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
set_e_local_positioning_type(Relative);
}
void GCodeTimeEstimator::_processM109(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
// TODO
}
void GCodeTimeEstimator::_processM201(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
GCodeFlavor dialect = get_dialect();
// see http://reprap.org/wiki/G-code#M201:_Set_max_printing_acceleration
@@ -1120,6 +1137,7 @@ namespace Slic3r {
void GCodeTimeEstimator::_processM203(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
GCodeFlavor dialect = get_dialect();
// see http://reprap.org/wiki/G-code#M203:_Set_maximum_feedrate
@@ -1144,6 +1162,7 @@ namespace Slic3r {
void GCodeTimeEstimator::_processM204(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
float value;
if (line.has_value('S', value))
set_acceleration(value);
@@ -1154,6 +1173,7 @@ namespace Slic3r {
void GCodeTimeEstimator::_processM205(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
if (line.has_x())
{
float max_jerk = line.x();
@@ -1180,6 +1200,7 @@ namespace Slic3r {
void GCodeTimeEstimator::_processM221(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
float value_s;
float value_t;
if (line.has_value('S', value_s) && !line.has_value('T', value_t))
@@ -1188,6 +1209,7 @@ namespace Slic3r {
void GCodeTimeEstimator::_processM566(const GCodeReader::GCodeLine& line)
{
+ PROFILE_FUNC();
if (line.has_x())
set_axis_max_jerk(X, line.x() * MMMIN_TO_MMSEC);
@@ -1203,11 +1225,13 @@ namespace Slic3r {
void GCodeTimeEstimator::_simulate_st_synchronize()
{
+ PROFILE_FUNC();
_calculate_time();
}
void GCodeTimeEstimator::_forward_pass()
{
+ PROFILE_FUNC();
if (_blocks.size() > 1)
{
for (int i = _last_st_synchronized_block_id + 1; i < (int)_blocks.size() - 1; ++i)
@@ -1219,6 +1243,7 @@ namespace Slic3r {
void GCodeTimeEstimator::_reverse_pass()
{
+ PROFILE_FUNC();
if (_blocks.size() > 1)
{
for (int i = (int)_blocks.size() - 1; i >= _last_st_synchronized_block_id + 2; --i)
@@ -1230,6 +1255,7 @@ namespace Slic3r {
void GCodeTimeEstimator::_planner_forward_pass_kernel(Block& prev, Block& curr)
{
+ PROFILE_FUNC();
// If the previous block is an acceleration block, but it is not long enough to complete the
// full speed change within the block, we need to adjust the entry speed accordingly. Entry
// speeds have already been reset, maximized, and reverse planned by reverse planner.
@@ -1270,6 +1296,7 @@ namespace Slic3r {
void GCodeTimeEstimator::_recalculate_trapezoids()
{
+ PROFILE_FUNC();
Block* curr = nullptr;
Block* next = nullptr;
diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp
index 8888da76d..47495dad8 100644
--- a/xs/src/libslic3r/PrintObject.cpp
+++ b/xs/src/libslic3r/PrintObject.cpp
@@ -1183,8 +1183,8 @@ void PrintObject::_slice()
this->typed_slices = false;
-#if 0
- // Disable parallelization for debugging purposes.
+#ifdef SLIC3R_PROFILE
+ // Disable parallelization so the Shiny profiler works
static tbb::task_scheduler_init *tbb_init = nullptr;
tbb_init = new tbb::task_scheduler_init(1);
#endif