fix >4cpu issue

This commit is contained in:
Matthias Clasen 2011-03-26 18:43:17 -04:00
parent e86fdc0ceb
commit fe67a66b0b
2 changed files with 59 additions and 1 deletions

View File

@ -12,12 +12,16 @@
Summary: Process and resource monitor
Name: gnome-system-monitor
Version: 2.99.3
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://www.gnome.org/
#VCS: git:git://git.gnome.org/gnome-system-monitor
Source: http://download.gnome.org/sources/gnome-system-monitor/2.99/%{name}-%{version}.tar.bz2
# https://bugzilla.gnome.org/show_bug.cgi?id=635939
Patch0: more-than-4-cpus.patch
BuildRequires: libgtop2-devel >= %{libgtop2_version}
BuildRequires: libwnck-devel >= %{libwnck_version}
BuildRequires: pango-devel >= %{pango_version}
@ -49,6 +53,7 @@ such as CPU and memory.
%prep
%setup -q
%patch0 -p1 -b .4cpu
%build
%configure --enable-selinux --disable-scrollkeeper
@ -85,6 +90,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas || :
%changelog
* Sat Mar 26 2011 Matthias Clasen <mclasen@redhat.com> - 2.99.3-2
- Fix runtime error with > 4 cpus
* Fri Mar 25 2011 Matthias Clasen <mclasen@redhat.com> - 2.99.3-1
- Update to 2.99.3

50
more-than-4-cpus.patch Normal file
View File

@ -0,0 +1,50 @@
From 9f6a52fa2b1a9e423808959a2ce7fea37f67656c Mon Sep 17 00:00:00 2001
From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
Date: Fri, 25 Mar 2011 18:11:21 +0100
Subject: [PATCH] Temporary workaround for CPU with more than 4 cores
We do not provide colors after cpu-color3 in the schema
Use only the 4 colors from the scheme for now
---
src/callbacks.cpp | 2 +-
src/procman.cpp | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/callbacks.cpp b/src/callbacks.cpp
index 88d1f3d..7c7e6e3 100644
--- a/src/callbacks.cpp
+++ b/src/callbacks.cpp
@@ -235,7 +235,7 @@ cb_cpu_color_changed (GSMColorButton *cp, gpointer data)
gint i = GPOINTER_TO_INT (data);
GSettings *settings = g_settings_new (GSM_GSETTINGS_SCHEMA);
- g_snprintf(key, sizeof key, "cpu-color%d", i);
+ g_snprintf(key, sizeof key, "cpu-color%d", i%4);
change_settings_color(settings, key, cp);
}
diff --git a/src/procman.cpp b/src/procman.cpp
index 9b9292a..daebdc7 100644
--- a/src/procman.cpp
+++ b/src/procman.cpp
@@ -181,7 +181,7 @@ color_changed_cb (GSettings *settings, const gchar *key, gpointer data)
if (g_str_has_prefix (key, "cpu-color")) {
for (int i = 0; i < procdata->config.num_cpus; i++) {
- string cpu_key = make_string(g_strdup_printf("cpu-color%d", i));
+ string cpu_key = make_string(g_strdup_printf("cpu-color%d", i%4));
if (cpu_key == key) {
gdk_color_parse (color, &procdata->config.cpu_color[i]);
procdata->cpu_graph->colors.at(i) = procdata->config.cpu_color[i];
@@ -279,7 +279,7 @@ procman_data_new (GSettings *settings)
for (int i = 0; i < pd->config.num_cpus; i++) {
gchar *key;
- key = g_strdup_printf ("cpu-color%d", i);
+ key = g_strdup_printf ("cpu-color%d", i%4);
color = g_settings_get_string (settings, key);
if (!color)
--
1.7.4.1.433.gcd306.dirty