From caeb32bbea5601d18cf669b05cb26c246105b9e4 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Fri, 12 Sep 2014 17:46:39 +0000 Subject: [PATCH] FHEMWEB: plotfork now changes the priority/nice value. Forum #25504 git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@6545 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/01_FHEMWEB.pm | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/FHEM/01_FHEMWEB.pm b/FHEM/01_FHEMWEB.pm index e4f7b3b33..9f640479f 100755 --- a/FHEM/01_FHEMWEB.pm +++ b/FHEM/01_FHEMWEB.pm @@ -374,11 +374,17 @@ FW_Read($) Log3 $FW_wname, 4, "HTTP $name GET $arg"; $FW_ME = "/" . AttrVal($FW_wname, "webname", "fhem"); my $pid; - if(AttrVal($FW_wname, "plotfork", undef)) { + if(defined(AttrVal($FW_wname, "plotfork", undef))) { # Process SVG rendering as a parallel process my $p = $data{FWEXT}; if(grep { $p->{$_}{FORKABLE} && $arg =~ m+^$FW_ME$_+ } keys %{$p}) { - return if($pid = fork); + if($pid = fork) { + use constant PRIO_PROCESS => 0; + setpriority(PRIO_PROCESS, $pid, + getpriority(PRIO_PROCESS, $pid) + AttrVal($FW_wname, "plotfork", 0) + ); + return; + } } } @@ -2716,9 +2722,16 @@ FW_widgetOverride($$)
-
  • plotfork
    - If set, generate the logs in a parallel process. Note: do not use it - on Windows and on systems with small memory foorprint. +
  • plotfork [<Δp>]
    + If set, run part of the processing (e.g. SVG plot + generation or RSS feeds) in parallel processes. + Actually, child processes are forked whose + priorities are the FHEM process' priority plus Δp. + Higher values mean lower priority. e.g. use Δp= 10 to renice the + child processes and provide more CPU power to the main FHEM process. + Δp is optional and defaults to 0.
    + Note: do not use it + on Windows and on systems with small memory footprint.