diff -Nrup gnome-system-monitor-2.25.91/configure.in gnome-system-monitor-2.25.91.mod/configure.in
--- gnome-system-monitor-2.25.91/configure.in 2009-02-17 02:07:36.000000000 +0800
+++ gnome-system-monitor-2.25.91.mod/configure.in 2009-03-04 10:31:31.831892000 +0800
@@ -56,13 +56,13 @@ if test "$GCC" = "yes" -a "$set_more_war
-Wcast-align -Wsign-compare \
-std=gnu89 \
$CFLAGS"
- CXXFLAGS="-Wall -std=c++98 $CXXFLAGS"
+ CXXFLAGS="-Wall -std=c++98 $CXXFLAGS -features=extensions"
else
AC_MSG_RESULT(no)
fi
-dnl CXXFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden $CXXFLAGS"
-dnl CXXFLAGS="-fvisibility-inlines-hidden $CXXFLAGS"
+dnl CXXFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden -features=extensions $CXXFLAGS"
+dnl CXXFLAGS="-fvisibility-inlines-hidden -features=extensions $CXXFLAGS"
AM_GCONF_SOURCE_2
diff -Nrup gnome-system-monitor-2.25.91/src/load-graph.cpp gnome-system-monitor-2.25.91.mod/src/load-graph.cpp
--- gnome-system-monitor-2.25.91/src/load-graph.cpp 2008-08-31 21:29:57.000000000 +0800
+++ gnome-system-monitor-2.25.91.mod/src/load-graph.cpp 2009-03-04 11:26:07.230508000 +0800
@@ -435,7 +435,7 @@ net_scale (LoadGraph *g, unsigned din, u
}
}
- procman_debug("rescale dmax = %u max = %u new_max = %u", dmax, g->net.max, new_max);
+ //procman_debug("rescale dmax = %u max = %u new_max = %u", dmax, g->net.max, new_max);
g->net.max = new_max;
diff -Nrup gnome-system-monitor-2.25.91/src/lsof.cpp gnome-system-monitor-2.25.91.mod/src/lsof.cpp
--- gnome-system-monitor-2.25.91/src/lsof.cpp 2008-05-24 05:44:00.000000000 +0800
+++ gnome-system-monitor-2.25.91.mod/src/lsof.cpp 2009-03-04 10:16:57.082704000 +0800
@@ -95,13 +95,13 @@ namespace
GUI()
{
- procman_debug("New Lsof GUI %p", this);
+ //procman_debug("New Lsof GUI %p", this);
}
~GUI()
{
- procman_debug("Destroying Lsof GUI %p", this);
+ //procman_debug("Destroying Lsof GUI %p", this);
}
diff -Nrup gnome-system-monitor-2.25.91/src/openfiles.cpp gnome-system-monitor-2.25.91.mod/src/openfiles.cpp
--- gnome-system-monitor-2.25.91/src/openfiles.cpp 2008-09-12 03:55:34.000000000 +0800
+++ gnome-system-monitor-2.25.91.mod/src/openfiles.cpp 2009-03-04 11:54:44.460430000 +0800
@@ -67,7 +67,7 @@ friendlier_hostname(const char *addr_str
goto failsafe;
if (getnameinfo(res->ai_addr, res->ai_addrlen, hostname,
- sizeof hostname, service, sizeof service, NI_IDN))
+ sizeof hostname, service, sizeof service, NI_MAXSERV))
goto failsafe;
if (res) freeaddrinfo(res);
diff -Nrup gnome-system-monitor-2.25.91/src/prettytable.cpp gnome-system-monitor-2.25.91.mod/src/prettytable.cpp
--- gnome-system-monitor-2.25.91/src/prettytable.cpp 2009-01-19 02:01:09.000000000 +0800
+++ gnome-system-monitor-2.25.91.mod/src/prettytable.cpp 2009-03-04 10:17:07.130460000 +0800
@@ -77,7 +77,7 @@ PrettyTable::register_application(pid_t
info->set_icon(icon);
// move the ref to the map
this->apps[pid] = icon;
- procman_debug("WNCK OK for %u", unsigned(pid));
+ //procman_debug("WNCK OK for %u", unsigned(pid));
}
}
@@ -229,7 +229,7 @@ PrettyTable::set_icon(ProcInfo &info)
getters.push_back(&PrettyTable::get_icon_from_name);
if (has_kthreadd())
{
- procman_debug("kthreadd is running with PID 2");
+ //procman_debug("kthreadd is running with PID 2");
getters.push_back(&PrettyTable::get_icon_for_kernel);
}
getters.push_back(&PrettyTable::get_icon_dummy);
diff -Nrup gnome-system-monitor-2.25.91/src/procactions.cpp gnome-system-monitor-2.25.91.mod/src/procactions.cpp
--- gnome-system-monitor-2.25.91/src/procactions.cpp 2007-01-03 06:15:36.000000000 +0800
+++ gnome-system-monitor-2.25.91.mod/src/procactions.cpp 2009-02-22 19:58:20.190256000 +0800
@@ -128,6 +128,15 @@ kill_single_process (GtkTreeModel *model
if (!info)
return;
+ /*
+ * If the process 0 is a system process, we can't control it even as root
+ */
+ if ((args->signal == SIGTERM) || (args->signal == SIGKILL)){
+ if (info->pid == 0)
+ return;
+ }
+ /* if it is not a system process, we can kill it now */
+
error = kill (info->pid, args->signal);
/* success */
diff -Nrup gnome-system-monitor-2.25.91/src/procdialogs.cpp gnome-system-monitor-2.25.91.mod/src/procdialogs.cpp
--- gnome-system-monitor-2.25.91/src/procdialogs.cpp 2008-05-24 05:44:00.000000000 +0800
+++ gnome-system-monitor-2.25.91.mod/src/procdialogs.cpp 2009-03-04 10:17:21.908309000 +0800
@@ -342,7 +342,7 @@ private:
g_error_free(e);
}
- procman_debug("set %s to %d", this->gconf_key.c_str(), new_value);
+ //procman_debug("set %s to %d", this->gconf_key.c_str(), new_value);
}
const string gconf_key;
@@ -659,7 +659,10 @@ procdialog_create_preferences_dialog (Pr
gtk_box_pack_start (GTK_BOX (hbox2), hbox3, TRUE, TRUE, 0);
update = (gfloat) procdata->config.graph_update_interval;
- adjustment = (GtkAdjustment *) gtk_adjustment_new(update / 1000.0, 0.25,
+ /* The interval is too small, and in some low level machine,
+ cause gconf can't work, so set its min value 1 sec*/
+ /*adjustment = (GtkAdjustment *) gtk_adjustment_new(update / 1000.0, 0.25,*/
+ adjustment = (GtkAdjustment *) gtk_adjustment_new(update / 1000.0, 1,
100.0, 0.25, 1.0, 1.0);
spin_button = gtk_spin_button_new (adjustment, 1.0, 2);
g_signal_connect (G_OBJECT (spin_button), "focus_out_event",
@@ -803,7 +806,7 @@ procdialog_create_root_password_dialog(P
command = procman_action_to_command(type, pid, extra_value);
- procman_debug("Trying to run '%s' as root", command);
+ //procman_debug("Trying to run '%s' as root", command);
if (procman_has_gksu())
ret = procman_gksu_create_root_password_dialog(command);
diff -Nrup gnome-system-monitor-2.25.91/src/procman.cpp gnome-system-monitor-2.25.91.mod/src/procman.cpp
--- gnome-system-monitor-2.25.91/src/procman.cpp 2009-01-03 20:06:10.000000000 +0800
+++ gnome-system-monitor-2.25.91.mod/src/procman.cpp 2009-03-04 10:22:32.037096000 +0800
@@ -147,7 +147,10 @@ timeouts_changed_cb (GConfClient *client
procdata->config.graph_update_interval = gconf_value_get_int (value);
procdata->config.graph_update_interval =
MAX (procdata->config.graph_update_interval,
- 250);
+ /* The interval is too small, and in some low level machine,
+ cause gconf can't work, so set its min value 1 sec*/
+ /* 250);*/
+ 1000);
load_graph_change_speed(procdata->cpu_graph,
procdata->config.graph_update_interval);
load_graph_change_speed(procdata->mem_graph,
@@ -332,10 +335,14 @@ procman_data_new (GConfClient *client)
/* Sanity checks */
swidth = gdk_screen_width ();
sheight = gdk_screen_height ();
- pd->config.width = CLAMP (pd->config.width, 50, swidth);
- pd->config.height = CLAMP (pd->config.height, 50, sheight);
+ pd->config.width = CLAMP (pd->config.width, 50, swidth-2); /* there is a bug in gtk I think, when the width/height
+ become the biggest, the windows alway biggest, so -2 */
+ pd->config.height = CLAMP (pd->config.height, 50, sheight-2);
pd->config.update_interval = MAX (pd->config.update_interval, 1000);
- pd->config.graph_update_interval = MAX (pd->config.graph_update_interval, 250);
+ /* The interval is too small, and in some low level machine,
+ cause gconf can't work, so set its min value 1 sec*/
+ /*pd->config.graph_update_interval = MAX (pd->config.graph_update_interval, 250);*/
+ pd->config.graph_update_interval = MAX (pd->config.graph_update_interval, 1000);
pd->config.disks_update_interval = MAX (pd->config.disks_update_interval, 1000);
pd->config.whose_process = CLAMP (pd->config.whose_process, 0, 2);
pd->config.current_tab = CLAMP(pd->config.current_tab,
@@ -598,9 +605,9 @@ cb_server (const gchar *msg, gpointer us
procdata = *(ProcData**)user_data;
g_assert (procdata != NULL);
- procman_debug("cb_server(%s)", msg);
+ //procman_debug("cb_server(%s)", msg);
if (msg != NULL && procman::SHOW_SYSTEM_TAB_CMD == msg) {
- procman_debug("Changing to PROCMAN_TAB_SYSINFO via bacon message");
+ //procman_debug("Changing to PROCMAN_TAB_SYSINFO via bacon message");
gtk_notebook_set_current_page(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO);
cb_change_current_page(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO, procdata);
} else
@@ -677,7 +684,7 @@ main (int argc, char *argv[])
Gio::init();
Gtk::Main kit(&argc, &argv);
- procman_debug("post gtk_init");
+ //procman_debug("post gtk_init");
conn = bacon_message_connection_new ("gnome-system-monitor");
if (!conn) g_error("Couldn't connect to gnome-system-monitor");
@@ -715,14 +722,14 @@ main (int argc, char *argv[])
glibtop_init ();
- procman_debug("end init");
+ //procman_debug("end init");
procdata = procman_data_new (client);
procdata->client = client;
- procman_debug("begin create_main_window");
+ //procman_debug("begin create_main_window");
create_main_window (procdata);
- procman_debug("end create_main_window");
+ //procman_debug("end create_main_window");
// proctable_update_all (procdata);
@@ -731,14 +738,14 @@ main (int argc, char *argv[])
g_assert(procdata->app);
if (option_group.show_system_tab) {
- procman_debug("Starting with PROCMAN_TAB_SYSINFO by commandline request");
+ //procman_debug("Starting with PROCMAN_TAB_SYSINFO by commandline request");
gtk_notebook_set_current_page(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO);
cb_change_current_page (GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO, procdata);
}
gtk_widget_show(procdata->app);
- procman_debug("begin gtk_main");
+ //procman_debug("begin gtk_main");
kit.run();
procman_free_data (procdata);
diff -Nrup gnome-system-monitor-2.26.2/src/proctable.cpp gnome-system-monitor-2.26.2/src/proctable.cpp
--- gnome-system-monitor-2.26.2/src/proctable.cpp 2009-07-15 15:18:15.325964805 +0800
+++ gnome-system-monitor-2.26.2/src/proctable.cpp 2009-07-15 15:40:34.315280700 +0800
@@ -197,7 +197,7 @@ search_equal_func(GtkTreeModel *model,
GtkWidget *
-proctable_new (ProcData * const procdata)
+proctable_new (ProcData * procdata)
{
GtkWidget *proctree;
GtkWidget *scrolled;
@@ -487,6 +487,18 @@ static void get_process_memory_writable(
glibtop_proc_map buf;
glibtop_map_entry *maps;
+ /* we have to optimize the performance of libgtop, because update the information will occupy too much cpu.
+
+ here I would like to make a little update:set glibtop_proc_map.flags=1,so as to let glibtop_get_proc_map_s()
+ only return the ones this function need: memwritable
+
+ we do the check in glibtop_get_proc_map_s(), don't run the others part which don't need by this function,
+ I think this will accelerate the transaction lots,
+ Also this will not affect the existing codes, because when nobody set glibtop_proc_map.flags,
+ glibtop_get_proc_map() will return all as before. zhua
+ */
+ buf.flags = 1;
+
maps = glibtop_get_proc_map(&buf, info->pid);
gulong memwritable = 0;
@@ -498,6 +510,9 @@ static void get_process_memory_writable(
#else
if (maps[i].perm & GLIBTOP_MAP_PERM_WRITE)
memwritable += maps[i].size;
+
+ if (maps[i].perm & GLIBTOP_MAP_PERM_SHARED)
+ info->memshared += maps[i].shared_clean;
#endif
}
@@ -570,7 +585,7 @@ insert_info_to_tree (ProcInfo *info, Pro
ProcInfo *parent = 0;
- if (not forced)
+ if (not forced && info->pid != 0)
parent = ProcInfo::find(info->ppid);
if (parent) {
@@ -597,7 +612,7 @@ insert_info_to_tree (ProcInfo *info, Pro
procdata->pretty_table.set_icon(*info);
- procman_debug("inserted %d%s", info->pid, (forced ? " (forced)" : ""));
+ //procman_debug("inserted %d%s", info->pid, (forced ? " (forced)" : ""));
}
@@ -612,12 +627,12 @@ remove_info_from_tree (ProcData *procdat
GtkTreeIter child_node;
if (std::find(orphans.begin(), orphans.end(), current) != orphans.end()) {
- procman_debug("[%u] %d already removed from tree", lvl, int(current->pid));
+ //procman_debug("[%u] %d already removed from tree", lvl, int(current->pid));
return;
}
- procman_debug("[%u] pid %d, %d children", lvl, int(current->pid),
- gtk_tree_model_iter_n_children(model, &current->node));
+ //procman_debug("[%u] pid %d, %d children", lvl, int(current->pid),
+ // gtk_tree_model_iter_n_children(model, &current->node));
// it is not possible to iterate&erase over a treeview so instead we
// just pop one child after another and recursively remove it and
@@ -757,7 +772,7 @@ refresh_list (ProcData *procdata, const
++next;
if (pids.find(info->pid) == pids.end()) {
- procman_debug("ripping %d", info->pid);
+ //procman_debug("ripping %d", info->pid);
remove_info_from_tree(procdata, model, info, addition);
addition.remove(info);
ProcInfo::all.erase(it);
@@ -785,12 +800,12 @@ refresh_list (ProcData *procdata, const
while (not addition.empty()) {
- procman_debug("looking for %d parents", int(addition.size()));
+ //procman_debug("looking for %d parents", int(addition.size()));
ProcList::iterator it(addition.begin());
while (it != addition.end()) {
- procman_debug("looking for %d's parent with ppid %d",
- int((*it)->pid), int((*it)->ppid));
+ //procman_debug("looking for %d's parent with ppid %d",
+ //int((*it)->pid), int((*it)->ppid));
// inserts the process in the treeview if :
@@ -895,7 +910,7 @@ proctable_update_list (ProcData * const
void
-proctable_update_all (ProcData * const procdata)
+proctable_update_all (ProcData * procdata)
{
char* string;
diff -Nrup gnome-system-monitor-2.25.91/src/selection.cpp gnome-system-monitor-2.25.91.mod/src/selection.cpp
--- gnome-system-monitor-2.25.91/src/selection.cpp 2007-06-30 02:28:26.000000000 +0800
+++ gnome-system-monitor-2.25.91.mod/src/selection.cpp 2009-03-04 12:00:41.995124000 +0800
@@ -33,10 +33,10 @@ namespace procman
if (ProcInfo* proc = ProcInfo::find(*it))
{
gtk_tree_selection_select_iter(selection, &proc->node);
- procman_debug("Re-selected process %u", unsigned(*it));
+ //procman_debug("Re-selected process %u", unsigned(*it));
}
- else
- procman_debug("Could not find process %u, cannot re-select it", unsigned(*it));
+ //else
+ //procman_debug("Could not find process %u, cannot re-select it", unsigned(*it));
}
}
}
diff -Nrup gnome-system-monitor-2.25.91/src/smooth_refresh.cpp gnome-system-monitor-2.25.91.mod/src/smooth_refresh.cpp
--- gnome-system-monitor-2.25.91/src/smooth_refresh.cpp 2009-01-19 02:16:39.000000000 +0800
+++ gnome-system-monitor-2.25.91.mod/src/smooth_refresh.cpp 2009-03-04 11:31:10.615230000 +0800
@@ -65,7 +65,7 @@ void SmoothRefresh::load_gconf_value(GCo
this->active = value ? gconf_value_get_bool(value) : KEY_DEFAULT_VALUE;
if (this->active)
- procman_debug("smooth_refresh is enabled");
+ //procman_debug("smooth_refresh is enabled");
if (own_value and value)
gconf_value_free(value);
@@ -159,10 +159,10 @@ SmoothRefresh::get(guint &new_interval)
if (changed) {
- procman_debug("CPU usage is %3u%%, changed refresh_interval to %u (config %u)",
+ /*procman_debug("CPU usage is %3u%%, changed refresh_interval to %u (config %u)",
this->last_pcpu,
this->interval,
- config_interval);
+ config_interval);*/
}
g_assert(this->interval == new_interval);
diff -Nrup gnome-system-monitor-2.25.91/src/sysinfo.cpp gnome-system-monitor-2.25.91.mod/src/sysinfo.cpp
--- gnome-system-monitor-2.25.91/src/sysinfo.cpp 2009-01-21 05:13:28.000000000 +0800
+++ gnome-system-monitor-2.25.91.mod/src/sysinfo.cpp 2009-03-04 10:18:54.373979000 +0800
@@ -273,7 +273,7 @@ namespace {
channel->close();
Glib::spawn_close_pid(pid);
- procman_debug("lsb_release output = '%s'", content.c_str());
+ //procman_debug("lsb_release output = '%s'", content.c_str());
string release, codename;
std::istringstream input(content);
diff -Nrup gnome-system-monitor-2.25.91/src/util.cpp gnome-system-monitor-2.25.91.mod/src/util.cpp
--- gnome-system-monitor-2.25.91/src/util.cpp 2009-02-17 02:21:44.000000000 +0800
+++ gnome-system-monitor-2.25.91.mod/src/util.cpp 2009-03-04 10:21:38.634398000 +0800
@@ -192,7 +192,7 @@ load_symbols(const char *module, ...)
if (!mod)
return FALSE;
- procman_debug("Found %s", module);
+ //procman_debug("Found %s", module);
va_start(args, module);
@@ -208,10 +208,10 @@ load_symbols(const char *module, ...)
symbol = va_arg(args, void**);
if (g_module_symbol(mod, name, symbol)) {
- procman_debug("Loaded %s from %s", name, module);
+ //procman_debug("Loaded %s from %s", name, module);
}
else {
- procman_debug("Could not load %s from %s", name, module);
+ //procman_debug("Could not load %s from %s", name, module);
found_all = FALSE;
break;
}
diff -Nrup gnome-system-monitor-2.26.0/src/util.h gnome-system-monitor-2.26.0-new/src/util.h
--- gnome-system-monitor-2.26.0/src/util.h 2009-02-27 21:50:16.000000000 +0000
+++ gnome-system-monitor-2.26.0-new/src/util.h 2009-04-09 13:50:15.164866011 +0100
@@ -46,7 +46,7 @@ procman_debug_real(const char *file, int
inline string make_string(char *c_str)
{
if (!c_str) {
- procman_debug("NULL string");
+ //procman_debug("NULL string");
return string();
}