18 const TGPicture *fBgnd;
24 TGShapedMain(
const TGWindow *p,
int w,
int h);
25 virtual ~TGShapedMain();
28 TGSpeedo *GetSpeedo()
const {
return fSpeedo; }
29 Int_t GetActInfo()
const {
return fActInfo; }
36TGShapedMain *gMainWindow;
48 fSpeedo =
new TGSpeedo(
this, 0.0, 100.0,
"CPU",
"[%]");
49 fSpeedo->Connect(
"OdoClicked()",
"TGShapedMain",
this,
"ToggleInfos()");
50 fSpeedo->Connect(
"LedClicked()",
"TGShapedMain",
this,
"CloseWindow()");
51 Connect(
"CloseWindow()",
"TGShapedMain",
this,
"CloseWindow()");
53 fSpeedo->SetDisplayText(
"Used RAM",
"[MB]");
55 fTimer->SetCommand(
"Update()");
57 fBgnd = fSpeedo->GetPicture();
59 gVirtualX->ShapeCombineMask(GetId(), 0, 0, fBgnd->GetMask());
60 SetBackgroundPixmap(fBgnd->GetPicture());
61 SetWMSizeHints(fBgnd->GetWidth(), fBgnd->GetHeight(), fBgnd->GetWidth(), fBgnd->GetHeight(), 1, 1);
69 Resize(GetDefaultSize());
71 SetWMSizeHints(GetDefaultWidth(), GetDefaultHeight(), GetDefaultWidth(), GetDefaultHeight(), 1, 1);
72 SetWindowName(
"ROOT CPU Load Meter");
77void TGShapedMain::ToggleInfos()
86 fSpeedo->SetDisplayText(
"Total RAM",
"[MB]");
87 else if (fActInfo == 1)
88 fSpeedo->SetDisplayText(
"Used RAM",
"[MB]");
89 else if (fActInfo == 2)
90 fSpeedo->SetDisplayText(
"Free RAM",
"[MB]");
94TGShapedMain::~TGShapedMain()
103void TGShapedMain::CloseWindow()
118 prev_load = act_load;
119 old_memUsage = memUsage;
122 gSystem->GetCpuInfo(&cpuInfo, 100);
124 act_load = cpuInfo.
fTotal;
128 if (gMainWindow->GetActInfo() == 0)
130 else if (gMainWindow->GetActInfo() == 1)
132 else if (gMainWindow->GetActInfo() == 2)
135 if (
fabs(act_load - prev_load) > 0.9) {
137 prev_load = act_load;
140 if (memUsage != old_memUsage) {
142 old_memUsage = memUsage;
151 gMainWindow =
new TGShapedMain(
gClient->GetRoot(), 500, 200);
152 gSpeedo = gMainWindow->GetSpeedo();
int Int_t
Signed integer 4 bytes (int).
float Float_t
Float 4 bytes (float).
#define ClassDef(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void w
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize MapSubwindows
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t SetWMSizeHints
This class describes layout hints used by the layout classes.
Defines top level windows that interact with the system Window Manager.
virtual void CloseWindow()
Close and delete main frame.
TGSpeedo is a widget looking like a speedometer, with a needle, a counter and a small odometer window...
void SetOdoValue(Int_t val)
Set actual value of odo meter.
void SetThresholds(Float_t th1=0.0, Float_t th2=0.0, Float_t th3=0.0)
void SetThresholdColors(EGlowColor col1, EGlowColor col2, EGlowColor col3)
void SetScaleValue(Float_t val)
Set actual scale (needle position) value.
ROOT GUI Window base class.
Handles synchronous and a-synchronous timer events.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)