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:
authorbubnikv <bubnikv@gmail.com>2020-08-27 13:14:49 +0300
committerbubnikv <bubnikv@gmail.com>2020-08-27 13:14:49 +0300
commit17170b81b51dfd7a99d1f3ef7f7d9038bf3502c0 (patch)
tree3b86454e4fdd303201ee67891173ea9854d6f675 /src/libslic3r
parent41f474a884bdad01b973cd6bb734cea3a31384fc (diff)
Clean-up of Shiny profiler integration, so that the intrusiver profiling
can be controlled per module.
Diffstat (limited to 'src/libslic3r')
-rw-r--r--src/libslic3r/ClipperUtils.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/libslic3r/ClipperUtils.cpp b/src/libslic3r/ClipperUtils.cpp
index d40d79b3d..16d985e9c 100644
--- a/src/libslic3r/ClipperUtils.cpp
+++ b/src/libslic3r/ClipperUtils.cpp
@@ -8,7 +8,16 @@
#include "SVG.hpp"
#endif /* CLIPPER_UTILS_DEBUG */
-#include <Shiny/Shiny.h>
+// Profiling support using the Shiny intrusive profiler
+//#define CLIPPER_UTILS_PROFILE
+#if defined(SLIC3R_PROFILE) && defined(CLIPPER_UTILS_PROFILE)
+ #include <Shiny/Shiny.h>
+ #define CLIPPERUTILS_PROFILE_FUNC() PROFILE_FUNC()
+ #define CLIPPERUTILS_PROFILE_BLOCK(name) PROFILE_BLOCK(name)
+#else
+ #define CLIPPERUTILS_PROFILE_FUNC()
+ #define CLIPPERUTILS_PROFILE_BLOCK(name)
+#endif
#define CLIPPER_OFFSET_SHORTEST_EDGE_FACTOR (0.005f)
@@ -50,7 +59,7 @@ err:
void scaleClipperPolygon(ClipperLib::Path &polygon)
{
- PROFILE_FUNC();
+ CLIPPERUTILS_PROFILE_FUNC();
for (ClipperLib::Path::iterator pit = polygon.begin(); pit != polygon.end(); ++pit) {
pit->X <<= CLIPPER_OFFSET_POWER_OF_2;
pit->Y <<= CLIPPER_OFFSET_POWER_OF_2;
@@ -59,7 +68,7 @@ void scaleClipperPolygon(ClipperLib::Path &polygon)
void scaleClipperPolygons(ClipperLib::Paths &polygons)
{
- PROFILE_FUNC();
+ CLIPPERUTILS_PROFILE_FUNC();
for (ClipperLib::Paths::iterator it = polygons.begin(); it != polygons.end(); ++it)
for (ClipperLib::Path::iterator pit = (*it).begin(); pit != (*it).end(); ++pit) {
pit->X <<= CLIPPER_OFFSET_POWER_OF_2;
@@ -69,7 +78,7 @@ void scaleClipperPolygons(ClipperLib::Paths &polygons)
void unscaleClipperPolygon(ClipperLib::Path &polygon)
{
- PROFILE_FUNC();
+ CLIPPERUTILS_PROFILE_FUNC();
for (ClipperLib::Path::iterator pit = polygon.begin(); pit != polygon.end(); ++pit) {
pit->X += CLIPPER_OFFSET_SCALE_ROUNDING_DELTA;
pit->Y += CLIPPER_OFFSET_SCALE_ROUNDING_DELTA;
@@ -80,7 +89,7 @@ void unscaleClipperPolygon(ClipperLib::Path &polygon)
void unscaleClipperPolygons(ClipperLib::Paths &polygons)
{
- PROFILE_FUNC();
+ CLIPPERUTILS_PROFILE_FUNC();
for (ClipperLib::Paths::iterator it = polygons.begin(); it != polygons.end(); ++it)
for (ClipperLib::Path::iterator pit = (*it).begin(); pit != (*it).end(); ++pit) {
pit->X += CLIPPER_OFFSET_SCALE_ROUNDING_DELTA;
@@ -790,7 +799,7 @@ ExPolygons simplify_polygons_ex(const Polygons &subject, bool preserve_collinear
void safety_offset(ClipperLib::Paths* paths)
{
- PROFILE_FUNC();
+ CLIPPERUTILS_PROFILE_FUNC();
// scale input
scaleClipperPolygons(*paths);
@@ -812,11 +821,11 @@ void safety_offset(ClipperLib::Paths* paths)
if (! ccw)
std::reverse(path.begin(), path.end());
{
- PROFILE_BLOCK(safety_offset_AddPaths);
+ CLIPPERUTILS_PROFILE_BLOCK(safety_offset_AddPaths);
co.AddPath((*paths)[i], ClipperLib::jtMiter, ClipperLib::etClosedPolygon);
}
{
- PROFILE_BLOCK(safety_offset_Execute);
+ CLIPPERUTILS_PROFILE_BLOCK(safety_offset_Execute);
// offset outside by 10um
ClipperLib::Paths out_this;
co.Execute(out_this, ccw ? 10.f * float(CLIPPER_OFFSET_SCALE) : -10.f * float(CLIPPER_OFFSET_SCALE));