mirror of
				https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
				synced 2023-10-19 15:58:31 +00:00 
			
		
		
		
	call drawdevices only every 500ms, added profiling code
This commit is contained in:
		
							
								
								
									
										5
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								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) | ||||
|   | ||||
| @@ -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(); | ||||
|         if (initial || cTimeMs::Now() - devicesLast  > 500) { | ||||
|             channelView->DrawDevices(initial); | ||||
|             devicesLast = cTimeMs::Now(); | ||||
|         } | ||||
|     } else { | ||||
|         channelView->ClearStatusIcons(); | ||||
|         channelView->ClearScreenResolution(); | ||||
|   | ||||
| @@ -18,6 +18,7 @@ private: | ||||
|     int lastSignalQuality; | ||||
|     int lastScreenWidth; | ||||
|     int currentLast; | ||||
|     uint64_t devicesLast; | ||||
|     const cEvent *present; | ||||
|     void SetProgressBar(const cEvent *present); | ||||
| public: | ||||
|   | ||||
| @@ -167,9 +167,12 @@ vector<string>& 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) { | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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)) | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| #include <vdr/menu.h> | ||||
| #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<string,int> *intTokens, vector<map<string,string> > *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<string,int> *intTokens, vector<m | ||||
|             if (!device || !device->NumProvidedSystems()) { | ||||
|                 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<string,int> *intTokens, vector<m | ||||
|         else | ||||
|             deviceLiveTV = primaryDevice->DeviceNumber(); | ||||
|     } | ||||
|  | ||||
|     //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<string,int> *intTokens, vector<m | ||||
|             deviceVals.insert(pair< string, string >("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<string,int> *intTokens, vector<m | ||||
|     } | ||||
|  | ||||
|     intTokens->insert(pair<string, int>("numdevices", actualNumDevices)); | ||||
|      | ||||
| #ifdef DOPROFILE | ||||
|     watch.Stop("SetDevices End"); | ||||
| #endif | ||||
|     return true; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user