[complement-svn] SF.net SVN: complement:[1956] trunk/complement/explore/perf
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2008-08-12 14:08:15
|
Revision: 1956 http://complement.svn.sourceforge.net/complement/?rev=1956&view=rev Author: complement Date: 2008-08-12 14:08:09 +0000 (Tue, 12 Aug 2008) Log Message: ----------- performance: why systems deffer in performance? check malloc; initial test Added Paths: ----------- trunk/complement/explore/perf/alloc/ trunk/complement/explore/perf/alloc/Makefile trunk/complement/explore/perf/alloc/Makefile.inc trunk/complement/explore/perf/alloc/alloc_perf_suite.cc trunk/complement/explore/perf/alloc/alloc_perf_suite.h trunk/complement/explore/perf/alloc/suite.cc Property changes on: trunk/complement/explore/perf/alloc ___________________________________________________________________ Added: svn:ignore + obj Added: trunk/complement/explore/perf/alloc/Makefile =================================================================== --- trunk/complement/explore/perf/alloc/Makefile (rev 0) +++ trunk/complement/explore/perf/alloc/Makefile 2008-08-12 14:08:09 UTC (rev 1956) @@ -0,0 +1,45 @@ +# -*- Makefile -*- Time-stamp: <08/07/31 15:43:19 yeti> + +SRCROOT := ../.. + +include Makefile.inc +include ${SRCROOT}/Makefiles/gmake/top.mak + + +INCLUDES += -I$(SRCROOT)/include +INCLUDES += -I.. +ifdef BOOST_DIR +INCLUDES += -I$(BOOST_INCLUDE_DIR) +endif +DEFS += -D__FIT_EXAM + +LIBMT_DIR = ${SRCROOT}/lib/mt +LIBMISC_DIR = ${SRCROOT}/lib/misc +LIBEXAM_DIR = ${SRCROOT}/lib/exam + +ifeq ($(OSNAME),linux) + +release-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR} \ + -L${LIBEXAM_DIR}/${OUTPUT_DIR} \ + -L${LIBMISC_DIR}/${OUTPUT_DIR} \ + -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR}:${LIBEXAM_DIR}/${OUTPUT_DIR}:${LIBMISC_DIR}/${OUTPUT_DIR}:${STLPORT_LIB_DIR} + +dbg-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR_DBG} \ + -L${LIBEXAM_DIR}/${OUTPUT_DIR_DBG} \ + -L${LIBMISC_DIR}/${OUTPUT_DIR_DBG} \ + -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR_DBG}:${LIBEXAM_DIR}/${OUTPUT_DIR_DBG}:${LIBMISC_DIR}/${OUTPUT_DIR_DBG}:${STLPORT_LIB_DIR} + +ifndef WITHOUT_STLPORT +stldbg-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR_STLDBG} \ + -L${LIBEXAM_DIR}/${OUTPUT_DIR_STLDBG} \ + -L${LIBMISC_DIR}/${OUTPUT_DIR_STLDBG} \ + -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR_STLDBG}:${LIBEXAM_DIR}/${OUTPUT_DIR_STLDBG}:${LIBMISC_DIR}/${OUTPUT_DIR_STLDBG}:${STLPORT_LIB_DIR} +endif + +endif + +release-shared : LDLIBS = -lxmt -lexam -lmisc +dbg-shared : LDLIBS = -lxmtg -lexamg -lmiscg +ifndef WITHOUT_STLPORT +stldbg-shared : LDLIBS = -lxmtstlg -lexamstlg -lmiscstlg +endif Added: trunk/complement/explore/perf/alloc/Makefile.inc =================================================================== --- trunk/complement/explore/perf/alloc/Makefile.inc (rev 0) +++ trunk/complement/explore/perf/alloc/Makefile.inc 2008-08-12 14:08:09 UTC (rev 1956) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <08/07/28 23:56:21 ptr> + +PRGNAME = alloc_perf +SRC_CC = suite.cc alloc_perf_suite.cc Added: trunk/complement/explore/perf/alloc/alloc_perf_suite.cc =================================================================== --- trunk/complement/explore/perf/alloc/alloc_perf_suite.cc (rev 0) +++ trunk/complement/explore/perf/alloc/alloc_perf_suite.cc 2008-08-12 14:08:09 UTC (rev 1956) @@ -0,0 +1,23 @@ +// -*- C++ -*- Time-stamp: <08/08/12 18:06:06 yeti> + +/* + * Copyright (c) 2008 + * Petr Ovtchenkov + * + * Licensed under the Academic Free License Version 3.0 + */ + +#include "alloc_perf_suite.h" + +using namespace std; + +int EXAM_IMPL(alloc_test::alloc) +{ + for ( int i = 0; i < 10000; ++i ) { + if ( malloc( 100 ) == 0 ) { + return 1; + } + } + + return 0; +} Added: trunk/complement/explore/perf/alloc/alloc_perf_suite.h =================================================================== --- trunk/complement/explore/perf/alloc/alloc_perf_suite.h (rev 0) +++ trunk/complement/explore/perf/alloc/alloc_perf_suite.h 2008-08-12 14:08:09 UTC (rev 1956) @@ -0,0 +1,21 @@ +// -*- C++ -*- Time-stamp: <08/08/12 16:51:28 yeti> + +/* + * Copyright (c) 2008 + * Petr Ovtchenkov + * + * Licensed under the Academic Free License Version 3.0 + */ + +#ifndef __ALLOC_PERF_SUITE_H +#define __ALLOC_PERF_SUITE_H + +#include <exam/suite.h> + +class alloc_test +{ + public: + int EXAM_DECL(alloc); +}; + +#endif // __ALLOC_PERF_SUITE_H Added: trunk/complement/explore/perf/alloc/suite.cc =================================================================== --- trunk/complement/explore/perf/alloc/suite.cc (rev 0) +++ trunk/complement/explore/perf/alloc/suite.cc 2008-08-12 14:08:09 UTC (rev 1956) @@ -0,0 +1,30 @@ +// -*- C++ -*- Time-stamp: <08/08/12 16:48:21 yeti> + +/* + * Copyright (c) 2008 + * Petr Ovtchenkov + * + * Licensed under the Academic Free License Version 3.0 + */ + +#include "alloc_perf_suite.h" + +#include <exam/suite.h> +#include <iostream> + +using namespace std; + +int main( int, char ** ) +{ + exam::trivial_time_logger tl( cout ); + + exam::test_suite t( "alloc performance", 20 ); + + t.set_logger( &tl ); + + alloc_test alt; + + t.add( &alloc_test::alloc, alt, "malloc" ); + + return t.girdle(); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |