~ubuntu-branches/ubuntu/oneiric/gnome-system-monitor/oneiric-proposed

« back to all changes in this revision

Viewing changes to src/procman.h

  • Committer: Bazaar Package Importer
  • Author(s): Loic Minier
  • Date: 2005-08-26 18:38:24 UTC
  • Revision ID: james.westby@ubuntu.com-20050826183824-zh2978nxikpkfxyd
Tags: upstream-2.8.1
ImportĀ upstreamĀ versionĀ 2.8.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Procman
 
2
 * Copyright (C) 2001 Kevin Vandersloot
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU General Public License
 
6
 * as published by the Free Software Foundation; either version 2
 
7
 * of the License, or (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Library General Public
 
15
 * License along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
 
17
 *
 
18
 */
 
19
#ifndef _PROCMAN_PROCMAN_H_
 
20
#define _PROCMAN_PROCMAN_H_
 
21
 
 
22
#include <gdk-pixbuf/gdk-pixbuf.h>
 
23
#include <gnome.h>
 
24
#include <gconf/gconf-client.h>
 
25
#include <glibtop/cpu.h>
 
26
 
 
27
typedef struct _ProcConfig ProcConfig;
 
28
typedef struct _PrettyTable PrettyTable;
 
29
typedef struct _LoadGraph LoadGraph;
 
30
typedef struct _ProcInfo ProcInfo;
 
31
typedef struct _ProcData ProcData;
 
32
 
 
33
enum
 
34
{
 
35
        ALL_PROCESSES,
 
36
        MY_PROCESSES,
 
37
        ACTIVE_PROCESSES
 
38
};
 
39
 
 
40
#define NCPUSTATES 4
 
41
 
 
42
struct _ProcConfig
 
43
{
 
44
        gint            width;
 
45
        gint            height;
 
46
        gboolean        show_more_info;
 
47
        gboolean        show_kill_warning;
 
48
        gboolean        show_hide_message;
 
49
        gboolean        show_tree;
 
50
        gboolean        show_threads;
 
51
        gint            update_interval;
 
52
        gint            graph_update_interval;
 
53
        gint            disks_update_interval;
 
54
        gint            whose_process;
 
55
        gint            current_tab;
 
56
        GdkColor        cpu_color[GLIBTOP_NCPU];
 
57
        GdkColor        mem_color;
 
58
        GdkColor        swap_color;
 
59
        GdkColor        bg_color;
 
60
        GdkColor        frame_color;
 
61
        gboolean        simple_view;
 
62
        gint            pane_pos;
 
63
        gint            num_cpus;
 
64
};
 
65
 
 
66
struct _PrettyTable {
 
67
        GHashTable *app_hash;           /* apps gotten from libwnck */      
 
68
        GHashTable *default_hash;       /* defined in defaulttable.h */
 
69
};
 
70
 
 
71
struct _LoadGraph {
 
72
    
 
73
    guint n;
 
74
    gint type;
 
75
    guint speed;
 
76
    guint draw_width, draw_height;
 
77
    guint num_points;
 
78
    guint num_cpus;
 
79
 
 
80
    guint allocated;
 
81
 
 
82
    GdkColor *colors;
 
83
    gfloat **data, **odata;
 
84
    guint data_size;
 
85
    guint *pos;
 
86
 
 
87
    gint colors_allocated;
 
88
    GtkWidget *main_widget;
 
89
    GtkWidget *disp;
 
90
    GtkWidget *cpu_labels[GLIBTOP_NCPU];
 
91
    GtkWidget *memused_label;
 
92
    GtkWidget *memtotal_label;
 
93
    GtkWidget *mempercent_label;
 
94
    GtkWidget *swapused_label;
 
95
    GtkWidget *swaptotal_label;
 
96
    GtkWidget *swappercent_label;
 
97
    GdkPixmap *pixmap;
 
98
    GdkGC *gc;
 
99
    int timer_index;
 
100
    
 
101
    gboolean draw;
 
102
 
 
103
    guint64 cpu_time [GLIBTOP_NCPU] [NCPUSTATES];
 
104
    guint64 cpu_last [GLIBTOP_NCPU] [NCPUSTATES];
 
105
    gboolean cpu_initialized;       
 
106
};
 
107
 
 
108
enum
 
109
{
 
110
        NEEDS_REMOVAL,
 
111
        NEEDS_ADDITION,
 
112
        NEEDS_NOTHING
 
113
};
 
114
 
 
115
struct _ProcInfo
 
116
{
 
117
        GtkTreeIter     node;
 
118
        GtkTreePath     *path;
 
119
        ProcInfo    *parent;
 
120
        GList *children;
 
121
        gboolean        visible;
 
122
        gint queue;
 
123
        GdkPixbuf       *pixbuf;
 
124
        gchar           *name;
 
125
        gchar           *user;
 
126
        gchar           *arguments;
 
127
        guint64         mem;
 
128
        guint8          pcpu;
 
129
        gint            pid;
 
130
        gint            parent_pid;
 
131
        guint64         cpu_time_last;
 
132
        gint            nice;
 
133
        guint64         vmsize;
 
134
        guint64         memres;
 
135
        guint64         memshared;
 
136
        guint64         memrss;
 
137
        guint64            memxserver;
 
138
        gchar           *status;
 
139
        gboolean        running;
 
140
        gboolean        is_thread;
 
141
        gboolean        is_blacklisted;
 
142
};
 
143
 
 
144
struct _ProcData
 
145
{
 
146
        GtkWidget       *tree;
 
147
        GtkWidget       *infobox;
 
148
        GtkWidget       *disk_list;
 
149
        ProcConfig      config;
 
150
        LoadGraph       *cpu_graph;
 
151
        LoadGraph       *mem_graph;
 
152
        gint            cpu_label_fixed_width;
 
153
        ProcInfo        *selected_process;
 
154
        GtkTreeSelection *selection;
 
155
        gint            timeout;
 
156
        gint            disk_timeout;
 
157
        GList           *info;
 
158
        PrettyTable     *pretty_table;
 
159
        GList           *blacklist;
 
160
        gint            blacklist_num;
 
161
        GConfClient     *client;
 
162
};
 
163
 
 
164
void            procman_save_config (ProcData *data);
 
165
void            procman_save_tree_state (GConfClient *client, GtkWidget *tree, gchar *prefix);
 
166
gboolean        procman_get_tree_state (GConfClient *client, GtkWidget *tree, gchar *prefix);
 
167
 
 
168
#endif /* _PROCMAN_PROCMAN_H_ */