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

View File

@ -195,7 +195,7 @@ SVG_getplotsize($)
sub
SVG_embed()
{
return AttrVal($FW_wname, "plotEmbed", 0);
return AttrVal($FW_wname, "plotEmbed", ($numCPUs>1 ? 2:0));
}
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(@intAtA); # Internal timer array
use vars qw(@structChangeHist); # Contains the last 10 structural changes
use vars qw($numCPUs); # Number of CPUs on Linux, else 1
use constant {
DAYSECONDS => 86400,
@ -306,6 +307,8 @@ $init_done = 0;
$lastDefChange = 0;
$readytimeout = ($^O eq "MSWin32") ? 0.1 : 5.0;
$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;