diff --git a/Makefile b/Makefile index 2be7976..620c7fa 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,9 @@ # External image lib to use: imagemagick, graphicsmagick IMAGELIB = imagemagick +# Config +CONFIG := #-DDOPROFILE # enable profiling code + # The official name of this plugin. PLUGIN = skindesigner @@ -42,7 +45,7 @@ PACKAGE = vdr-$(ARCHIVE) SOFILE = libvdr-$(PLUGIN).so ### Includes and Defines and Dependencies: -DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' $(CONFIG) DEFINES += $(shell xml2-config --cflags) INCLUDES += $(shell pkg-config --cflags freetype2 fontconfig) diff --git a/displaychannel.c b/displaychannel.c index 607679b..d26e991 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -18,6 +18,7 @@ cSDDisplayChannel::cSDDisplayChannel(cTemplate *channelTemplate, bool WithInfo) currentLast = 0; channelChange = false; initial = true; + devicesLast = cTimeMs::Now(); channelView = new cDisplayChannelView(channelTemplate->GetRootView()); if (!channelView->createOsd()) { @@ -185,7 +186,10 @@ void cSDDisplayChannel::Flush(void) { channelView->DrawScreenResolution(); channelView->DrawSignal(); channelView->DrawAudioInfo(); - channelView->DrawDevices(initial); + if (initial || cTimeMs::Now() - devicesLast > 500) { + channelView->DrawDevices(initial); + devicesLast = cTimeMs::Now(); + } } else { channelView->ClearStatusIcons(); channelView->ClearScreenResolution(); diff --git a/displaychannel.h b/displaychannel.h index 75888fd..12c6922 100644 --- a/displaychannel.h +++ b/displaychannel.h @@ -18,6 +18,7 @@ private: int lastSignalQuality; int lastScreenWidth; int currentLast; + uint64_t devicesLast; const cEvent *present; void SetProgressBar(const cEvent *present); public: diff --git a/libcore/helpers.c b/libcore/helpers.c index 4ca2272..4da97f7 100644 --- a/libcore/helpers.c +++ b/libcore/helpers.c @@ -167,9 +167,12 @@ vector& splitstring::split(char delim, int rep) { return flds; } -cStopWatch::cStopWatch(void) { +cStopWatch::cStopWatch(const char* message) { start = cTimeMs::Now(); last = start; + if (message) { + dsyslog("skindesigner: Starting StopWatch %s", message); + } } void cStopWatch::Report(const char* message) { diff --git a/libcore/helpers.h b/libcore/helpers.h index 2a92efb..abfae6d 100644 --- a/libcore/helpers.h +++ b/libcore/helpers.h @@ -33,7 +33,7 @@ private: uint64_t start; uint64_t last; public: - cStopWatch(void); + cStopWatch(const char* message = NULL); ~cStopWatch(void) {}; void Report(const char* message); void Stop(const char* message); diff --git a/views/displaychannelview.c b/views/displaychannelview.c index 28b2f9d..6187753 100644 --- a/views/displaychannelview.c +++ b/views/displaychannelview.c @@ -364,8 +364,18 @@ void cDisplayChannelView::DrawSignal(void) { } time_t Now = time(NULL); if (Now != lastSignalDisplay) { +#ifdef DOPROFILE + cStopWatch watch("DrawSignal"); +#endif int SignalStrength = cDevice::ActualDevice()->SignalStrength(); +#ifdef DOPROFILE + watch.Report("SignalStrength"); +#endif int SignalQuality = cDevice::ActualDevice()->SignalQuality(); +#ifdef DOPROFILE + watch.Report("SignalQuality"); + watch.Stop("DrawSignal"); +#endif if (SignalStrength < 0) SignalStrength = 0; if (SignalQuality < 0) SignalQuality = 0; if ((SignalStrength == 0)&&(SignalQuality==0)) diff --git a/views/viewhelpers.c b/views/viewhelpers.c index 00a5619..29c139d 100644 --- a/views/viewhelpers.c +++ b/views/viewhelpers.c @@ -1,5 +1,6 @@ #include #include "../config.h" +#include "../libcore/helpers.h" #include "viewhelpers.h" cViewHelpers::cViewHelpers(void) { @@ -28,6 +29,9 @@ void cViewHelpers::InitDevices(void) { } bool cViewHelpers::SetDevices(bool initial, map *intTokens, vector > *devices) { +#ifdef DOPROFILE + cStopWatch watch("SetDevices"); +#endif int numDevices = cDevice::NumDevices(); if (!initial) { //check if drawing is necessary @@ -37,12 +41,24 @@ bool cViewHelpers::SetDevices(bool initial, map *intTokens, vectorNumProvidedSystems()) { continue; } - if ((device->SignalStrength() != lastSignalStrength[i]) || (device->SignalQuality() != lastSignalQuality[i])) { + int signalStrength = device->SignalStrength(); +#ifdef DOPROFILE + watch.Report(*cString::sprintf("SignalStrength() device %d", i)); +#endif + int signalQuality = device->SignalQuality(); +#ifdef DOPROFILE + watch.Report(*cString::sprintf("SignalQuality() device %d", i)); +#endif + + if ((signalStrength != lastSignalStrength[i]) || (signalQuality != lastSignalQuality[i])) { changed = true; break; - } + } } if (!changed) { +#ifdef DOPROFILE + watch.Stop("SetDevices End"); +#endif return false; } } @@ -55,7 +71,6 @@ bool cViewHelpers::SetDevices(bool initial, map *intTokens, vectorDeviceNumber(); } - //check currently recording devices for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) { if (!timer->Recording()) { @@ -90,7 +105,13 @@ bool cViewHelpers::SetDevices(bool initial, map *intTokens, vector("devices[hascam]", "0")); } int signalStrength = device->SignalStrength(); +#ifdef DOPROFILE + watch.Report(*cString::sprintf("SignalStrength() device %d", i)); +#endif int signalQuality = device->SignalQuality(); +#ifdef DOPROFILE + watch.Report(*cString::sprintf("SignalQuality() device %d", i)); +#endif stringstream strCamNumber; strCamNumber << camNumber; deviceVals.insert(pair< string, string >("devices[cam]", strCamNumber.str())); @@ -129,6 +150,8 @@ bool cViewHelpers::SetDevices(bool initial, map *intTokens, vectorinsert(pair("numdevices", actualNumDevices)); - +#ifdef DOPROFILE + watch.Stop("SetDevices End"); +#endif return true; }