summaryrefslogtreecommitdiff
path: root/src/procman.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/procman.h')
-rw-r--r--src/procman.h270
1 files changed, 135 insertions, 135 deletions
diff --git a/src/procman.h b/src/procman.h
index b838fc2..6b934e3 100644
--- a/src/procman.h
+++ b/src/procman.h
@@ -44,9 +44,9 @@ struct LoadGraph;
enum
{
- ALL_PROCESSES,
- MY_PROCESSES,
- ACTIVE_PROCESSES
+ ALL_PROCESSES,
+ MY_PROCESSES,
+ ACTIVE_PROCESSES
};
@@ -56,176 +56,176 @@ static const unsigned MAX_UPDATE_INTERVAL = 100 * 1000;
namespace procman
{
- extern const std::string SHOW_SYSTEM_TAB_CMD;
+ extern const std::string SHOW_SYSTEM_TAB_CMD;
}
enum ProcmanTab
{
- PROCMAN_TAB_SYSINFO,
- PROCMAN_TAB_PROCESSES,
- PROCMAN_TAB_RESOURCES,
- PROCMAN_TAB_DISKS
+ PROCMAN_TAB_SYSINFO,
+ PROCMAN_TAB_PROCESSES,
+ PROCMAN_TAB_RESOURCES,
+ PROCMAN_TAB_DISKS
};
struct ProcConfig
{
- gint width;
- gint height;
- gboolean show_kill_warning;
- gboolean show_tree;
- gboolean show_all_fs;
- int update_interval;
- int graph_update_interval;
- int disks_update_interval;
- gint whose_process;
- gint current_tab;
- GdkColor cpu_color[GLIBTOP_NCPU];
- GdkColor mem_color;
- GdkColor swap_color;
- GdkColor net_in_color;
- GdkColor net_out_color;
- GdkColor bg_color;
- GdkColor frame_color;
- gint num_cpus;
- bool solaris_mode;
- bool network_in_bits;
+ gint width;
+ gint height;
+ gboolean show_kill_warning;
+ gboolean show_tree;
+ gboolean show_all_fs;
+ int update_interval;
+ int graph_update_interval;
+ int disks_update_interval;
+ gint whose_process;
+ gint current_tab;
+ GdkColor cpu_color[GLIBTOP_NCPU];
+ GdkColor mem_color;
+ GdkColor swap_color;
+ GdkColor net_in_color;
+ GdkColor net_out_color;
+ GdkColor bg_color;
+ GdkColor frame_color;
+ gint num_cpus;
+ bool solaris_mode;
+ bool network_in_bits;
};
struct MutableProcInfo
{
- MutableProcInfo()
- : status(0)
- { }
-
- std::string user;
-
- gchar wchan[40];
-
- // all these members are filled with libgtop which uses
- // guint64 (to have fixed size data) but we don't need more
- // than an unsigned long (even for 32bit apps on a 64bit
- // kernel) as these data are amounts, not offsets.
- gulong vmsize;
- gulong memres;
- gulong memshared;
- gulong memwritable;
- gulong mem;
-
- // wnck gives an unsigned long
- gulong memxserver;
-
- gulong start_time;
- guint64 cpu_time;
- guint status;
- guint pcpu;
- gint nice;
+MutableProcInfo()
+ : status(0)
+ { }
+
+ std::string user;
+
+ gchar wchan[40];
+
+ // all these members are filled with libgtop which uses
+ // guint64 (to have fixed size data) but we don't need more
+ // than an unsigned long (even for 32bit apps on a 64bit
+ // kernel) as these data are amounts, not offsets.
+ gulong vmsize;
+ gulong memres;
+ gulong memshared;
+ gulong memwritable;
+ gulong mem;
+
+ // wnck gives an unsigned long
+ gulong memxserver;
+
+ gulong start_time;
+ guint64 cpu_time;
+ guint status;
+ guint pcpu;
+ gint nice;
};
class ProcInfo
- : public MutableProcInfo
+: public MutableProcInfo
{
- /* undefined */ ProcInfo& operator=(const ProcInfo&);
- /* undefined */ ProcInfo(const ProcInfo&);
+ /* undefined */ ProcInfo& operator=(const ProcInfo&);
+ /* undefined */ ProcInfo(const ProcInfo&);
- typedef std::map<guint, std::string> UserMap;
- /* cached username */
- static UserMap users;
+ typedef std::map<guint, std::string> UserMap;
+ /* cached username */
+ static UserMap users;
- public:
+ public:
- // TODO: use a set instead
- // sorted by pid. The map has a nice property : it is sorted
- // by pid so this helps a lot when looking for the parent node
- // as ppid is nearly always < pid.
- typedef std::map<pid_t, ProcInfo*> List;
- typedef List::iterator Iterator;
+ // TODO: use a set instead
+ // sorted by pid. The map has a nice property : it is sorted
+ // by pid so this helps a lot when looking for the parent node
+ // as ppid is nearly always < pid.
+ typedef std::map<pid_t, ProcInfo*> List;
+ typedef List::iterator Iterator;
- static List all;
+ static List all;
- static ProcInfo* find(pid_t pid);
- static Iterator begin() { return ProcInfo::all.begin(); }
- static Iterator end() { return ProcInfo::all.end(); }
+ static ProcInfo* find(pid_t pid);
+ static Iterator begin() { return ProcInfo::all.begin(); }
+ static Iterator end() { return ProcInfo::all.end(); }
- ProcInfo(pid_t pid);
- ~ProcInfo();
- // adds one more ref to icon
- void set_icon(Glib::RefPtr<Gdk::Pixbuf> icon);
- void set_user(guint uid);
+ ProcInfo(pid_t pid);
+ ~ProcInfo();
+ // adds one more ref to icon
+ void set_icon(Glib::RefPtr<Gdk::Pixbuf> icon);
+ void set_user(guint uid);
- GtkTreeIter node;
- Glib::RefPtr<Gdk::Pixbuf> pixbuf;
- gchar *tooltip;
- gchar *name;
- gchar *arguments;
+ GtkTreeIter node;
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf;
+ gchar *tooltip;
+ gchar *name;
+ gchar *arguments;
- gchar *security_context;
+ gchar *security_context;
- const guint pid;
- guint ppid;
- guint uid;
+ const guint pid;
+ guint ppid;
+ guint uid;
// private:
- // tracks cpu time per process keeps growing because if a
- // ProcInfo is deleted this does not mean that the process is
- // not going to be recreated on the next update. For example,
- // if dependencies + (My or Active), the proclist is cleared
- // on each update. This is a workaround
- static std::map<pid_t, guint64> cpu_times;
+ // tracks cpu time per process keeps growing because if a
+ // ProcInfo is deleted this does not mean that the process is
+ // not going to be recreated on the next update. For example,
+ // if dependencies + (My or Active), the proclist is cleared
+ // on each update. This is a workaround
+ static std::map<pid_t, guint64> cpu_times;
};
struct ProcData
{
- // lazy initialization
- static ProcData* get_instance();
-
- GtkUIManager *uimanager;
- GtkActionGroup *action_group;
- GtkWidget *statusbar;
- gint tip_message_cid;
- GtkWidget *tree;
- GtkWidget *loadavg;
- GtkWidget *endprocessbutton;
- GtkWidget *popup_menu;
- GtkWidget *disk_list;
- GtkWidget *notebook;
- ProcConfig config;
- LoadGraph *cpu_graph;
- LoadGraph *mem_graph;
- LoadGraph *net_graph;
- gint cpu_label_fixed_width;
- gint net_label_fixed_width;
- ProcInfo *selected_process;
- GtkTreeSelection *selection;
- guint timeout;
- guint disk_timeout;
-
- PrettyTable pretty_table;
-
- GSettings *settings;
- GtkWidget *app;
- GtkUIManager *menu;
-
- unsigned frequency;
-
- SmoothRefresh *smooth_refresh;
-
- guint64 cpu_total_time;
- guint64 cpu_total_time_last;
+ // lazy initialization
+ static ProcData* get_instance();
+
+ GtkUIManager *uimanager;
+ GtkActionGroup *action_group;
+ GtkWidget *statusbar;
+ gint tip_message_cid;
+ GtkWidget *tree;
+ GtkWidget *loadavg;
+ GtkWidget *endprocessbutton;
+ GtkWidget *popup_menu;
+ GtkWidget *disk_list;
+ GtkWidget *notebook;
+ ProcConfig config;
+ LoadGraph *cpu_graph;
+ LoadGraph *mem_graph;
+ LoadGraph *net_graph;
+ gint cpu_label_fixed_width;
+ gint net_label_fixed_width;
+ ProcInfo *selected_process;
+ GtkTreeSelection *selection;
+ guint timeout;
+ guint disk_timeout;
+
+ PrettyTable pretty_table;
+
+ GSettings *settings;
+ GtkWidget *app;
+ GtkUIManager *menu;
+
+ unsigned frequency;
+
+ SmoothRefresh *smooth_refresh;
+
+ guint64 cpu_total_time;
+ guint64 cpu_total_time_last;
private:
- ProcData();
- /* undefined */ ProcData(const ProcData &);
- /* undefined */ ProcData& operator=(const ProcData &);
+ ProcData();
+ /* undefined */ ProcData(const ProcData &);
+ /* undefined */ ProcData& operator=(const ProcData &);
};
-void procman_save_config (ProcData *data);
+void procman_save_config (ProcData *data);
void procman_save_tree_state (GSettings *settings, GtkWidget *tree, const gchar *prefix);
gboolean procman_get_tree_state (GSettings *settings, GtkWidget *tree, const gchar *prefix);
@@ -235,15 +235,15 @@ gboolean procman_get_tree_state (GSettings *settings, GtkWidget *tree, const
struct ReniceArgs
{
- ProcData *procdata;
- int nice_value;
+ ProcData *procdata;
+ int nice_value;
};
struct KillArgs
{
- ProcData *procdata;
- int signal;
+ ProcData *procdata;
+ int signal;
};
#endif /* _PROCMAN_PROCMAN_H_ */