* extras/hbvpdf/hbvpdf.hbx
! two more corrections
* contrib/gtwvg/tests/_dyndlgs.prg
* contrib/hbct/doc/en/finan.txt
* contrib/hbct/readme.txt
* contrib/hbct/tests/asciisum.prg
* contrib/hbct/tests/trig.prg
* contrib/hbfoxpro/dll.prg
* contrib/hbhttpd/core.prg
* contrib/hbhttpd/widgets.prg
* contrib/hbmisc/fcomma.prg
* contrib/hbmlzo/tests/test.prg
* contrib/hbmxml/tests/custom.prg
* contrib/hbmzip/readme.txt
* contrib/hbnf/nwuid.prg
* contrib/hbnf/vidcur.prg
* contrib/hbtip/client.prg
* contrib/hbwin/tests/olesrv1.prg
* contrib/hbwin/tests/testprn.prg
* contrib/xhb/cstruct.prg
* contrib/xhb/hjwindow.prg
* contrib/xhb/hterrsys.prg
* contrib/xhb/htjlist.prg
* contrib/xhb/htmutil.prg
* contrib/xhb/tests/decode.prg
* contrib/xhb/xhberr.prg
* doc/cmdline.txt
* doc/en/objfunc.txt
* doc/en/set.txt
* doc/en/string.txt
* doc/pragma.txt
* extras/gfspell/spell.prg
* extras/gtwvw/docs/gtwvw.txt
* extras/gtwvw/tests/wvwtest9.prg
* extras/hbvpdf/core.prg
* extras/hbvpdf/fonts.prg
* extras/hbvpdf/tests/pdf_demo.prg
* extras/httpsrv/cgifunc.prg
* extras/httpsrv/home/counter.html
* extras/httpsrv/home/testxmldb.html
* extras/httpsrv/session.prg
* extras/httpsrv/uhttpd.prg
* tests/base64.prg
* tests/boxtest.prg
* tests/db_brows.prg
* tests/ddate.prg
* tests/inherit.prg
* tests/langmsg.prg
* tests/mathtest.prg
* tests/memtst.prg
* tests/readhrb.prg
* tests/switch.prg
* tests/testsha2.prg
* tests/testwarn.prg
* tests/tstdbi.prg
* tests/utf8at.prg
* utils/hbtest/hbtest.prg
* utils/hbtest/rt_class.prg
* utils/hbtest/rt_date.prg
* utils/hbtest/rt_hvma.prg
* utils/hbtest/rt_math.prg
* utils/hbtest/rt_misc.prg
* utils/hbtest/rt_trans.prg
* website/news.html
* website/news1.html
* website/samples.html
* website/samples/arreval.html
* website/samples/codebl.prg.html
* website/samples/dates3.html
* website/samples/switch.prg.html
* website/samples/testcgi.prg.html
* website/samples/tstmacro.prg.html
* rerun case fixer script after applying
some fixes, and this time it run fully
automatically.
111 lines
2.1 KiB
Plaintext
111 lines
2.1 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* Harbour Project source code:
|
|
* a small memory manager test code
|
|
*/
|
|
|
|
#include "simpleio.ch"
|
|
|
|
#define N_LOOPS 100000
|
|
|
|
#ifdef __HARBOUR__
|
|
#include "hbmemory.ch"
|
|
#endif
|
|
|
|
PROCEDURE Main()
|
|
|
|
LOCAL nCPUSec, nRealSec, i, a
|
|
|
|
#ifdef __HARBOUR__
|
|
|
|
IF Memory( HB_MEM_USEDMAX ) != 0
|
|
?
|
|
? "Warning !!! Memory statistics enabled."
|
|
ENDIF
|
|
#endif
|
|
?
|
|
? Date(), Time(), Version() + build_mode() + ", " + OS()
|
|
|
|
?
|
|
? "testing single large memory blocks allocation and freeing..."
|
|
nRealSec := Seconds()
|
|
nCPUSec := hb_SecondsCPU()
|
|
FOR i := 1 TO N_LOOPS
|
|
a := Space( 50000 )
|
|
NEXT
|
|
a := NIL
|
|
nCPUSec := hb_SecondsCPU() - nCPUSec
|
|
nRealSec := Seconds() - nRealSec
|
|
? " CPU time:", nCPUSec, "sec."
|
|
? "real time:", nRealSec, "sec."
|
|
|
|
?
|
|
? "testing many large memory blocks allocation and freeing..."
|
|
nRealSec := Seconds()
|
|
nCPUSec := hb_SecondsCPU()
|
|
a := Array( 100 )
|
|
FOR i := 1 TO N_LOOPS
|
|
a[ i % 100 + 1 ] := Space( 50000 )
|
|
IF i % 200 == 0
|
|
AFill( a, "" )
|
|
ENDIF
|
|
NEXT
|
|
a := NIL
|
|
nCPUSec := hb_SecondsCPU() - nCPUSec
|
|
nRealSec := Seconds() - nRealSec
|
|
? " CPU time:", nCPUSec, "sec."
|
|
? "real time:", nRealSec, "sec."
|
|
|
|
?
|
|
? "testing large memory block reallocation with intermediate allocations..."
|
|
? "Warning!!! some compilers may badly fail here"
|
|
WAIT
|
|
|
|
nRealSec := Seconds()
|
|
nCPUSec := hb_SecondsCPU()
|
|
a := {}
|
|
FOR i := 1 TO N_LOOPS
|
|
AAdd( a, {} )
|
|
IF i % 1000 == 0
|
|
?? i
|
|
ENDIF
|
|
NEXT
|
|
nCPUSec := hb_SecondsCPU() - nCPUSec
|
|
nRealSec := Seconds() - nRealSec
|
|
? " CPU time:", nCPUSec, "sec."
|
|
? "real time:", nRealSec, "sec."
|
|
WAIT
|
|
|
|
RETURN
|
|
|
|
FUNCTION build_mode()
|
|
#ifdef __CLIP__
|
|
RETURN " (MT)"
|
|
#else
|
|
#ifdef __XHARBOUR__
|
|
RETURN iif( hb_MultiThread(), " (MT)", "" ) + ;
|
|
iif( Memory( HB_MEM_USEDMAX ) != 0, " (FMSTAT)", "" )
|
|
#else
|
|
#ifdef __HARBOUR__
|
|
RETURN iif( hb_mtvm(), " (MT)", "" ) + ;
|
|
iif( Memory( HB_MEM_USEDMAX ) != 0, " (FMSTAT)", "" )
|
|
#else
|
|
#ifdef __XPP__
|
|
RETURN " (MT)"
|
|
#else
|
|
RETURN ""
|
|
#endif
|
|
#endif
|
|
#endif
|
|
#endif
|
|
|
|
#if __HARBOUR__ < 0x010100
|
|
|
|
FUNCTION hb_mtvm()
|
|
RETURN .F.
|
|
|
|
#endif
|