01_FHEMWEB.pm: plotEmbed defaults to 2 for multi-cpu@Linux (Forum #116811)

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@23373 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2020-12-17 18:53:33 +00:00
parent 2d7e46253b
commit c22b9c8fa3
3 changed files with 15 additions and 9 deletions

View File

@ -565,7 +565,8 @@ FW_Read($$)
$arg = "" if(!defined($arg)); $arg = "" if(!defined($arg));
Log3 $FW_wname, 4, "$name $method $arg; BUFLEN:".length($hash->{BUF}); Log3 $FW_wname, 4, "$name $method $arg; BUFLEN:".length($hash->{BUF});
my $pf = AttrVal($FW_wname, "plotfork", undef); my $pf = AttrVal($FW_wname, "plotfork", undef);
$pf = 1 if(!defined($pf) && AttrVal($FW_wname, "plotEmbed", 0) == 2); $pf = 1 if(!defined($pf) &&
AttrVal($FW_wname, "plotEmbed", ($numCPUs>1 ? 2:0)) == 2);
if($pf) { if($pf) {
my $p = $data{FWEXT}; my $p = $data{FWEXT};
if(grep { $p->{$_}{FORKABLE} && $arg =~ m+^$FW_ME$_+ } keys %{$p}) { if(grep { $p->{$_}{FORKABLE} && $arg =~ m+^$FW_ME$_+ } keys %{$p}) {
@ -2028,7 +2029,7 @@ FW_showRoom()
# Now the "atEnds" # Now the "atEnds"
my $doBC = (AttrVal($FW_wname, "plotfork", 0) && my $doBC = (AttrVal($FW_wname, "plotfork", 0) &&
AttrVal($FW_wname, "plotEmbed", 0) == 0); AttrVal($FW_wname, "plotEmbed", ($numCPUs>1 ? 2:0)) == 0);
my %res; my %res;
my ($idx,$svgIdx) = (1,1); my ($idx,$svgIdx) = (1,1);
@atEnds = sort { $sortIndex{$a} cmp $sortIndex{$b} } @atEnds; @atEnds = sort { $sortIndex{$a} cmp $sortIndex{$b} } @atEnds;
@ -4041,9 +4042,10 @@ FW_log($$)
<li>plotEmbed<br> <li>plotEmbed<br>
If set to 1, SVG plots will be rendered as part of &lt;embed&gt; If set to 1, SVG plots will be rendered as part of &lt;embed&gt;
tags, as in the past this was the only way to display SVG. Setting tags, as in the past this was the only way to display SVG. Setting
plotEmbed to 0 (the default) will render SVG in-place.<br> plotEmbed to 0 will render SVG in-place.<br>
Setting plotEmbed to 2 will load the SVG via JavaScript, in order to Setting plotEmbed to 2 will load the SVG via JavaScript, in order to
enable parallelization without the embed tag. enable parallelization without the embed tag.
Default is 2 for multi-CPU hosts on Linux, and 0 everywhere else.
</li><br> </li><br>
<a name="plotfork"></a> <a name="plotfork"></a>
@ -4798,10 +4800,11 @@ FW_log($$)
<li>plotEmbed<br> <li>plotEmbed<br>
Falls 1, dann werden SVG Grafiken mit &lt;embed&gt; Tags Falls 1, dann werden SVG Grafiken mit &lt;embed&gt; Tags
gerendert, da auf &auml;lteren Browsern das die einzige gerendert, da auf &auml;lteren Browsern das die einzige
M&ouml;glichkeit war, SVG dastellen zu k&ouml;nnen. Falls 0 (die M&ouml;glichkeit war, SVG dastellen zu k&ouml;nnen. Falls 0, dann
Voreinstellung), dann werden die SVG Grafiken "in-place" gezeichnet. werden die SVG Grafiken "in-place" gezeichnet. Falls 2, dann werden
Falls 2, dann werden die Grafiken per JavaScript nachgeladen, um eine die Grafiken per JavaScript nachgeladen, um eine Parallelisierung auch
Parallelisierung auch ohne embed Tags zu erm&ouml;glichen. ohne embed Tags zu erm&ouml;glichen.
Die Voreinstellung ist 2 auf Mehrprozessor-Linux-Rechner und 0 sonst.
</li><br> </li><br>
<a name="plotfork"></a> <a name="plotfork"></a>

View File

@ -195,7 +195,7 @@ SVG_getplotsize($)
sub sub
SVG_embed() SVG_embed()
{ {
return AttrVal($FW_wname, "plotEmbed", 0); return AttrVal($FW_wname, "plotEmbed", ($numCPUs>1 ? 2:0));
} }
sub sub

View File

@ -269,6 +269,7 @@ use vars qw(@authenticate); # List of authentication devices
use vars qw(@authorize); # List of authorization devices use vars qw(@authorize); # List of authorization devices
use vars qw(@intAtA); # Internal timer array use vars qw(@intAtA); # Internal timer array
use vars qw(@structChangeHist); # Contains the last 10 structural changes use vars qw(@structChangeHist); # Contains the last 10 structural changes
use vars qw($numCPUs); # Number of CPUs on Linux, else 1
use constant { use constant {
DAYSECONDS => 86400, DAYSECONDS => 86400,
@ -306,6 +307,8 @@ $init_done = 0;
$lastDefChange = 0; $lastDefChange = 0;
$readytimeout = ($^O eq "MSWin32") ? 0.1 : 5.0; $readytimeout = ($^O eq "MSWin32") ? 0.1 : 5.0;
$featurelevel = 6.0; # see also GlobalAttr $featurelevel = 6.0; # see also GlobalAttr
$numCPUs = `grep -c ^processor /proc/cpuinfo 2>&1` if($^O eq "linux");
$numCPUs = ($numCPUs && $numCPUs =~ m/(\d+)/ ? $1 : 1);
$modules{Global}{ORDER} = -1; $modules{Global}{ORDER} = -1;