Re: [vdr] [PATCH] Device power saving feature
On 1/06/2016 03:49, glenvt18 wrote: > >From what I can see, everything works as expected. You can safely lessen > the power-down timeout to 3 minutes. This will be enough for EPG scan as > you have at most 8 transponders/multiplexes which gives 8 * 1/3 = 2m40s > - see 'EIT scan ...' messages. I reduced it to 5 mins to give it some margin > As for those small intervals of activity you mentioned, it happens > because some 'preparation' work is done before a timer starts. VDR > tries to switch to the timer's transponder and gather EPG data. For a > VPS timer this begins within VPS margin and an hour before the timer > start time. For a non-VPS timer it begins one minute before the timer > start time. I've added 30 seconds to the occupied timeout (see my > cDevice::SetOccupied() comment) to avoid frequent on/off switching. So, > you're likely to see 38-second (or, sometimes, a bit more) periods of > activity. If you still worry about it, keep you server idle for 2 hours > before a nearest VPS timer starts and paste the log. OK, I'll keep an eye on it. No adverse effects yet - good work, thanks. I'm doing some other testing and stuff atm so want to keep the server up - I'll possibly take it down at the weekend, make some power measurements and post them > I've removed 'sudo' from the monitor script: > http://pastebin.com/8JDffAXF > > Run it as user 'vdr' for some time. It will draw you a nice 'map' of > your devices' activity. > > If you notice channel switch failures, let me know. > > Do your tuners get warm when active? Yes, the TV tuners always did run warm, and I recall that when VDR is stopped the power is several watts lower (not because of VDR/CPU load itself according to stats, it's when the tuners go active - hence my interest in your patch). As the server also runs the home automation/lights/heating/security, CCTV, mail server, and file storage/Owncloud it's not an option to shut it down when not recording, and I have t choose when to take it down ! Richard > > Thanks again for testing. > > Best, > Sergey Chernyavskiy. > > On Tue, May 31, 2016 at 08:43:01PM +0100, Richard F wrote: >> OK Sergey, I've posted a log with your patch applied + log level 3 - >> about 3 hours worth There was a recording 16:15 to 16:45, other than >> that idle I can run it for longer if you need it, though it's creating >> a fair bit of log. I seem to get a lot of erroneous EPGsearch results >> at level 3, not sure why. http://pastebin.com/8DbYQdTX >> >> Let me know what it tells you Thanks Richard >> >> >> On 30/05/2016 15:19, glenvt18 wrote: >>> Could you attach (or, better, upload to pastebin.com) the whole log >>> file. Are you running vdr with --log=3? I need to see 'idle timer' >>> debug messages and some other debug stuff. Could you also apply this >>> change >>> >>> diff --git a/eitscan.c b/eitscan.c index 3899e00..b1c8c13 100644 --- >>> a/eitscan.c +++ b/eitscan.c @@ -159,7 +159,7 @@ void >>> cEITScanner::Process(void) Skins.Message(mtInfo, tr("Starting EPG >>> scan")); } } - //dsyslog("EIT >>> scan: device %d source %-8s tp %5d", Device->DeviceNumber() + 1, >>> *cSource::ToString(Channel->Source()), Channel->Transponder()); + >>> dsyslog("EIT scan: device %d source %-8s tp %5d", >>> Device->DeviceNumber() + 1, *cSource::ToString(Channel->Source()), >>> Channel->Transponder()); if (lastActivity == 0) // forced scan - set >>> idle timer for each channel switch; // this prevents powering down >>> while scanning a transponder -- >>> >>> Thanks for testing. >>> >>> Best, Sergey Chernyavskiy. >> >> >> ___ vdr mailing list >> vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr > ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Device power saving feature
> I agree with you. I hope, dynamite was a little inspiration for you. :) Yes, I used it for some time. Thanks a lot for your work, Lars! > I plan (for several years now, sadly) to break out the udev-part of dynamite > to make the vdr more dynamic in device > management. The idle-part is a good first step in that direction. I remember I've read somewhere (may be at vdr-portal.de) that you had plans to re-work the dynamite plugin and implement the idle part separately. > > + virtual void PowerDown(bool On) {}; + ///< Actually powers > > the device down/up. > > I think the name of the parameter is a bit misleading. With On == > true you mean, that the device is powered down. Either rename the > parameter to "Down" or the function to something like > "PowerSaveMode". Well, it's a matter of style. "On" is a typical VDR name for such arguments. "Down" looks good as well as "PowerSaveMode" or "PowerDownMode". I'll consider this change. Thanks. Best, Sergey Chernyavskiy. ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Device power saving feature
Hi, Am 26.05.2016 um 17:36 schrieb glenvt18: > I know about the dynamite plugin, but 1) it does much more then this, 2) > still requires a VDR patch, which is bigger, 3) doesn't work reliably > for me and 4) I think this functionality should be part of the VDR > core. I agree with you. I hope, dynamite was a little inspiration for you. :) I plan (for several years now, sadly) to break out the udev-part of dynamite to make the vdr more dynamic in device management. The idle-part is a good first step in that direction. > + virtual void PowerDown(bool On) {}; > + ///< Actually powers the device down/up. I think the name of the parameter is a bit misleading. With On == true you mean, that the device is powered down. Either rename the parameter to "Down" or the function to something like "PowerSaveMode". Lars. ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Device power saving feature
OK Sergey, I've posted a log with your patch applied + log level 3 - about 3 hours worth There was a recording 16:15 to 16:45, other than that idle I can run it for longer if you need it, though it's creating a fair bit of log. I seem to get a lot of erroneous EPGsearch results at level 3, not sure why. http://pastebin.com/8DbYQdTX Let me know what it tells you Thanks Richard On 30/05/2016 15:19, glenvt18 wrote: > Could you attach (or, better, upload to pastebin.com) the whole log > file. Are you running vdr with --log=3? I need to see 'idle timer' debug > messages and some other debug stuff. Could you also apply this change > > diff --git a/eitscan.c b/eitscan.c > index 3899e00..b1c8c13 100644 > --- a/eitscan.c > +++ b/eitscan.c > @@ -159,7 +159,7 @@ void cEITScanner::Process(void) > Skins.Message(mtInfo, > tr("Starting EPG scan")); > } > } > - //dsyslog("EIT scan: device %d source > %-8s tp %5d", Device->DeviceNumber() + 1, > *cSource::ToString(Channel->Source()), Channel->Transponder()); > + dsyslog("EIT scan: device %d source > %-8s tp %5d", Device->DeviceNumber() + 1, > *cSource::ToString(Channel->Source()), Channel->Transponder()); > if (lastActivity == 0) > // forced scan - set idle timer for > each channel switch; > // this prevents powering down while > scanning a transponder > -- > > Thanks for testing. > > Best, > Sergey Chernyavskiy. ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Device power saving feature
Thanks - I built it and and have had it running for about 24 hours: A couple of observations: I'm seeing this about every 30 - 60 mins as expected, but the timeout seems to be short - not the PowerdownTimeoutM (I assume minutes?) set at 15 in the config file May 30 08:51:02 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 1/0 May 30 08:51:46 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 1/0 So during the start of recordings and other programme changes, I see quite a lot of activity - e.g May 29 15:32:32 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 1/0 May 29 15:32:36 ha-server vdr: [2306] channel 41 (Channel 4 HD) event Sun 29.05.2016 15:25-16:30 (VPS: 29.05. 15:25) 'Location, Location, Location' status 4 May 29 15:32:37 ha-server vdr: [2306] channel 4 (BBC TWO HD) event Sun 29.05.2016 15:30-18:00 (VPS: 29.05. 15:30) 'Gymnastics' status 4 May 29 15:33:17 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 1/0 May 29 15:33:38 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 1/0 May 29 15:33:41 ha-server vdr: [2306] channel 45 (Film4) event Sun 29.05.2016 15:05-16:50 (VPS: 29.05. 15:05) 'Catch That Kid' status 4 May 29 15:33:42 ha-server vdr: [2306] channel 40 (Channel 4) event Sun 29.05.2016 15:25-16:30 (VPS: 29.05. 15:25) 'Location, Location, Location' status 4 May 29 15:34:23 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 1/0 Start of (VPS) recording: May 29 19:50:07 ha-server vdr: [2296] timer 2 (3 2000-2100 VPS 'Top Gear~2016.05.29-20:00-Sun') entered VPS margin May 29 19:50:07 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 0/0 May 29 19:50:08 ha-server vdr: [2303] channel 3 (BBC TWO) event Sun 29.05.2016 19:00-20:00 (VPS: 29.05. 19:00) 'Rugby Union' status 4 May 29 19:50:09 ha-server vdr: [2303] channel 7 (BBC NEWS) event Sun 29.05.2016 19:45-20:00 (VPS: 29.05. 19:45) 'Meet The Author' status 4 May 29 19:50:46 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 0/0 May 29 19:50:51 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 0/0 May 29 19:51:30 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 0/0 May 29 19:51:35 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 0/0 May 29 19:52:14 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 0/0 May 29 19:52:19 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 0/0 May 29 19:52:58 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 0/0 May 29 19:53:03 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 0/0 May 29 19:53:42 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 0/0 May 29 19:53:47 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 0/0 May 29 19:54:26 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 0/0 May 29 19:54:31 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 0/0 May 29 19:55:10 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 0/0 May 29 19:55:15 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 0/0 May 29 19:55:54 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 0/0 May 29 19:55:59 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 0/0 May 29 19:56:38 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 0/0 May 29 19:56:43 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 0/0 May 29 19:57:22 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 0/0 May 29 19:57:27 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 0/0 May 29 19:58:06 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 0/0 May 29 19:58:11 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 0/0 May 29 19:58:50 ha-server vdr: [2296] dvb tuner: power-down - closing frontend 0/0 May 29 19:58:55 ha-server vdr: [2296] dvb tuner: power-up - opening frontend 0/0 May 29 19:59:10 ha-server vdr: [2306] channel 61 (Channel 5 HD) event Sun 29.05.2016 20:00-21:00 (VPS: 29.05. 20:00) 'Secrets of Egypt' status 4 May 29 19:59:11 ha-server vdr: [2296] timer 1 (61 1900-2000 VPS 'Cricket on 5~England v Sri Lanka: Second Test Day Thr') stop I haven't had a chance to take the server down to insert the power monitor yet, but will do so at convenient time in the next few days Thanks Richard On 27/05/2016 14:51, glenvt18 wrote: > Yes, sure. The patch against VDR-2.2.0: > http://pastebin.com/D4VQd1rG > > While testing set VDR log level to 3 (--log=3) and use this helper > script to monitor your frontends: > http://pastebin.com/uW4NW0rZ > > Don't forget to enable power saving in the Setup->LNB menu. > > If you don't have sudo (you're not on Debian or Ubuntu), remove it and > run the script as root. It would be great if you could measure the > power consumption of you tuners (at least the USB one). > > Best, > Sergey Chernyavskiy. > > On Fri, May 27, 2016 at 09:59:06AM +0100, Richard F wrote: >> I'd like to give it a go on DVB
Re: [vdr] [PATCH] Device power saving feature
Yes, sure. The patch against VDR-2.2.0: http://pastebin.com/D4VQd1rG While testing set VDR log level to 3 (--log=3) and use this helper script to monitor your frontends: http://pastebin.com/uW4NW0rZ Don't forget to enable power saving in the Setup->LNB menu. If you don't have sudo (you're not on Debian or Ubuntu), remove it and run the script as root. It would be great if you could measure the power consumption of you tuners (at least the USB one). Best, Sergey Chernyavskiy. On Fri, May 27, 2016 at 09:59:06AM +0100, Richard F wrote: > I'd like to give it a go on DVB & DVBT-2 tuners (1 PCI, 1 USB) > Would you be kind enough to post a version for VDR2.20 or advise changes > necessary? > > Thanks > Richard > > > On 26/05/2016 18:44, glenvt18 wrote: > > For about a month now. Tested with 3 different DVB-S/S2 tuners with > > VDR 2.3.1 and VDR 2.2.0 (requires minor changes to the patch) - rock > > solid. > > I don't have VPS, so I can't test it. The same is about DVB-T/C > > tuners. After all, if something doesn't work this feature can be > > disabled (and it is disabled by default), > > > > > ___ > vdr mailing list > vdr@linuxtv.org > http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Device power saving feature
I'd like to give it a go on DVB & DVBT-2 tuners (1 PCI, 1 USB) Would you be kind enough to post a version for VDR2.20 or advise changes necessary? Thanks Richard On 26/05/2016 18:44, glenvt18 wrote: > For about a month now. Tested with 3 different DVB-S/S2 tuners with > VDR 2.3.1 and VDR 2.2.0 (requires minor changes to the patch) - rock > solid. > I don't have VPS, so I can't test it. The same is about DVB-T/C > tuners. After all, if something doesn't work this feature can be > disabled (and it is disabled by default), > ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Device power saving feature
For about a month now. Tested with 3 different DVB-S/S2 tuners with VDR 2.3.1 and VDR 2.2.0 (requires minor changes to the patch) - rock solid. I don't have VPS, so I can't test it. The same is about DVB-T/C tuners. After all, if something doesn't work this feature can be disabled (and it is disabled by default), Best, Sergey Chernyavskiy. 2016-05-26 20:15 GMT+03:00 Richard F: > Interesting. > How long have you been running it / testing it? > Have you tested with VPS timers enabled ? > > Thanks > Richard > > On 26/05/2016 16:36, glenvt18 wrote: >> Hi folks. >> >> This patch introduces a feature which allows an idle device (a device >> which is not currently recording or streaming) to enter a power-down >> mode after some period of time. Given two timeout values, >> PowerdownTimeoutM and PowerdownWakeupH, it works like this: when a >> device becomes idle, it is kept powered up for PowerdownTimeoutM minutes >> doing, for instance, an EPG scan before it is powered down. If the >> device is still idle and has been powered down for PowerdownWakeupH >> hours it is powered up for PowerdownTimeoutM minutes and so on. When >> recording, streaming or a forced EPG scan starts, the device is powered >> up and it's idle timer is disabled. This implies that PowerdownTimeoutM >> should be enough for a full round of EPG scanning (20 seconds * >> number_of_transponders). Another option is to run EPG scans from cron >> (at night) and use SVDRP SCAN command. > > ___ > vdr mailing list > vdr@linuxtv.org > http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Device power saving feature
Interesting. How long have you been running it / testing it? Have you tested with VPS timers enabled ? Thanks Richard On 26/05/2016 16:36, glenvt18 wrote: > Hi folks. > > This patch introduces a feature which allows an idle device (a device > which is not currently recording or streaming) to enter a power-down > mode after some period of time. Given two timeout values, > PowerdownTimeoutM and PowerdownWakeupH, it works like this: when a > device becomes idle, it is kept powered up for PowerdownTimeoutM minutes > doing, for instance, an EPG scan before it is powered down. If the > device is still idle and has been powered down for PowerdownWakeupH > hours it is powered up for PowerdownTimeoutM minutes and so on. When > recording, streaming or a forced EPG scan starts, the device is powered > up and it's idle timer is disabled. This implies that PowerdownTimeoutM > should be enough for a full round of EPG scanning (20 seconds * > number_of_transponders). Another option is to run EPG scans from cron > (at night) and use SVDRP SCAN command. ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
[vdr] [PATCH] Device power saving feature
Hi folks. This patch introduces a feature which allows an idle device (a device which is not currently recording or streaming) to enter a power-down mode after some period of time. Given two timeout values, PowerdownTimeoutM and PowerdownWakeupH, it works like this: when a device becomes idle, it is kept powered up for PowerdownTimeoutM minutes doing, for instance, an EPG scan before it is powered down. If the device is still idle and has been powered down for PowerdownWakeupH hours it is powered up for PowerdownTimeoutM minutes and so on. When recording, streaming or a forced EPG scan starts, the device is powered up and it's idle timer is disabled. This implies that PowerdownTimeoutM should be enough for a full round of EPG scanning (20 seconds * number_of_transponders). Another option is to run EPG scans from cron (at night) and use SVDRP SCAN command. Actual implementation of power saving facilities is left to a derived device class. In the case of a DVB device it is implemented by closing it's frontend device. For a DVB-S/S2 tuner this usually means powering the LNB off. My measurements show 3-4W power consumption drops per tuner for various DVB-S/S2 tuners. So, this feature (together with HDD spin-down) is especially valuable while running a headless 24/7 VDR server and/or using several tuners. A SATIP device can also implement power saving if it is supported by a server. I know about the dynamite plugin, but 1) it does much more then this, 2) still requires a VDR patch, which is bigger, 3) doesn't work reliably for me and 4) I think this functionality should be part of the VDR core. A copy of the patch is here: http://pastebin.com/FRi0kTjf Please review, Sergey Chernyavskiy. --- config.c| 9 ++ config.h| 3 ++ device.c| 96 +++-- device.h| 29 +++ dvbdevice.c | 39 + dvbdevice.h | 7 + eitscan.c | 7 - menu.c | 9 +- vdr.c | 6 9 files changed, 201 insertions(+), 4 deletions(-) diff --git a/config.c b/config.c index e5f5463..794c9f8 100644 --- a/config.c +++ b/config.c @@ -395,6 +395,9 @@ cSetup::cSetup(void) PositionerSpeed = 15; PositionerSwing = 650; PositionerLastLon = 0; + PowerdownEnabled = 0; + PowerdownTimeoutM = 15; + PowerdownWakeupH = 4; SetSystemTime = 0; TimeSource = 0; TimeTransponder = 0; @@ -622,6 +625,9 @@ bool cSetup::Parse(const char *Name, const char *Value) else if (!strcasecmp(Name, "PositionerSpeed")) PositionerSpeed = atoi(Value); else if (!strcasecmp(Name, "PositionerSwing")) PositionerSwing = atoi(Value); else if (!strcasecmp(Name, "PositionerLastLon")) PositionerLastLon = atoi(Value); + else if (!strcasecmp(Name, "PowerdownEnabled"))PowerdownEnabled = atoi(Value); + else if (!strcasecmp(Name, "PowerdownTimeoutM")) PowerdownTimeoutM = atoi(Value); + else if (!strcasecmp(Name, "PowerdownWakeupH"))PowerdownWakeupH = atoi(Value); else if (!strcasecmp(Name, "SetSystemTime")) SetSystemTime = atoi(Value); else if (!strcasecmp(Name, "TimeSource")) TimeSource = cSource::FromString(Value); else if (!strcasecmp(Name, "TimeTransponder")) TimeTransponder = atoi(Value); @@ -753,6 +759,9 @@ bool cSetup::Save(void) Store("PositionerSpeed",PositionerSpeed); Store("PositionerSwing",PositionerSwing); Store("PositionerLastLon", PositionerLastLon); + Store("PowerdownEnabled", PowerdownEnabled); + Store("PowerdownTimeoutM", PowerdownTimeoutM); + Store("PowerdownWakeupH", PowerdownWakeupH); Store("SetSystemTime", SetSystemTime); Store("TimeSource", cSource::ToString(TimeSource)); Store("TimeTransponder",TimeTransponder); diff --git a/config.h b/config.h index e5565da..7a73d9d 100644 --- a/config.h +++ b/config.h @@ -273,6 +273,9 @@ public: int PositionerSpeed; int PositionerSwing; int PositionerLastLon; + int PowerdownEnabled; + int PowerdownTimeoutM; + int PowerdownWakeupH; int SetSystemTime; int TimeSource; int TimeTransponder; diff --git a/device.c b/device.c index 542d120..9306adb 100644 --- a/device.c +++ b/device.c @@ -104,6 +104,9 @@ cDevice::cDevice(void) dvbSubtitleConverter = NULL; autoSelectPreferredSubtitleLanguage = true; + idleTimerExpires = time(NULL) + Setup.PowerdownTimeoutM * 60; + wakeupTimerExpires = 0; + for (int i = 0; i < MAXRECEIVERS; i++) receiver[i] = NULL; @@ -745,6 +748,11 @@ bool cDevice::SwitchChannel(int Direction) return result; } +// While switching to a channel, the device will be kept powered up +// for at least this number of seconds before a receiver is attached. +// Must be less than cEITScanner::ScanTimeout. +#define CHANNEL_SWITCH_POWERUP_TIMEOUT 10 + eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView) { cStatus::MsgChannelSwitch(this, 0, LiveView); @@ -778,6 +786,8 @@