25 virtual ~TGShapedMain();
28 TGSpeedo *GetSpeedo()
const {
return fSpeedo; }
29 Int_t GetActInfo()
const {
return fActInfo; }
37TGShapedMain *gMainWindow;
43TGShapedMain::TGShapedMain(
const TGWindow *
p,
int w,
int h) :
50 fSpeedo =
new TGSpeedo(
this, 0.0, 100.0,
"CPU",
"[%]");
51 fSpeedo->Connect(
"OdoClicked()",
"TGShapedMain",
this,
"ToggleInfos()");
52 fSpeedo->Connect(
"LedClicked()",
"TGShapedMain",
this,
"CloseWindow()");
53 Connect(
"CloseWindow()",
"TGShapedMain",
this,
"CloseWindow()");
55 fSpeedo->SetDisplayText(
"Used RAM",
"[MB]");
57 fTimer->SetCommand(
"Update()");
59 fBgnd = fSpeedo->GetPicture();
61 gVirtualX->ShapeCombineMask(GetId(), 0, 0, fBgnd->GetMask());
62 SetBackgroundPixmap(fBgnd->GetPicture());
63 SetWMSizeHints(fBgnd->GetWidth(), fBgnd->GetHeight(), fBgnd->GetWidth(),
64 fBgnd->GetHeight(), 1, 1);
72 Resize(GetDefaultSize());
74 SetWMSizeHints(GetDefaultWidth(), GetDefaultHeight(), GetDefaultWidth(),
75 GetDefaultHeight(), 1, 1);
76 SetWindowName(
"ROOT CPU Load Meter");
81void TGShapedMain::ToggleInfos()
90 fSpeedo->SetDisplayText(
"Total RAM",
"[MB]");
91 else if (fActInfo == 1)
92 fSpeedo->SetDisplayText(
"Used RAM",
"[MB]");
93 else if (fActInfo == 2)
94 fSpeedo->SetDisplayText(
"Free RAM",
"[MB]");
98TGShapedMain::~TGShapedMain()
107void TGShapedMain::CloseWindow()
122 prev_load = act_load;
123 old_memUsage = memUsage;
128 act_load = cpuInfo.
fTotal;
132 if (gMainWindow->GetActInfo() == 0)
134 else if (gMainWindow->GetActInfo() == 1)
136 else if (gMainWindow->GetActInfo() == 2)
139 if (
fabs(act_load-prev_load) > 0.9) {
141 prev_load = act_load;
144 if (memUsage != old_memUsage) {
146 old_memUsage = memUsage;
155 gMainWindow =
new TGShapedMain(
gClient->GetRoot(), 500, 200);
156 gSpeedo = gMainWindow->GetSpeedo();
#define ClassDef(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
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
R__EXTERN TSystem * gSystem
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.
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
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.
virtual int GetMemInfo(MemInfo_t *info) const
Returns ram and swap memory usage info into the MemInfo_t structure.
virtual int GetCpuInfo(CpuInfo_t *info, Int_t sampleTime=1000) const
Returns cpu load average and load info into the CpuInfo_t structure.
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)