From aa55edf5a7cf3413bf1720fe406cf026cde3ee1e Mon Sep 17 00:00:00 2001 From: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com> Date: Wed, 17 Jun 2020 20:59:26 +0200 Subject: [PATCH] Reset/V4L2/Systemd/rpi_ws281x/Profiler (#820) --- .gitmodules | 4 ++-- cmake/debian/postinst | 2 +- dependencies/external/rpi_ws281x | 2 +- include/utils/Profiler.h | 26 +++++++++++++++++++++----- libsrc/grabber/v4l2/V4L2Grabber.cpp | 12 ++---------- src/hyperiond/main.cpp | 15 +++++++++++++++ 6 files changed, 42 insertions(+), 19 deletions(-) diff --git a/.gitmodules b/.gitmodules index 31ddf173..0d5749f6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "dependencies/external/rpi_ws281x"] path = dependencies/external/rpi_ws281x - url = https://github.com/hyperion-project/rpi_ws281x.git + url = https://github.com/jgarff/rpi_ws281x branch = master [submodule "dependencies/external/flatbuffers"] path = dependencies/external/flatbuffers @@ -9,4 +9,4 @@ [submodule "dependencies/external/protobuf"] path = dependencies/external/protobuf url = https://github.com/hyperion-project/protobuf.git - branch = master + branch = master \ No newline at end of file diff --git a/cmake/debian/postinst b/cmake/debian/postinst index 9c090cf1..1b9131ae 100644 --- a/cmake/debian/postinst +++ b/cmake/debian/postinst @@ -19,7 +19,7 @@ install_file() echo "---Hyperion ambient light postinstall ---" #check system -CPU_RPI=`grep -m1 -c 'BCM2708\|BCM2709\|BCM2710\|BCM2835' /proc/cpuinfo` +CPU_RPI=`grep -m1 -c 'BCM2708\|BCM2709\|BCM2710\|BCM2835\|BCM2836\|BCM2837\|BCM2711' /proc/cpuinfo` CPU_X32X64=`uname -m | grep 'x86_32\|i686\|x86_64' | wc -l` #Check for a bootloader as Berryboot diff --git a/dependencies/external/rpi_ws281x b/dependencies/external/rpi_ws281x index 68c6da2d..6a720cbd 160000 --- a/dependencies/external/rpi_ws281x +++ b/dependencies/external/rpi_ws281x @@ -1 +1 @@ -Subproject commit 68c6da2de32249d126264a363cc5ab788c87cc8b +Subproject commit 6a720cbd42d30be28e0f5c5ff6b1c00a4588a29b diff --git a/include/utils/Profiler.h b/include/utils/Profiler.h index ba930e58..118c9aa6 100644 --- a/include/utils/Profiler.h +++ b/include/utils/Profiler.h @@ -5,15 +5,30 @@ #include #include +/* +The performance (real time) of any function can be tested with the help of profiler. +The determined times are determined using clock cycles. + +To do this, compile with the cmake option: -DENABLE_PROFILER=ON +This header file (utils/Profiler.h) must be included in the respective file that contains the function to be measured + +The start time is set in a function with the following instructions: +PROFILER_TIMER_START("test_performance") +The end point is set as follows: +PROFILER_TIMER_GET("test_performance") + +For more profiler function see the macros listed below +*/ + #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__);} } +#define PROFILER_BLOCK_EXECUTION_TIME Profiler DEBUG_PROFILE__BLOCK__EXECUTION__TIME_messure_object(__FILE__, __FUNCTION__, __LINE__ ); +#define PROFILER_TIMER_START(stopWatchName) Profiler::TimerStart(stopWatchName, __FILE__, __FUNCTION__, __LINE__); +#define PROFILER_TIMER_GET(stopWatchName) Profiler::TimerGetTime(stopWatchName, __FILE__, __FUNCTION__, __LINE__); +#define PROFILER_TIMER_GET_IF(condition, stopWatchName) { if (condition) {Profiler::TimerGetTime(stopWatchName, __FILE__, __FUNCTION__, __LINE__);} } class Profiler @@ -27,7 +42,7 @@ public: private: static void initLogger(); - + static Logger* _logger; const char* _file; const char* _func; @@ -35,3 +50,4 @@ private: unsigned int _blockId; clock_t _startTime; }; + diff --git a/libsrc/grabber/v4l2/V4L2Grabber.cpp b/libsrc/grabber/v4l2/V4L2Grabber.cpp index fb9ec96e..0cfd9dfb 100644 --- a/libsrc/grabber/v4l2/V4L2Grabber.cpp +++ b/libsrc/grabber/v4l2/V4L2Grabber.cpp @@ -248,16 +248,8 @@ void V4L2Grabber::getV4Ldevices() break; case V4L2_FRMSIZE_TYPE_CONTINUOUS: case V4L2_FRMSIZE_TYPE_STEPWISE: - { - for(unsigned int y = frmsizeenum.stepwise.min_height; y <= frmsizeenum.stepwise.max_height; y += frmsizeenum.stepwise.step_height) - { - for(unsigned int x = frmsizeenum.stepwise.min_width; x <= frmsizeenum.stepwise.max_width; x += frmsizeenum.stepwise.step_width) - { - properties.resolutions << QString::number(x) + "x" + QString::number(y); - enumFrameIntervals(properties.framerates, fd, fmt.fmt.pix.pixelformat, x, y); - } - } - } + // We do not take care of V4L2_FRMSIZE_TYPE_CONTINUOUS or V4L2_FRMSIZE_TYPE_STEPWISE + break; } frmsizeenum.index++; } diff --git a/src/hyperiond/main.cpp b/src/hyperiond/main.cpp index 6da2b2a0..e09cca0c 100644 --- a/src/hyperiond/main.cpp +++ b/src/hyperiond/main.cpp @@ -192,6 +192,7 @@ int main(int argc, char** argv) BooleanOption & versionOption = parser.add (0x0, "version", "Show version information"); Option & userDataOption = parser.add