From patchwork Mon Mar 13 07:35:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo-Andres Hofmann X-Patchwork-Id: 6695 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4PZpP35xKcz3wkG for ; Mon, 13 Mar 2023 07:36:07 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4PZpP23HDgzcp; Mon, 13 Mar 2023 07:36:06 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4PZpP22NJYz2y4g; Mon, 13 Mar 2023 07:36:06 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4PZpP14rT5z2y4g for ; Mon, 13 Mar 2023 07:36:05 +0000 (UTC) Received: from arche.uberspace.de (arche.uberspace.de [185.26.156.147]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4PZpP10Xg2zPV for ; Mon, 13 Mar 2023 07:36:05 +0000 (UTC) Authentication-Results: mail01.ipfire.org; dkim=pass header.d=leo-andres.de header.s=uberspace header.b=Nloy16F0; spf=pass (mail01.ipfire.org: domain of hofmann@leo-andres.de designates 185.26.156.147 as permitted sender) smtp.mailfrom=hofmann@leo-andres.de; dmarc=pass (policy=quarantine) header.from=leo-andres.de ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1678692965; a=rsa-sha256; cv=none; b=SjFWwH49gAsGRHoPUx8UyThUR3/7AoJsWYA0MRYLS2GtizcdJiU2fEnExjRj7MvtN/1xnu MsPrFZ/jrUtd/c6pmrVld0bWxxXXalHQ+bXUR+i3l12m/u5q6bmpX/O2L/mHCgR4tqq98E r1YeUTNesGmj8NwR0Qb8cSdf4NdNiLNwvpncrGXowxewzmRU5Bw41QjCHulnXYg2oPEg8A CT527R41onyY9gaSqUP4gYKTz2QTyr0tC8IKtL3DZmcU3QcBTNPF2hTfR7f3jPcG4Zar6j mZFPZ4PZ1hSvoROU+pHhjDiYozBvr6/4RstN/cV6Ek+DsmPyMF92qfLVGMRP3g== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=leo-andres.de header.s=uberspace header.b=Nloy16F0; spf=pass (mail01.ipfire.org: domain of hofmann@leo-andres.de designates 185.26.156.147 as permitted sender) smtp.mailfrom=hofmann@leo-andres.de; dmarc=pass (policy=quarantine) header.from=leo-andres.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1678692965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=9haYg00JP9x8VqN1gXktXkGwbaISA8anzks9Wf6he6k=; b=v4WSXvH99NnURzkG1f7evEJRrQssPhNrvxucYkY9U5/tkPBVYE6Cvi2TNxjLvZ0ydOJOXU 3zIWUagOXhyHSIIF4YkX1L9S4FQQKSpHgp4O8I/X7SbdeUerPb+yxTw/f2CO8x5iDvu84C cfBSXbR4Au99w1IbBdZyJSTZW3MyzjY8l9rUuIYgZWrt6TSMPzOBtVnyoY5Uq3yyIgCv30 EqVtZKQkMH8AteXD5GTD2uHDFGZ1gZm0/JJWMz83zTq4zw+SzB0bE/GWo+zPBVV7XWezim 9rsUE1HxMHtVMGdCGsQ1atTesLCkTQjJ2iTdRkWMyjD0pS7Rvhrq9uv4ChpOZg== Received: (qmail 27348 invoked by uid 990); 13 Mar 2023 07:36:04 -0000 From: Leo-Andres Hofmann To: development@lists.ipfire.org Subject: [PATCH] graphs.pl: Make canvas fixed size and limit cpufreq color index Date: Mon, 13 Mar 2023 08:35:44 +0100 Message-Id: <20230313073544.753-1-hofmann@leo-andres.de> X-Mailer: git-send-email 2.37.1.windows.1 MIME-Version: 1.0 X-Rspamd-Bar: - X-Rspamd-Report: R_MISSING_CHARSET(0.5) MIME_GOOD(-0.1) MID_CONTAINS_FROM(1) BAYES_HAM(-3) X-Rspamd-Score: -1.6 Received: from unknown (HELO unkown) (::1) by arche.uberspace.de (Haraka/3.0.1) with ESMTPSA; Mon, 13 Mar 2023 08:36:04 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=leo-andres.de; s=uberspace; h=from; bh=omYGhvdaiF0h4Ia7NvLGVeodlOwXN1IRVtDpKj3VWLM=; b=Nloy16F0XSlJ72nSg44SYDqb0HdiZLEpdbRCkHlonHgOhVyL/W6p7cTWaLc5AlbjtyGljjC/f9 az+9lZh9DSbeLSGN6gPIepdqJCezKzcjjFwg33emRJm/tSMmYQJaY7ZW0HHR5BJ3/TZuNsP5wJpf iHgW1PjaX/03DB7UcnqcCv47XtuUlKmXpmhorFtRp91b8wWjzLAMOwyB60wvgIIhP0XC6R+MPwTn WZY46WzxW3+bqCI6kLW0++NPasDJA2xp7nrvbpWU0L8A5pZLMCyRQAM15pAL7ygc4u3khOWHa6r7 3H8x/qvFTnOcRGw4O0AuOuza8mJu1L+Zu1agQHZ/EVHKDuH137m/M9AccbUNijTeH0xP4UN2qg01 UFg91rEdIv2NhAUO2rDIPZUf018voQ3rE0ToQXCMtbo0MTNSkDbKdmqkdHFsvABPqG/GvuOZNtFh 6TFKdzVsjeTGpSLcLy7FmJyCTM8EpqJokp5JlU7z6StZnJrPDTjM8D/Y7NgO4SXweDVmRWs0Yo7Q YBh0T4lmrtJChR+7Ipsr6tYU9T/UaZaI2MkoXTLAOPdfd7EDgEOdGm+4u5q+oL/m06/sdNGFf3lV xlr0MPQk4QFpCS2SRNi7tdQkjIaq/qIyUWVKbJ8uO9Op+Kf53DmhQPF2Ffm6VnqUQ33mNXpMVQOW Q= X-Rspamd-Queue-Id: 4PZpP10Xg2zPV X-Spamd-Result: default: False [-3.00 / 11.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM(-1.00)[-0.997]; MX_INVALID(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[leo-andres.de,quarantine]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[leo-andres.de:s=uberspace]; R_SPF_ALLOW(-0.20)[+ip4:185.26.156.0/24]; MIME_GOOD(-0.10)[text/plain]; IP_REPUTATION_HAM(-0.00)[asn: 205766(0.00), country: DE(-0.00), ip: 185.26.156.147(0.00)]; RCVD_IN_DNSWL_NONE(0.00)[185.26.156.147:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:205766, ipnet:185.26.156.0/24, country:DE]; RCPT_COUNT_TWO(0.00)[2]; DKIM_REPUTATION(0.00)[0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[leo-andres.de:+]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; RCVD_TLS_ALL(0.00)[] X-Rspamd-Action: no action X-Rspamd-Server: mail01.haj.ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This fixes an issue where systems with many CPU cores run out of usable graph colors and canvas area. It also unifies the canvas size for all graphs. Discussion: https://community.ipfire.org/t/cpu-freq-graph-not-working-with-i5-1235u/9396 Fixes: #12890 Signed-off-by: Leo-Andres Hofmann Reviewed-by: Michael Tremer --- config/cfgroot/graphs.pl | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/config/cfgroot/graphs.pl b/config/cfgroot/graphs.pl index 3368e5aad..cefe0b90d 100644 --- a/config/cfgroot/graphs.pl +++ b/config/cfgroot/graphs.pl @@ -30,8 +30,11 @@ require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; -# Graph image size in pixel -our %image_size = ('width' => 910, 'height' => 300); +# Approximate size of the final graph image including canvas and labeling (in pixels, mainly used for placeholders) +our %image_size = ('width' => 900, 'height' => 300); + +# Size of the actual data area within the image, without labeling (in pixels) +our %canvas_size = ('width' => 800, 'height' => 190); # List of all available time ranges our @time_ranges = ("hour", "day", "week", "month", "year"); @@ -48,15 +51,12 @@ my @GRAPH_ARGS = ( # For a more 'organic' look "--slope-mode", - # HxW define the size of the output image - "--full-size-mode", - # Watermark "-W www.ipfire.org", - # Default size - "-w $image_size{'width'}", - "-h $image_size{'height'}", + # Canvas width/height + "-w $canvas_size{'width'}", + "-h $canvas_size{'height'}", # Use alternative grid "--alt-y-grid", @@ -1090,18 +1090,19 @@ sub updatecpufreqgraph { "--color=SHADEA".$color{"color19"}, "--color=SHADEB".$color{"color19"}, "--color=BACK".$color{"color21"}, - "COMMENT:".sprintf("%-10s",$Lang::tr{'caption'}), + "COMMENT:".sprintf("%-15s",$Lang::tr{'caption'}), "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}), "COMMENT:".sprintf("%15s",$Lang::tr{'average'}), "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}), "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j" ); + my $j = 11; for(my $i = 0; $i < $cpucount; $i++) { - my $j=$i+1; + $j++; $j = 1 if $j > 20; push(@command,"DEF:cpu".$i."_=".$mainsettings{'RRDLOG'}."/collectd/localhost/cpufreq/cpufreq-".$i.".rrd:value:AVERAGE" ,"CDEF:cpu".$i."=cpu".$i."_,1000000,/" - ,"LINE1:cpu".$i.$color{"color1$j"}."A0:cpu ".$i." " + ,"LINE1:cpu".$i.$color{"color$j"}."A0:cpu ".$i." " ,"GPRINT:cpu".$i.":MAX:%3.0lf Mhz" ,"GPRINT:cpu".$i.":AVERAGE:%3.0lf Mhz" ,"GPRINT:cpu".$i.":MIN:%3.0lf Mhz"