Click here to Skip to main content
13,141,429 members (23,287 online)
Click here to Skip to main content

Stats

106.2K views
1.2K downloads
68 bookmarked
Posted 8 Jul 2010

Benchmark start-up and system performance for .Net, Mono, Java, C++ and their respective UI

, 2 Sep 2010
What is the start-up and system performance overhead for .Net, Mono, Java versus C++ and Forms, WPF, Swing versus MFC
BenchMarkStartup
BenchMarkStartup
BenchMarkStartup.vcxproj.user
BenchMarkStartupUI
BenchMarkStartupUI.vcxproj.user
CPPMFCPerf
CPPMFCPerf.vcxproj.user
res
CPPMFCPerf.ico
Debug
DotNet11Perf.exe
DotNet11UIPerf.exe
DotNet40Perf.exe
DotNet40UIPerf.exe
DotNet40WPFPerf.exe
DotNet11Perf
App.ico
DotNet11UIPerf
App.ico
DotNet20Perf
Properties
DotNet20UIPerf
Properties
DotNet35Perf
Properties
DotNet35UIPerf
Properties
DotNet35WPFPerf
Properties
DotNet40Perf
Properties
DotNet40UIPerf
Properties
DotNet40WPFPerf
Properties
JavaPerf
StartupTest.class
SwingTest.class
MonoPerf
Mono26Perf.exe
Mono26UIPerf.exe
NativeCPPPerf
Release
DotNet11Perf.exe
DotNet11UIPerf.exe
DotNet40Perf.exe
DotNet40UIPerf.exe
DotNet40WPFPerf.exe
NativeCPPPerf.exe
MonoPerf
Mono26Perf.exe
Mono26UIPerf.exe
Release
BenchMarkStartup.exe
BenchMarkStartupUI.exe
CPPMFCPerf.exe
DotNet11Perf.exe
DotNet11UIPerf.exe
DotNet20Perf.exe
DotNet20UIPerf.exe
DotNet35Perf.exe
DotNet35UIPerf.exe
DotNet35WPFPerf.exe
DotNet40Perf.exe
DotNet40UIPerf.exe
DotNet40WPFPerf.exe
mfc100u.dll
msvcm90.dll
msvcp100.dll
msvcp90.dll
msvcr100.dll
msvcr90.dll
NativeCPPPerf.exe
JavaPerf
StartupTest.class
SwingTest.class
// CPPMFCPerfDlg.cpp : implementation file
//

#include "stdafx.h"
#include "CPPMFCPerf.h"
#include "CPPMFCPerfDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CCPPMFCPerfDlg dialog




CCPPMFCPerfDlg::CCPPMFCPerfDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCPPMFCPerfDlg::IDD, pParent)
{
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CCPPMFCPerfDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CCPPMFCPerfDlg, CDialog)
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	//}}AFX_MSG_MAP
	ON_WM_SHOWWINDOW()
END_MESSAGE_MAP()


// CCPPMFCPerfDlg message handlers

BOOL CCPPMFCPerfDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	// TODO: Add extra initialization here

	return TRUE;  // return TRUE  unless you set the focus to a control
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CCPPMFCPerfDlg::OnPaint()
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this function to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CCPPMFCPerfDlg::OnQueryDragIcon()
{
	return static_cast<HCURSOR>(m_hIcon);
}


void CCPPMFCPerfDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
	CDialog::OnShowWindow(bShow, nStatus);

    FILETIME   ft;
    GetSystemTimeAsFileTime(&ft);
	//static const __int64 startEpoch2 = 0; // 1601/1/1
    if( __argc < 2 )//__argc, __targv
    {
		theApp.m_result = 0;
		return;
    }
	FILETIME userTime;
	FILETIME kernelTime;
	FILETIME createTime;
	FILETIME exitTime;

	if(GetProcessTimes(GetCurrentProcess(), &createTime, &exitTime, &kernelTime, &userTime))
	{
	  __int64 diff;
	  __int64 *pMainEntryTime = reinterpret_cast<__int64 *>(&ft);
	  _int64 launchTime = _tstoi64(__targv[1]);
	  diff = (*pMainEntryTime -launchTime)/10000;	
	  theApp.m_result = (int)diff;
	}
	else
		theApp.m_result = 0;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

dmihailescu
Software Developer (Senior)
United States United States
Decebal Mihailescu is a software engineer with interest in .Net, C# and C++.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.170915.1 | Last Updated 2 Sep 2010
Article Copyright 2010 by dmihailescu
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid