mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Reset/V4L2/Systemd/rpi_ws281x/Profiler (#820)
This commit is contained in:
parent
756247aa1e
commit
aa55edf5a7
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -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
|
@ -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
|
||||
|
2
dependencies/external/rpi_ws281x
vendored
2
dependencies/external/rpi_ws281x
vendored
@ -1 +1 @@
|
||||
Subproject commit 68c6da2de32249d126264a363cc5ab788c87cc8b
|
||||
Subproject commit 6a720cbd42d30be28e0f5c5ff6b1c00a4588a29b
|
@ -5,15 +5,30 @@
|
||||
#include <utils/Logger.h>
|
||||
#include <HyperionConfig.h>
|
||||
|
||||
/*
|
||||
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;
|
||||
};
|
||||
|
||||
|
@ -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++;
|
||||
}
|
||||
|
@ -192,6 +192,7 @@ int main(int argc, char** argv)
|
||||
BooleanOption & versionOption = parser.add<BooleanOption> (0x0, "version", "Show version information");
|
||||
Option & userDataOption = parser.add<Option> ('u', "userdata", "Overwrite user data path, defaults to home directory of current user (%1)", QDir::homePath() + "/.hyperion");
|
||||
BooleanOption & resetPassword = parser.add<BooleanOption> (0x0, "resetPassword", "Lost your password? Reset it with this option back to 'hyperion'");
|
||||
BooleanOption & deleteDB = parser.add<BooleanOption> (0x0, "deleteDatabase", "Start all over? This Option will delete the database");
|
||||
BooleanOption & silentOption = parser.add<BooleanOption> ('s', "silent", "do not print any outputs");
|
||||
BooleanOption & verboseOption = parser.add<BooleanOption> ('v', "verbose", "Increase verbosity");
|
||||
BooleanOption & debugOption = parser.add<BooleanOption> ('d', "debug", "Show debug messages");
|
||||
@ -300,6 +301,20 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
// delete database before start
|
||||
if(parser.isSet(deleteDB))
|
||||
{
|
||||
QString dbFile = mDir.absolutePath() + "/db/hyperion.db";
|
||||
if (QFile::exists(dbFile))
|
||||
{
|
||||
if (!QFile::remove(dbFile))
|
||||
{
|
||||
Info(log,"Failed to delete Database!");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HyperionDaemon* hyperiond = nullptr;
|
||||
try
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user