1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
/**
* This file is a part of the Cairo-Dock project
*
* Copyright : (C) see the 'copyright' file.
* E-mail : see the 'copyright' file.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CD_APPLET_STRUCT__
#define __CD_APPLET_STRUCT__
#include <cairo-dock.h>
#define CD_SYSMONITOR_NB_MAX_VALUES 4
#define CD_SYSMONITOR_PROC_FS "/proc"
typedef enum _CDSysmonitorDisplayType {
CD_SYSMONITOR_GAUGE=0,
CD_SYSMONITOR_GRAPH,
CD_SYSMONITOR_BAR,
CD_SYSMONITOR_NB_TYPES
} CDSysmonitorDisplayType;
typedef struct {
gint iLowerLimit;
gint iUpperLimit;
gint iAlertLimit;
gboolean bAlert;
gboolean bAlertSound;
} CDAlertParam;
struct _AppletConfig {
gchar *defaultTitle;
gint iCheckInterval;
gdouble fSmoothFactor;
gboolean bShowCpu;
gboolean bShowRam;
gboolean bShowSwap;
gboolean bShowNvidia;
gboolean bShowCpuTemp;
gboolean bShowFanSpeed;
gboolean bShowFreeMemory;
CairoDockInfoDisplay iInfoDisplay;
gchar *cGThemePath;
CDSysmonitorDisplayType iDisplayType;
CairoDockTypeGraph iGraphType;
gdouble fLowColor[3];
gdouble fHigholor[3];
gdouble fBgColor[4];
gboolean bMixGraph;
gint iNbDisplayedProcesses;
gint iProcessCheckInterval;
gboolean bTopInPercent;
CairoDockLabelDescription *pTopTextDescription;
gchar *cSystemMonitorCommand;
gchar *cSystemMonitorClass;
gboolean bStealTaskBarIcon;
gdouble fUserHZ;
gchar *cSoundPath;
gint iLowerLimit;
gint iUpperLimit;
gint iAlertLimit;
gboolean bAlert;
gboolean bAlertSound;
} ;
typedef struct {
gint iPid;
gchar *cName;
gint iCpuTime;
gdouble fCpuPercent;
gdouble iMemAmount;
gdouble fLastCheckTime;
} CDProcess;
struct _AppletData {
// infos, constantes.
gint iNbCPU;
gulong iMemPageSize;
gint iFrequency;
gchar *cModelName;
gchar *cGPUName;
gint iVideoRam;
gchar *cDriverVersion;
CairoDockTask *pPeriodicTask;
// shared memory for the main thread.
gboolean bInitialized;
gboolean bAcquisitionOK;
GTimer *pClock;
long long int cpu_user, cpu_user_nice, cpu_system, cpu_idle;
unsigned long long ramTotal, ramFree, ramUsed, ramBuffers, ramCached;
unsigned long long swapTotal, swapFree, swapUsed;
gint iGPUTemp;
gint iCPUTemp;
gint iFanSpeed;
gdouble fCpuPercent;
gdouble fPrevCpuPercent;
gdouble fRamPercent,fSwapPercent;
gdouble fPrevRamPercent, fPrevSwapPercent;
gdouble fGpuTempPercent;
gdouble fPrevGpuTempPercent;
gdouble fCpuTempPercent;
gdouble fPrevCpuTempPercent;
gdouble fFanSpeedPercent;
gdouble fPrevFanSpeedPercent;
gdouble fMaxFanSpeed;
gboolean bNeedsUpdate;
gint iTimerCount;
gboolean bCpuTempAlarm;
gboolean bFanAlarm;
// end of shared memory.
gboolean bAlerted;
gint iCount; // pour sous-echantilloner les acquisitions de valeurs moins variables.
gint iSensorsState;
guint iNbProcesses;
CairoDialog *pTopDialog;
cairo_surface_t *pTopSurface;
CairoDockTask *pTopTask;
// shared memory for the "top" thread.
GHashTable *pProcessTable;
CDProcess **pTopList;
GTimer *pTopClock;
gboolean bSortTopByRam;
// end of shared memory.
} ;
#endif
|