hyperion.ng/include/utils/Profiler.h

38 lines
1.3 KiB
C
Raw Normal View History

add logger/compiler class (#680) * implement make install set CMAKE_INSTALL_PREFIX e.g. to /opt to install to /opt/hyperion set ENABLE_SYSTEM_INSTALL to ON to activate installation after compiling use make install or make install/strip (for performance/size optimized binaries - compile in Release to get best performance) * cleanup cmake files use cmake -DINSTALL_PREFIX=/opt/hyperion .. to install all files to hyperion or cmake -DINSTALL_PREFIX=/usr/ to install to usr. install folders are linux standard. bin go to bin folder and additionals (effects) go to share/hyperion * add uninstall target - be patient with that, this will remove files from your system install service files to share/hyperion - if you want to use them you have to make a symlink to your location of service files * optimize build release script install service files into hyperion share folder (services not activated, this must be done by distribution package script) initial support of cmake option -DPLATFORM= option. This selects platform specific cmake flags. no need for -DENABLE_... options (unless you want some special things) automatic detect for apple build * update submodule * fix cmake error when no platform is given * initial support for deb,rpm and tgz packages - no usefull content atm! * make packeages contain usefull stuff * add license make packes more functional. package specific install missing yet * implement debian postinstall * disable rpm generation until it has a working state * add hypercon compat * add posibility for multiple config files. first one found is taken * remove hyperion comaptlayer services is not started automaticly * rework debian postinstall: - remove /opt compatibility complety. This makes more trouble as it is usefull - when hyperiond already started, restart it - cleanup * add deb package dependencies * wipe out last support for /opt installation * change default effect path in config to /usr * revert service files and config files * remove last occurences of ENABLE_PROTOBUF fix cmake warnings and make it ready for cmake 3 fix refactoring of hyperiond.cpp creates no objects for network services * all arguments via reference ... * fix xbmcchecker not working * add logger class * - profiler must be activated with ENABLE_PROFILER, otherwise an error will raise -> this should prevent profiler gets into release code * fix profiler Former-commit-id: b716dd40dbf5b837356eec876d85ec71c86d5c6c
2016-06-05 16:08:55 +02:00
#include "utils/Logger.h"
#include <string>
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <map>
#ifndef ENABLE_PROFILER
#error "Profiler is not for productive code, enable it via cmake or remove header include"
#endif
// profiler
#define PROFILER_BLOCK_EXECUTION_TIME Profiler DEBUG_PROFILE__BLOCK__EXECUTION__TIME_messure_object(__FILE__, _FUNCNAME_, __LINE__ );
#define PROFILER_TIMER_START(stopWatchName) Profiler::TimerStart(stopWatchName, __FILE__, _FUNCNAME_, __LINE__);
#define PROFILER_TIMER_GET(stopWatchName) Profiler::TimerGetTime(stopWatchName, __FILE__, _FUNCNAME_, __LINE__);
#define PROFILER_TIMER_GET_IF(condition, stopWatchName) { if (condition) {Profiler::TimerGetTime(stopWatchName, __FILE__, _FUNCNAME_, __LINE__);} }
class Profiler
{
public:
Profiler(const char* sourceFile, const char* func, unsigned int line);
~Profiler();
static void TimerStart(const std::string stopWatchName, const char* sourceFile, const char* func, unsigned int line);
static void TimerGetTime(const std::string stopWatchName, const char* sourceFile, const char* func, unsigned int line);
private:
static void initLogger();
static Logger* _logger;
const char* _file;
const char* _func;
unsigned int _line;
unsigned int _blockId;
clock_t _startTime;
};