Commit bfe89960 authored by Jan Möbius's avatar Jan Möbius
Browse files

Update about widget when redrawn, add memory usage info for non win32

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9784 383ad7c9-94d9-4d36-a494-682f7c89f535
parent dae08e2d
......@@ -58,6 +58,10 @@
#include <OpenFlipper/common/GlobalOptions.hh>
#ifndef WIN32
#include <malloc.h>
#endif
//== IMPLEMENTATION ==========================================================
......@@ -69,6 +73,10 @@ void CoreWidget::showAboutWidget( ) {
if ( aboutWidget_ == 0 ) {
aboutWidget_ = new AboutWidget( this );
} else {
aboutWidget_->OpenFlipperAbout->clear();
}
aboutWidget_->OpenFlipperAbout->append(tr("OpenFlipper Core Version: ") + OpenFlipper::Options::coreVersion() ) ;
// =====================================================================================
......@@ -90,6 +98,49 @@ void CoreWidget::showAboutWidget( ) {
aboutWidget_->OpenFlipperAbout->append("Fonts:\t" + OpenFlipper::Options::fontsDirStr() );
aboutWidget_->OpenFlipperAbout->append("Help:\t" + OpenFlipper::Options::helpDirStr() );
// =====================================================================================
// Memory infos
// =====================================================================================
aboutWidget_->OpenFlipperAbout->append("\n");
aboutWidget_->OpenFlipperAbout->append(tr("Memory Information:"));
#ifndef WIN32
unsigned long memory = 0;
struct mallinfo info;
info = mallinfo();
// std::cout << "**********************" << std::endl;
// std::cout << "arena: " << info.arena << std::endl;
// std::cout << "ordblks: " << info.ordblks << std::endl;
// std::cout << "hblks: " << info.hblks << std::endl;
// std::cout << "hblkhd: " << info.hblkhd << std::endl;
// std::cout << "uordblks: " << info.uordblks << std::endl;
// std::cout << "fordblks: " << info.fordblks << std::endl;
// std::cout << "keepcost: " << info.keepcost << std::endl;
// add mmap-allocated memory
memory += info.hblkhd;
// add sbrk-allocated memory
memory += info.uordblks;
double mmapAllocated = double(info.hblkhd ) / 1024 / 1024;
double sbrkAllocated = double(info.uordblks) / 1024 / 1024;
double totalAllocated = double(memory) / 1024 / 1024;
aboutWidget_->OpenFlipperAbout->append(tr("mmap allocated:\t\t ") + QString::number(mmapAllocated ,'g' ,2 ) + "MByte" );
aboutWidget_->OpenFlipperAbout->append(tr("sbrk allocated:\t\t ") + QString::number(sbrkAllocated ,'g' ,2 ) + "MByte" );
aboutWidget_->OpenFlipperAbout->append(tr("Total Memory allocated:\t ") + QString::number(totalAllocated,'g' ,2 ) + "MByte" );
#else
aboutWidget_->OpenFlipperAbout->append(tr("Not available for this platform"));
#endif
// =====================================================================================
// OpenGL Renderer/Vendor and version info
// =====================================================================================
......@@ -193,8 +244,6 @@ void CoreWidget::showAboutWidget( ) {
aboutWidget_->OpenFlipperAbout->append( types );
}
aboutWidget_->show();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment