patches/gnome-system-monitor-01-solaris.diff
changeset 7661 9866d9521d68
child 7663 3c1d023035ce
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/gnome-system-monitor-01-solaris.diff	Wed Jul 19 11:08:44 2006 +0000
@@ -0,0 +1,305 @@
+diff -Nrup gnome-system-monitor-2.14.1/configure.in gnome-system-monitor-2.14.1.mod/configure.in
+--- gnome-system-monitor-2.14.1/configure.in	2006-04-10 01:39:27.000000000 +0800
++++ gnome-system-monitor-2.14.1.mod/configure.in	2006-06-23 17:17:39.797532000 +0800
+@@ -31,6 +31,12 @@ GNOME_VFS_REQUIRED=2.6.0
+ LIBGKSUUI_REQUIRED=1.0.0
+ LIBGKSU_REQUIRED=0.15.0
+ 
++case "$host" in
++*-*-solaris*) GMSGFMT_CHECKOPT= ;;
++*) GMSGFMT_CHECKOPT=-c ;;
++esac
++AC_SUBST( GMSGFMT_CHECKOPT)
++
+ PKG_CHECK_MODULES(PROCMAN, glib-2.0 >= $GLIB_REQUIRED libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-1.0 >= $LIBWNCK_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED)
+ 
+ 
+diff -Nrup gnome-system-monitor-2.14.1/po/Makefile.in.in gnome-system-monitor-2.14.1.mod/po/Makefile.in.in
+--- gnome-system-monitor-2.14.1/po/Makefile.in.in	2006-04-10 19:51:06.000000000 +0800
++++ gnome-system-monitor-2.14.1.mod/po/Makefile.in.in	2006-06-23 17:19:28.802301000 +0800
+@@ -48,6 +48,7 @@ INSTALL_DATA = @INSTALL_DATA@
+ 
+ CC = @CC@
+ GMSGFMT = @GMSGFMT@
++GMSGFMT_CHECKOPT = @GMSGFMT_CHECKOPT@
+ MSGFMT = @MSGFMT@
+ XGETTEXT = @XGETTEXT@
+ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+@@ -90,7 +91,7 @@ CATOBJEXT = @CATOBJEXT@
+ 
+ .po.gmo:
+ 	file=`echo $* | sed 's,.*/,,'`.gmo \
+-	  && rm -f $$file && $(GMSGFMT) -o $$file $<
++	  && rm -f $$file && $(GMSGFMT) -o $(GMSGFMT_CHECKOPT) $$file $<
+ 
+ .po.cat:
+ 	sed -f ../intl/po2msg.sed < $< > $*.msg \
+diff -Nrup gnome-system-monitor-2.14.1/src/callbacks.c gnome-system-monitor-2.14.1.mod/src/callbacks.c
+--- gnome-system-monitor-2.14.1/src/callbacks.c	2005-09-04 10:49:43.000000000 +0800
++++ gnome-system-monitor-2.14.1.mod/src/callbacks.c	2006-07-19 18:47:13.274807000 +0800
+@@ -371,7 +371,6 @@ cb_change_current_page (GtkNotebook *nb,
+ 
+ 
+ 	if (num == 0) {
+-
+ 		cb_timeout (procdata);
+ 
+ 		if (!procdata->timeout)
+@@ -450,7 +449,11 @@ cb_timeout (gpointer data)
+ 		return FALSE;
+ 	}
+ 
+-	return TRUE;
++	procdata->timeout = g_timeout_add(new_interval,
++					  cb_timeout,
++					  procdata);
++
++	return FALSE;
+ }
+ 
+ 
+diff -Nrup gnome-system-monitor-2.14.1/src/load-graph.c gnome-system-monitor-2.14.1.mod/src/load-graph.c
+--- gnome-system-monitor-2.14.1/src/load-graph.c	2006-04-10 00:46:29.000000000 +0800
++++ gnome-system-monitor-2.14.1.mod/src/load-graph.c	2006-07-07 14:16:03.034343000 +0800
+@@ -26,6 +26,10 @@
+ 
+ #define NUM_POINTS 100
+ #define GRAPH_MIN_HEIGHT 30
++/*static const unsigned needed_netload_flags =
++(1 << GLIBTOP_NETLOAD_IF_FLAGS) +
++(1 << GLIBTOP_NETLOAD_BYTES_TOTAL);
++*/
+ 
+ 
+ enum {
+@@ -71,7 +75,7 @@ struct _LoadGraph {
+ 			GTimeVal time;
+ 			float max;
+ 		} net;
+-	};
++	}category;
+ };
+ 
+ 
+@@ -206,8 +210,8 @@ get_load (LoadGraph *g)
+ 
+ #undef NOW
+ #undef LAST
+-#define NOW  (g->cpu.times[g->cpu.now])
+-#define LAST (g->cpu.times[g->cpu.now ^ 1])
++#define NOW  (g->category.cpu.times[g->category.cpu.now])
++#define LAST (g->category.cpu.times[g->category.cpu.now ^ 1])
+ 
+ 	if (g->n == 1) {
+ 		NOW[0][CPU_TOTAL] = cpu.total;
+@@ -220,9 +224,9 @@ get_load (LoadGraph *g)
+ 		}
+ 	}
+ 
+-	if (G_UNLIKELY(!g->cpu.initialized)) {
++	if (G_UNLIKELY(!g->category.cpu.initialized)) {
+ 		/* No data yet */
+-		g->cpu.initialized = TRUE;
++		g->category.cpu.initialized = TRUE;
+ 	} else {
+ 		for (i = 0; i < g->n; i++) {
+ 			float load;
+@@ -242,7 +246,7 @@ get_load (LoadGraph *g)
+ 		}
+ 	}
+ 
+-	g->cpu.now ^= 1;
++	g->category.cpu.now ^= 1;
+ 
+ #undef NOW
+ #undef LAST
+@@ -293,7 +297,7 @@ static void
+ net_scale (LoadGraph *g, float new_max)
+ {
+ 	gint i;
+-	float old_max = MAX (g->net.max, 1.0f), scale;
++	float old_max = MAX (g->category.net.max, 1.0f), scale;
+ 
+ 	if (new_max <= old_max)
+ 		return;
+@@ -307,7 +311,8 @@ net_scale (LoadGraph *g, float new_max)
+ 		}
+ 	}
+ 
+-	g->net.max = new_max;
++
++	g->category.net.max = new_max;
+ }
+ 
+ static void
+@@ -328,12 +333,17 @@ get_net (LoadGraph *g)
+ 		glibtop_netload netload;
+ 		glibtop_get_netload (&netload, ifnames[i]);
+ 
++/*		if ((netload.flags & needed_netload_flags) != needed_netload_flags)
++			continue;
++		if (!(netload.if_flags & (1L << GLIBTOP_IF_FLAGS_UP)))
++            		continue;
++*/
+ 		if (netload.if_flags & (1 << GLIBTOP_IF_FLAGS_LOOPBACK))
+ 			continue;
+-
++		
+ 		/* Don't skip interfaces that are down (GLIBTOP_IF_FLAGS_UP)
+ 		   to avoid spikes when they are brought up */
+-
++					   
+ 		in  += netload.bytes_in;
+ 		out += netload.bytes_out;
+ 	}
+@@ -342,13 +352,13 @@ get_net (LoadGraph *g)
+ 
+ 	g_get_current_time (&time);
+ 
+-	if (in >= g->net.last_in && out >= g->net.last_out &&
+-	    g->net.time.tv_sec != 0) {
++	if (in >= g->category.net.last_in && out >= g->category.net.last_out &&
++            g->category.net.time.tv_sec != 0) {
+ 		float dtime;
+-		dtime = time.tv_sec - g->net.time.tv_sec +
+-			(float) (time.tv_usec - g->net.time.tv_usec) / G_USEC_PER_SEC;
+-		din   = (in - g->net.last_in) / dtime;
+-		dout  = (out - g->net.last_out) / dtime;
++		dtime = time.tv_sec - g->category.net.time.tv_sec +
++			(float) (time.tv_usec - g->category.net.time.tv_usec) / G_USEC_PER_SEC;
++		din   = (in - g->category.net.last_in) / dtime;
++		dout  = (out - g->category.net.last_out) / dtime;
+ 	} else {
+ 		/* Don't calc anything if new data is less than old (interface
+ 		   removed, counters reset, ...) or if it is the first time */
+@@ -356,15 +366,16 @@ get_net (LoadGraph *g)
+ 		dout = 0.0f;
+ 	}
+ 
+-	g->net.last_in  = in;
+-	g->net.last_out = out;
+-	g->net.time     = time;
++	g->category.net.last_in  = in;
++	g->category.net.last_out = out;
++	g->category.net.time     = time;
+ 
+-	g->data[0][0] = din  / MAX(g->net.max, 1.0f);
+-	g->data[0][1] = dout / MAX(g->net.max, 1.0f);
+ 
++	g->data[0][0] = din  / MAX(g->category.net.max, 1.0f);
++	g->data[0][1] = dout / MAX(g->category.net.max, 1.0f);
++	
+ 	net_scale (g, MAX (din, dout));
+-
++	
+ 	text1 = SI_gnome_vfs_format_file_size_for_display (din);
+ 	text2 = g_strdup_printf (_("%s/s"), text1);
+ 	gtk_label_set_text (GTK_LABEL (g->labels.net_in), text2);
+diff -Nrup gnome-system-monitor-2.14.1/src/procdialogs.c gnome-system-monitor-2.14.1.mod/src/procdialogs.c
+--- gnome-system-monitor-2.14.1/src/procdialogs.c	2006-04-10 01:19:39.000000000 +0800
++++ gnome-system-monitor-2.14.1.mod/src/procdialogs.c	2006-07-08 02:26:05.271840000 +0800
+@@ -333,7 +333,7 @@ smooth_refresh_toggled(GtkToggleButton *
+ 
+ 	gboolean toggled;
+ 
+-	toggled = gtk_toggle_button_get_active(button);
++	toggled = TRUE; /*gtk_toggle_button_get_active(button);*/
+ 
+ 	gconf_client_set_bool(client, SMOOTH_REFRESH_KEY, toggled, NULL);
+ }
+diff -Nrup gnome-system-monitor-2.14.1/src/proctable.c gnome-system-monitor-2.14.1.mod/src/proctable.c
+--- gnome-system-monitor-2.14.1/src/proctable.c	2006-02-27 17:44:35.000000000 +0800
++++ gnome-system-monitor-2.14.1.mod/src/proctable.c	2006-07-19 18:47:48.938626000 +0800
+@@ -53,7 +53,6 @@
+ #include "selinux.h"
+ #include "e_date.h"
+ 
+-
+ static guint64 total_time = 1;
+ static guint64 total_time_last = 1;
+ 
+@@ -533,16 +532,19 @@ get_process_memory_info(ProcInfo *info)
+ 	wnck_pid_read_resource_usage (gdk_screen_get_display (gdk_screen_get_default ()),
+ 				      info->pid,
+ 				      &xresources);
++	info->memxserver = xresources.total_bytes_estimate;
++	
++	get_process_memory_writable(info);
+ 
+ 	glibtop_get_proc_mem(&procmem, info->pid);
+-
+ 	info->vmsize	= procmem.vsize;
+ 	info->memres	= procmem.resident;
+-	info->memshared	= procmem.share;
+-
+-	info->memxserver = xresources.total_bytes_estimate;
++        info->memshared = procmem.share;
++	
++#ifdef __sun
++	info->pcpu	= procmem.load;
++#endif
+ 
+-	get_process_memory_writable(info);
+ }
+ 
+ 
+@@ -795,15 +797,16 @@ update_info (ProcData *procdata, ProcInf
+ 		glibtop_get_proc_uid (&procuid, info->pid);
+ 		glibtop_get_proc_time (&proctime, info->pid);
+ 
+-		get_process_memory_info(info);
+ 		get_process_user(procdata, info, procstate.uid);
+-
+-		info->pcpu = (proctime.rtime - info->cpu_time_last) * 100 / total_time;
+-		info->pcpu = MIN(info->pcpu, 100);
+-
+-		info->cpu_time_last = proctime.rtime;
++                info->pcpu = (proctime.rtime - info->cpu_time_last) * 100 / total_time;
++                info->pcpu = MIN(info->pcpu, 100);
++		
++		/* there is a bug here, because info can't store cpu_time_last, it's only a temporary variable in refresh_list() */
++                info->cpu_time_last = proctime.rtime;
+ 		info->nice = procuid.nice;
+-
++		 
++		/* if at Solaris, in get_process_memory_info() info->pcpu will get again from glibtop_get_proc_mem() */
++		get_process_memory_info(info);
+ 
+ 		model = gtk_tree_view_get_model (GTK_TREE_VIEW (procdata->tree));
+ 
+@@ -963,8 +966,9 @@ proctable_update_list (ProcData * const 
+ 	/* FIXME: total cpu time elapsed should be calculated on an individual basis here
+ 	** should probably have a total_time_last gint in the ProcInfo structure */
+ 	glibtop_get_cpu (&cpu);
+-	total_time = MAX(cpu.total - total_time_last, 1);
+-	total_time_last = cpu.total;
++	/* total is normally is 1/100 second, if transfer to second, have to divide by frequency */
++	total_time = MAX(cpu.total / cpu.frequency - total_time_last, 1);
++	total_time_last = cpu.total / cpu.frequency;
+ 
+ 	refresh_list (procdata, pid_list, proclist.number);
+ 
+diff -Nrup gnome-system-monitor-2.14.1/src/smooth_refresh.c gnome-system-monitor-2.14.1.mod/src/smooth_refresh.c
+--- gnome-system-monitor-2.14.1/src/smooth_refresh.c	2005-12-28 00:14:59.000000000 +0800
++++ gnome-system-monitor-2.14.1.mod/src/smooth_refresh.c	2006-07-19 18:47:58.412015000 +0800
+@@ -181,8 +181,10 @@ smooth_refresh_get(SmoothRefresh *sm, gu
+ 	gboolean changed;
+ 	float pcpu;
+ 
+-	if (!sm->active)
++	if (!sm->active){
++		*new_interval = sm->interval;
+ 		return FALSE;
++	}
+ 
+ 	pcpu = get_own_cpu_usage(sm);
+ /*
+@@ -241,6 +243,8 @@ smooth_refresh_get(SmoothRefresh *sm, gu
+ 		       *sm->config_interval,
+ 		       ctime(&now));
+ 	}
++	else
++		*new_interval = sm->interval;	
+ 
+ 	g_assert(sm->interval == *new_interval);
+ 	g_assert(sm->interval >= *sm->config_interval);