Skip to content
Snippets Groups Projects
Commit 0b1a56f2 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

show memory usage if available

parent e29b0c82
No related branches found
No related tags found
No related merge requests found
......@@ -117,6 +117,14 @@ double Cpu()
return s;
}
long GetMemoryUsage()
{
long mem = 0;
double s = 0.;
GetResources(&s, &mem);
return mem;
}
int GetProcessId()
{
#if !defined(WIN32) || defined(__CYGWIN__)
......
......@@ -13,6 +13,7 @@ double GetTimeInSeconds();
void SleepInSeconds(double s);
void CheckResources();
double Cpu();
long GetMemoryUsage();
int GetProcessId();
std::string GetHostName();
int UnlinkFile(std::string fileName);
......
......@@ -15,6 +15,7 @@
#include "PView.h"
#include "Generator.h"
#include "Context.h"
#include "OS.h"
void statistics_cb(Fl_Widget *w, void *data)
{
......@@ -167,6 +168,9 @@ statisticsWindow::statisticsWindow(int deltaFontSize)
}
{
memUsage = new Fl_Box(WB, height - BH - WB, width / 2, BH, "");
memUsage->align(FL_ALIGN_INSIDE);
Fl_Return_Button *o = new Fl_Return_Button
(width - BB - WB, height - BH - WB, BB, BH, "Update");
o->callback(statistics_update_cb);
......@@ -274,6 +278,13 @@ void statisticsWindow::compute(bool elementQuality)
sprintf(label[num], "%g", s[33]); value[num]->value(label[num]); num++;
sprintf(label[num], "%g", s[34]); value[num]->value(label[num]); num++;
sprintf(label[num], "%g", s[35]); value[num]->value(label[num]); num++;
static char mem[256];
long m = GetMemoryUsage();
if(m){
sprintf(mem, "Memory usage: %gMb", GetMemoryUsage()/1024./1024.);
memUsage->label(mem);
}
}
void statisticsWindow::show()
......
......@@ -17,6 +17,7 @@ class statisticsWindow{
Fl_Output *value[50];
Fl_Button *butt[8];
Fl_Group *group[3];
Fl_Box *memUsage;
double quality[4][100];
public:
statisticsWindow(int deltaFontSize);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment