1 diff -Nrup gnome-system-monitor-2.25.91/configure.in gnome-system-monitor-2.25.91.mod/configure.in 2 --- gnome-system-monitor-2.25.91/configure.in 2009-02-17 02:07:36.000000000 +0800 3 +++ gnome-system-monitor-2.25.91.mod/configure.in 2009-03-04 10:31:31.831892000 +0800 4 @@ -56,13 +56,13 @@ if test "$GCC" = "yes" -a "$set_more_war 5 -Wcast-align -Wsign-compare \ 6 -std=gnu89 \ 7 $CFLAGS" 8 - CXXFLAGS="-Wall -std=c++98 $CXXFLAGS" 9 + CXXFLAGS="-Wall -std=c++98 $CXXFLAGS -features=extensions" 10 else 11 AC_MSG_RESULT(no) 12 fi 13 14 -dnl CXXFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden $CXXFLAGS" 15 -dnl CXXFLAGS="-fvisibility-inlines-hidden $CXXFLAGS" 16 +dnl CXXFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden -features=extensions $CXXFLAGS" 17 +dnl CXXFLAGS="-fvisibility-inlines-hidden -features=extensions $CXXFLAGS" 18 19 AM_GCONF_SOURCE_2 20 21 diff -Nrup gnome-system-monitor-2.25.91/src/load-graph.cpp gnome-system-monitor-2.25.91.mod/src/load-graph.cpp 22 --- gnome-system-monitor-2.25.91/src/load-graph.cpp 2008-08-31 21:29:57.000000000 +0800 23 +++ gnome-system-monitor-2.25.91.mod/src/load-graph.cpp 2009-03-04 11:26:07.230508000 +0800 24 @@ -435,7 +435,7 @@ net_scale (LoadGraph *g, unsigned din, u 25 } 26 } 27 28 - procman_debug("rescale dmax = %u max = %u new_max = %u", dmax, g->net.max, new_max); 29 + //procman_debug("rescale dmax = %u max = %u new_max = %u", dmax, g->net.max, new_max); 30 31 g->net.max = new_max; 32 33 diff -Nrup gnome-system-monitor-2.25.91/src/lsof.cpp gnome-system-monitor-2.25.91.mod/src/lsof.cpp 34 --- gnome-system-monitor-2.25.91/src/lsof.cpp 2008-05-24 05:44:00.000000000 +0800 35 +++ gnome-system-monitor-2.25.91.mod/src/lsof.cpp 2009-03-04 10:16:57.082704000 +0800 36 @@ -95,13 +95,13 @@ namespace 37 38 GUI() 39 { 40 - procman_debug("New Lsof GUI %p", this); 41 + //procman_debug("New Lsof GUI %p", this); 42 } 43 44 45 ~GUI() 46 { 47 - procman_debug("Destroying Lsof GUI %p", this); 48 + //procman_debug("Destroying Lsof GUI %p", this); 49 } 50 51 52 diff -Nrup gnome-system-monitor-2.25.91/src/openfiles.cpp gnome-system-monitor-2.25.91.mod/src/openfiles.cpp 53 --- gnome-system-monitor-2.25.91/src/openfiles.cpp 2008-09-12 03:55:34.000000000 +0800 54 +++ gnome-system-monitor-2.25.91.mod/src/openfiles.cpp 2009-03-04 11:54:44.460430000 +0800 55 @@ -67,7 +67,7 @@ friendlier_hostname(const char *addr_str 56 goto failsafe; 57 58 if (getnameinfo(res->ai_addr, res->ai_addrlen, hostname, 59 - sizeof hostname, service, sizeof service, NI_IDN)) 60 + sizeof hostname, service, sizeof service, NI_MAXSERV)) 61 goto failsafe; 62 63 if (res) freeaddrinfo(res); 64 diff -Nrup gnome-system-monitor-2.25.91/src/prettytable.cpp gnome-system-monitor-2.25.91.mod/src/prettytable.cpp 65 --- gnome-system-monitor-2.25.91/src/prettytable.cpp 2009-01-19 02:01:09.000000000 +0800 66 +++ gnome-system-monitor-2.25.91.mod/src/prettytable.cpp 2009-03-04 10:17:07.130460000 +0800 67 @@ -77,7 +77,7 @@ PrettyTable::register_application(pid_t 68 info->set_icon(icon); 69 // move the ref to the map 70 this->apps[pid] = icon; 71 - procman_debug("WNCK OK for %u", unsigned(pid)); 72 + //procman_debug("WNCK OK for %u", unsigned(pid)); 73 } 74 } 75 76 @@ -229,7 +229,7 @@ PrettyTable::set_icon(ProcInfo &info) 77 getters.push_back(&PrettyTable::get_icon_from_name); 78 if (has_kthreadd()) 79 { 80 - procman_debug("kthreadd is running with PID 2"); 81 + //procman_debug("kthreadd is running with PID 2"); 82 getters.push_back(&PrettyTable::get_icon_for_kernel); 83 } 84 getters.push_back(&PrettyTable::get_icon_dummy); 85 diff -Nrup gnome-system-monitor-2.25.91/src/procactions.cpp gnome-system-monitor-2.25.91.mod/src/procactions.cpp 86 --- gnome-system-monitor-2.25.91/src/procactions.cpp 2007-01-03 06:15:36.000000000 +0800 87 +++ gnome-system-monitor-2.25.91.mod/src/procactions.cpp 2009-02-22 19:58:20.190256000 +0800 88 @@ -128,6 +128,15 @@ kill_single_process (GtkTreeModel *model 89 if (!info) 90 return; 91 92 + /* 93 + * If the process 0 is a system process, we can't control it even as root 94 + */ 95 + if ((args->signal == SIGTERM) || (args->signal == SIGKILL)){ 96 + if (info->pid == 0) 97 + return; 98 + } 99 + /* if it is not a system process, we can kill it now */ 100 + 101 error = kill (info->pid, args->signal); 102 103 /* success */ 104 diff -Nrup gnome-system-monitor-2.25.91/src/procdialogs.cpp gnome-system-monitor-2.25.91.mod/src/procdialogs.cpp 105 --- gnome-system-monitor-2.25.91/src/procdialogs.cpp 2008-05-24 05:44:00.000000000 +0800 106 +++ gnome-system-monitor-2.25.91.mod/src/procdialogs.cpp 2009-03-04 10:17:21.908309000 +0800 107 @@ -342,7 +342,7 @@ private: 108 g_error_free(e); 109 } 110 111 - procman_debug("set %s to %d", this->gconf_key.c_str(), new_value); 112 + //procman_debug("set %s to %d", this->gconf_key.c_str(), new_value); 113 } 114 115 const string gconf_key; 116 @@ -659,7 +659,10 @@ procdialog_create_preferences_dialog (Pr 117 gtk_box_pack_start (GTK_BOX (hbox2), hbox3, TRUE, TRUE, 0); 118 119 update = (gfloat) procdata->config.graph_update_interval; 120 - adjustment = (GtkAdjustment *) gtk_adjustment_new(update / 1000.0, 0.25, 121 + /* The interval is too small, and in some low level machine, 122 + cause gconf can't work, so set its min value 1 sec*/ 123 + /*adjustment = (GtkAdjustment *) gtk_adjustment_new(update / 1000.0, 0.25,*/ 124 + adjustment = (GtkAdjustment *) gtk_adjustment_new(update / 1000.0, 1, 125 100.0, 0.25, 1.0, 1.0); 126 spin_button = gtk_spin_button_new (adjustment, 1.0, 2); 127 g_signal_connect (G_OBJECT (spin_button), "focus_out_event", 128 @@ -803,7 +806,7 @@ procdialog_create_root_password_dialog(P 129 130 command = procman_action_to_command(type, pid, extra_value); 131 132 - procman_debug("Trying to run '%s' as root", command); 133 + //procman_debug("Trying to run '%s' as root", command); 134 135 if (procman_has_gksu()) 136 ret = procman_gksu_create_root_password_dialog(command); 137 diff -Nrup gnome-system-monitor-2.25.91/src/procman.cpp gnome-system-monitor-2.25.91.mod/src/procman.cpp 138 --- gnome-system-monitor-2.25.91/src/procman.cpp 2009-01-03 20:06:10.000000000 +0800 139 +++ gnome-system-monitor-2.25.91.mod/src/procman.cpp 2009-03-04 10:22:32.037096000 +0800 140 @@ -147,7 +147,10 @@ timeouts_changed_cb (GConfClient *client 141 procdata->config.graph_update_interval = gconf_value_get_int (value); 142 procdata->config.graph_update_interval = 143 MAX (procdata->config.graph_update_interval, 144 - 250); 145 + /* The interval is too small, and in some low level machine, 146 + cause gconf can't work, so set its min value 1 sec*/ 147 + /* 250);*/ 148 + 1000); 149 load_graph_change_speed(procdata->cpu_graph, 150 procdata->config.graph_update_interval); 151 load_graph_change_speed(procdata->mem_graph, 152 @@ -332,10 +335,14 @@ procman_data_new (GConfClient *client) 153 /* Sanity checks */ 154 swidth = gdk_screen_width (); 155 sheight = gdk_screen_height (); 156 - pd->config.width = CLAMP (pd->config.width, 50, swidth); 157 - pd->config.height = CLAMP (pd->config.height, 50, sheight); 158 + pd->config.width = CLAMP (pd->config.width, 50, swidth-2); /* there is a bug in gtk I think, when the width/height 159 + become the biggest, the windows alway biggest, so -2 */ 160 + pd->config.height = CLAMP (pd->config.height, 50, sheight-2); 161 pd->config.update_interval = MAX (pd->config.update_interval, 1000); 162 - pd->config.graph_update_interval = MAX (pd->config.graph_update_interval, 250); 163 + /* The interval is too small, and in some low level machine, 164 + cause gconf can't work, so set its min value 1 sec*/ 165 + /*pd->config.graph_update_interval = MAX (pd->config.graph_update_interval, 250);*/ 166 + pd->config.graph_update_interval = MAX (pd->config.graph_update_interval, 1000); 167 pd->config.disks_update_interval = MAX (pd->config.disks_update_interval, 1000); 168 pd->config.whose_process = CLAMP (pd->config.whose_process, 0, 2); 169 pd->config.current_tab = CLAMP(pd->config.current_tab, 170 @@ -598,9 +605,9 @@ cb_server (const gchar *msg, gpointer us 171 procdata = *(ProcData**)user_data; 172 g_assert (procdata != NULL); 173 174 - procman_debug("cb_server(%s)", msg); 175 + //procman_debug("cb_server(%s)", msg); 176 if (msg != NULL && procman::SHOW_SYSTEM_TAB_CMD == msg) { 177 - procman_debug("Changing to PROCMAN_TAB_SYSINFO via bacon message"); 178 + //procman_debug("Changing to PROCMAN_TAB_SYSINFO via bacon message"); 179 gtk_notebook_set_current_page(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO); 180 cb_change_current_page(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO, procdata); 181 } else 182 @@ -677,7 +684,7 @@ main (int argc, char *argv[]) 183 184 Gio::init(); 185 Gtk::Main kit(&argc, &argv); 186 - procman_debug("post gtk_init"); 187 + //procman_debug("post gtk_init"); 188 189 conn = bacon_message_connection_new ("gnome-system-monitor"); 190 if (!conn) g_error("Couldn't connect to gnome-system-monitor"); 191 @@ -715,14 +722,14 @@ main (int argc, char *argv[]) 192 193 glibtop_init (); 194 195 - procman_debug("end init"); 196 + //procman_debug("end init"); 197 198 procdata = procman_data_new (client); 199 procdata->client = client; 200 201 - procman_debug("begin create_main_window"); 202 + //procman_debug("begin create_main_window"); 203 create_main_window (procdata); 204 - procman_debug("end create_main_window"); 205 + //procman_debug("end create_main_window"); 206 207 // proctable_update_all (procdata); 208 209 @@ -731,14 +738,14 @@ main (int argc, char *argv[]) 210 g_assert(procdata->app); 211 212 if (option_group.show_system_tab) { 213 - procman_debug("Starting with PROCMAN_TAB_SYSINFO by commandline request"); 214 + //procman_debug("Starting with PROCMAN_TAB_SYSINFO by commandline request"); 215 gtk_notebook_set_current_page(GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO); 216 cb_change_current_page (GTK_NOTEBOOK(procdata->notebook), PROCMAN_TAB_SYSINFO, procdata); 217 } 218 219 gtk_widget_show(procdata->app); 220 221 - procman_debug("begin gtk_main"); 222 + //procman_debug("begin gtk_main"); 223 kit.run(); 224 225 procman_free_data (procdata); 226 diff -Nrup gnome-system-monitor-2.26.2/src/proctable.cpp gnome-system-monitor-2.26.2/src/proctable.cpp 227 --- gnome-system-monitor-2.26.2/src/proctable.cpp 2009-07-15 15:18:15.325964805 +0800 228 +++ gnome-system-monitor-2.26.2/src/proctable.cpp 2009-07-15 15:40:34.315280700 +0800 229 @@ -197,7 +197,7 @@ search_equal_func(GtkTreeModel *model, 230 231 232 GtkWidget * 233 -proctable_new (ProcData * const procdata) 234 +proctable_new (ProcData * procdata) 235 { 236 GtkWidget *proctree; 237 GtkWidget *scrolled; 238 @@ -487,6 +487,18 @@ static void get_process_memory_writable( 239 glibtop_proc_map buf; 240 glibtop_map_entry *maps; 241 242 + /* we have to optimize the performance of libgtop, because update the information will occupy too much cpu. 243 + 244 + here I would like to make a little update:set glibtop_proc_map.flags=1,so as to let glibtop_get_proc_map_s() 245 + only return the ones this function need: memwritable 246 + 247 + we do the check in glibtop_get_proc_map_s(), don't run the others part which don't need by this function, 248 + I think this will accelerate the transaction lots, 249 + Also this will not affect the existing codes, because when nobody set glibtop_proc_map.flags, 250 + glibtop_get_proc_map() will return all as before. zhua 251 + */ 252 + buf.flags = 1; 253 + 254 maps = glibtop_get_proc_map(&buf, info->pid); 255 256 gulong memwritable = 0; 257 @@ -498,6 +510,9 @@ static void get_process_memory_writable( 258 #else 259 if (maps[i].perm & GLIBTOP_MAP_PERM_WRITE) 260 memwritable += maps[i].size; 261 + 262 + if (maps[i].perm & GLIBTOP_MAP_PERM_SHARED) 263 + info->memshared += maps[i].shared_clean; 264 #endif 265 } 266 267 @@ -570,7 +585,7 @@ insert_info_to_tree (ProcInfo *info, Pro 268 269 ProcInfo *parent = 0; 270 271 - if (not forced) 272 + if (not forced && info->pid != 0) 273 parent = ProcInfo::find(info->ppid); 274 275 if (parent) { 276 @@ -597,7 +612,7 @@ insert_info_to_tree (ProcInfo *info, Pro 277 278 procdata->pretty_table.set_icon(*info); 279 280 - procman_debug("inserted %d%s", info->pid, (forced ? " (forced)" : "")); 281 + //procman_debug("inserted %d%s", info->pid, (forced ? " (forced)" : "")); 282 } 283 284 285 @@ -612,12 +627,12 @@ remove_info_from_tree (ProcData *procdat 286 GtkTreeIter child_node; 287 288 if (std::find(orphans.begin(), orphans.end(), current) != orphans.end()) { 289 - procman_debug("[%u] %d already removed from tree", lvl, int(current->pid)); 290 + //procman_debug("[%u] %d already removed from tree", lvl, int(current->pid)); 291 return; 292 } 293 294 - procman_debug("[%u] pid %d, %d children", lvl, int(current->pid), 295 - gtk_tree_model_iter_n_children(model, ¤t->node)); 296 + //procman_debug("[%u] pid %d, %d children", lvl, int(current->pid), 297 + // gtk_tree_model_iter_n_children(model, ¤t->node)); 298 299 // it is not possible to iterate&erase over a treeview so instead we 300 // just pop one child after another and recursively remove it and 301 @@ -757,7 +772,7 @@ refresh_list (ProcData *procdata, const 302 ++next; 303 304 if (pids.find(info->pid) == pids.end()) { 305 - procman_debug("ripping %d", info->pid); 306 + //procman_debug("ripping %d", info->pid); 307 remove_info_from_tree(procdata, model, info, addition); 308 addition.remove(info); 309 ProcInfo::all.erase(it); 310 @@ -785,12 +800,12 @@ refresh_list (ProcData *procdata, const 311 312 313 while (not addition.empty()) { 314 - procman_debug("looking for %d parents", int(addition.size())); 315 + //procman_debug("looking for %d parents", int(addition.size())); 316 ProcList::iterator it(addition.begin()); 317 318 while (it != addition.end()) { 319 - procman_debug("looking for %d's parent with ppid %d", 320 - int((*it)->pid), int((*it)->ppid)); 321 + //procman_debug("looking for %d's parent with ppid %d", 322 + //int((*it)->pid), int((*it)->ppid)); 323 324 325 // inserts the process in the treeview if : 326 @@ -895,7 +910,7 @@ proctable_update_list (ProcData * const 327 328 329 void 330 -proctable_update_all (ProcData * const procdata) 331 +proctable_update_all (ProcData * procdata) 332 { 333 char* string; 334 335 diff -Nrup gnome-system-monitor-2.25.91/src/selection.cpp gnome-system-monitor-2.25.91.mod/src/selection.cpp 336 --- gnome-system-monitor-2.25.91/src/selection.cpp 2007-06-30 02:28:26.000000000 +0800 337 +++ gnome-system-monitor-2.25.91.mod/src/selection.cpp 2009-03-04 12:00:41.995124000 +0800 338 @@ -33,10 +33,10 @@ namespace procman 339 if (ProcInfo* proc = ProcInfo::find(*it)) 340 { 341 gtk_tree_selection_select_iter(selection, &proc->node); 342 - procman_debug("Re-selected process %u", unsigned(*it)); 343 + //procman_debug("Re-selected process %u", unsigned(*it)); 344 } 345 - else 346 - procman_debug("Could not find process %u, cannot re-select it", unsigned(*it)); 347 + //else 348 + //procman_debug("Could not find process %u, cannot re-select it", unsigned(*it)); 349 } 350 } 351 } 352 diff -Nrup gnome-system-monitor-2.25.91/src/smooth_refresh.cpp gnome-system-monitor-2.25.91.mod/src/smooth_refresh.cpp 353 --- gnome-system-monitor-2.25.91/src/smooth_refresh.cpp 2009-01-19 02:16:39.000000000 +0800 354 +++ gnome-system-monitor-2.25.91.mod/src/smooth_refresh.cpp 2009-03-04 11:31:10.615230000 +0800 355 @@ -65,7 +65,7 @@ void SmoothRefresh::load_gconf_value(GCo 356 this->active = value ? gconf_value_get_bool(value) : KEY_DEFAULT_VALUE; 357 358 if (this->active) 359 - procman_debug("smooth_refresh is enabled"); 360 + //procman_debug("smooth_refresh is enabled"); 361 362 if (own_value and value) 363 gconf_value_free(value); 364 @@ -159,10 +159,10 @@ SmoothRefresh::get(guint &new_interval) 365 366 367 if (changed) { 368 - procman_debug("CPU usage is %3u%%, changed refresh_interval to %u (config %u)", 369 + /*procman_debug("CPU usage is %3u%%, changed refresh_interval to %u (config %u)", 370 this->last_pcpu, 371 this->interval, 372 - config_interval); 373 + config_interval);*/ 374 } 375 376 g_assert(this->interval == new_interval); 377 diff -Nrup gnome-system-monitor-2.25.91/src/sysinfo.cpp gnome-system-monitor-2.25.91.mod/src/sysinfo.cpp 378 --- gnome-system-monitor-2.25.91/src/sysinfo.cpp 2009-01-21 05:13:28.000000000 +0800 379 +++ gnome-system-monitor-2.25.91.mod/src/sysinfo.cpp 2009-03-04 10:18:54.373979000 +0800 380 @@ -273,7 +273,7 @@ namespace { 381 channel->close(); 382 Glib::spawn_close_pid(pid); 383 384 - procman_debug("lsb_release output = '%s'", content.c_str()); 385 + //procman_debug("lsb_release output = '%s'", content.c_str()); 386 387 string release, codename; 388 std::istringstream input(content); 389 diff -Nrup gnome-system-monitor-2.25.91/src/util.cpp gnome-system-monitor-2.25.91.mod/src/util.cpp 390 --- gnome-system-monitor-2.25.91/src/util.cpp 2009-02-17 02:21:44.000000000 +0800 391 +++ gnome-system-monitor-2.25.91.mod/src/util.cpp 2009-03-04 10:21:38.634398000 +0800 392 @@ -192,7 +192,7 @@ load_symbols(const char *module, ...) 393 if (!mod) 394 return FALSE; 395 396 - procman_debug("Found %s", module); 397 + //procman_debug("Found %s", module); 398 399 va_start(args, module); 400 401 @@ -208,10 +208,10 @@ load_symbols(const char *module, ...) 402 symbol = va_arg(args, void**); 403 404 if (g_module_symbol(mod, name, symbol)) { 405 - procman_debug("Loaded %s from %s", name, module); 406 + //procman_debug("Loaded %s from %s", name, module); 407 } 408 else { 409 - procman_debug("Could not load %s from %s", name, module); 410 + //procman_debug("Could not load %s from %s", name, module); 411 found_all = FALSE; 412 break; 413 } 414 diff -Nrup gnome-system-monitor-2.26.0/src/util.h gnome-system-monitor-2.26.0-new/src/util.h 415 --- gnome-system-monitor-2.26.0/src/util.h 2009-02-27 21:50:16.000000000 +0000 416 +++ gnome-system-monitor-2.26.0-new/src/util.h 2009-04-09 13:50:15.164866011 +0100 417 @@ -46,7 +46,7 @@ procman_debug_real(const char *file, int 418 inline string make_string(char *c_str) 419 { 420 if (!c_str) { 421 - procman_debug("NULL string"); 422 + //procman_debug("NULL string"); 423 return string(); 424 } 425