Tame the Shiny profiler. Make it switchable with define SLIC3R_PROFILE.

This commit is contained in:
bubnikv 2016-11-16 23:11:51 +01:00
parent 3d47c52b47
commit 9772584d78
17 changed files with 27 additions and 89 deletions

View file

@ -28,6 +28,9 @@ THE SOFTWARE.
/*---------------------------------------------------------------------------*/
#include "ShinyMacros.h"
#ifdef SLIC3R_PROFILE
#include "ShinyManager.h"
#endif /* SLIC3R_PROFILE */
#endif /* SHINY_H */

View file

@ -28,16 +28,6 @@ THE SOFTWARE.
/*---------------------------------------------------------------------------*/
/* SHINY_IS_COMPILED is the master on or off swith at compile time. Define it to TRUE or FALSE before including header Shiny.h or inside ShinyConfig.h. Default is TRUE.
*/
#if defined(SLIC3R_PROFILE) && defined(WIN32)
#define SHINY_IS_COMPILED TRUE
#else
#define SHINY_IS_COMPILED FALSE
#endif
#define SHINY_STATIC_LINK TRUE
/* if SHINY_LOOKUP_RATE is defined to TRUE then Shiny will record the success of its hash function. This is useful for debugging. Default is FALSE.
*/
#ifndef SHINY_LOOKUP_RATE

View file

@ -25,9 +25,9 @@ THE SOFTWARE.
#ifndef SHINY_MACROS_H
#define SHINY_MACROS_H
#include "ShinyManager.h"
#ifdef SLIC3R_PROFILE
#if SHINY_IS_COMPILED == TRUE
#include "ShinyManager.h"
/*---------------------------------------------------------------------------*/
/* public preprocessors */
@ -254,18 +254,7 @@ THE SOFTWARE.
/*---------------------------------------------------------------------------*/
#else /* if SHINY_IS_COMPILED == TRUE */
#ifdef __cplusplus
extern "C" {
#endif
SHINY_INLINE ShinyData GetEmptyData() {
ShinyData a = { { 0, 0 }, { 0, 0 }, { 0, 0 } };
return a;
}
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#else /* SLIC3R_PROFILE */
#define PROFILE_UPDATE()
#define PROFILE_SET_DAMPING(x)
@ -285,13 +274,8 @@ SHINY_INLINE ShinyData GetEmptyData() {
#define PROFILE_SHARED_DEFINE(name)
#define PROFILE_SHARED_BEGIN(name)
#define PROFILE_SHARED_BLOCK(name)
#define PROFILE_GET_SHARED_DATA(name) ShinyGetEmptyData()
#define PROFILE_GET_ROOT_DATA() ShinyGetEmptyData()
#if SHINY_HAS_ENABLED == TRUE
#define PROFILE_SET_ENABLED(boolean)
#endif
#endif /* SHINY_IS_COMPILED == TRUE */
#endif /* SLIC3R_PROFILE */
#endif /* SHINY_MACROS_H */

View file

@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#if SHINY_IS_COMPILED == TRUE
#ifdef SLIC3R_PROFILE
#include "ShinyManager.h"
@ -442,4 +442,4 @@ void ShinyManager_outputToStream(ShinyManager *self, FILE *a_stream) {
#endif
}
#endif /* if SHINY_IS_COMPILED == TRUE */
#endif /* SLIC3R_PROFILE */

View file

@ -33,8 +33,6 @@ THE SOFTWARE.
#include <stdio.h>
#if SHINY_IS_COMPILED == TRUE
#ifdef __cplusplus
extern "C" {
#endif
@ -262,6 +260,4 @@ public:
};
#endif
#endif /* if SHINY_IS_COMPILED == TRUE */
#endif /* SHINY_MANAGER_H */

View file

@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#if SHINY_IS_COMPILED == TRUE
#ifdef SLIC3R_PROFILE
#include "ShinyNode.h"
#include "ShinyZone.h"
@ -126,4 +126,4 @@ void ShinyNode_enumerateNodes(const ShinyNode* a_node, void (*a_func)(const Shin
if (a_node->nextSibling) ShinyNode_enumerateNodes(a_node->nextSibling, a_func);
}
#endif
#endif /* SLIC3R_PROFILE */

View file

@ -28,8 +28,6 @@ THE SOFTWARE.
#include "ShinyData.h"
#include "ShinyTools.h"
#if SHINY_IS_COMPILED == TRUE
#ifdef __cplusplus
extern "C" {
#endif
@ -132,6 +130,4 @@ void ShinyNode_enumerateNodes(const ShinyNode* a_node, T* a_this, void (T::*a_fu
}
#endif /* __cplusplus */
#endif /* if SHINY_IS_COMPILED == TRUE */
#endif /* SHINY_NODE_H */

View file

@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#if SHINY_IS_COMPILED == TRUE
#ifdef SLIC3R_PROFILE
#include "ShinyNodePool.h"
#include "ShinyTools.h"
@ -74,4 +74,4 @@ void ShinyNodePool_destroy(ShinyNodePool *self) {
free(self);
}
#endif
#endif /* SLIC3R_PROFILE */

View file

@ -27,8 +27,6 @@ THE SOFTWARE.
#include "ShinyNode.h"
#if SHINY_IS_COMPILED == TRUE
#ifdef __cplusplus
extern "C" {
#endif
@ -66,7 +64,4 @@ uint32_t ShinyNodePool_memoryUsageChain(ShinyNodePool *first);
} /* end of extern "C" */
#endif
#endif /* if SHINY_IS_COMPILED == TRUE */
#endif /* SHINY_NODE_POOL_H */

View file

@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#if SHINY_IS_COMPILED == TRUE
#ifdef SLIC3R_PROFILE
#include "ShinyNodeState.h"
#include "ShinyNode.h"
@ -105,4 +105,4 @@ ShinyNode* ShinyNodeState_finishAndGetNextClean(ShinyNodeState *self) {
return node->nextSibling;
}
#endif
#endif /* SLIC3R_PROFILE */

View file

@ -27,8 +27,6 @@ THE SOFTWARE.
#include "ShinyNode.h"
#if SHINY_IS_COMPILED == TRUE
#ifdef __cplusplus
extern "C" {
#endif
@ -55,6 +53,4 @@ ShinyNode* ShinyNodeState_finishAndGetNextClean(ShinyNodeState *self);
} /* end of extern "C" */
#endif
#endif /* if SHINY_IS_COMPILED == TRUE */
#endif /* SHINY_NODE_STATE_H */

View file

@ -22,6 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifdef SLIC3R_PROFILE
#include "ShinyOutput.h"
#include <stdio.h>
@ -35,9 +37,6 @@ THE SOFTWARE.
# define TRAILING 1
#endif
#if SHINY_IS_COMPILED == TRUE
/*---------------------------------------------------------------------------*/
#define OUTPUT_WIDTH_CALL 6
@ -187,4 +186,4 @@ void ShinyPrintZones(char* output, const ShinyZone *a_root) {
}
}
#endif
#endif /* SLIC3R_PROFILE */

View file

@ -28,8 +28,6 @@ THE SOFTWARE.
#include "ShinyNode.h"
#include "ShinyZone.h"
#if SHINY_IS_COMPILED == TRUE
#ifdef __cplusplus
extern "C" {
#endif
@ -67,6 +65,4 @@ SHINY_INLINE std::string ShinyZonesToString(const ShinyZone *a_root, uint32_t a_
}
#endif /* __cplusplus */
#endif /* if SHINY_IS_COMPILED == TRUE */
#endif /* SHINY_OUTPUT_H */

View file

@ -86,40 +86,27 @@ extern "C" {
/*---------------------------------------------------------------------------*/
#if SHINY_IS_COMPILED == TRUE
struct _ShinyNode;
struct _ShinyZone;
typedef struct _ShinyNode* ShinyNodeCache;
typedef struct _ShinyNode* ShinyNodeTable;
#endif
struct _ShinyNode;
struct _ShinyZone;
typedef struct _ShinyNode* ShinyNodeCache;
typedef struct _ShinyNode* ShinyNodeTable;
/*---------------------------------------------------------------------------*/
#ifdef SHINY_STATIC_LINK
# define SHINY_API
#else
# define SHINY_API SHINY_EXPORT
#endif
#define SHINY_API
/*---------------------------------------------------------------------------*/
#if SHINY_COMPILER == SHINY_COMPILER_MSVC
# define SHINY_INLINE __inline
# define SHINY_UNUSED
# define SHINY_EXPORT __declspec(dllexport)
#elif SHINY_COMPILER == SHINY_COMPILER_GNUC
# define SHINY_INLINE inline
# define SHINY_UNUSED __attribute__((unused))
# define SHINY_EXPORT __attribute__((dllexport))
#elif SHINY_COMPILER == SHINY_COMPILER_OTHER
# define SHINY_INLINE inline
# define SHINY_UNUSED
# define SHINY_EXPORT extern
#endif

View file

@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#if SHINY_IS_COMPILED == TRUE
#ifdef SLIC3R_PROFILE
#include "ShinyTools.h"
@ -110,4 +110,4 @@ float ShinyGetTickInvFreq(void) {
#endif
#endif /* if SHINY_IS_COMPILED == TRUE */
#endif /* SLIC3R_PROFILE */

View file

@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#if SHINY_IS_COMPILED == TRUE
#ifdef SLIC3R_PROFILE
#include "ShinyZone.h"
@ -198,4 +198,4 @@ void ShinyZone_enumerateZones(const ShinyZone* a_zone, void (*a_func)(const Shin
if (a_zone->next) ShinyZone_enumerateZones(a_zone->next, a_func);
}
#endif
#endif /* SLIC3R_PROFILE */

View file

@ -28,8 +28,6 @@ THE SOFTWARE.
#include "ShinyData.h"
#include <memory.h>
#if SHINY_IS_COMPILED == TRUE
#ifdef __cplusplus
extern "C" {
#endif
@ -90,6 +88,4 @@ void ShinyZone_enumerateZones(const ShinyZone* a_zone, T* a_this, void (T::*a_fu
}
#endif /* __cplusplus */
#endif /* if SHINY_IS_COMPILED == TRUE */
#endif /* SHINY_ZONE_H */