Переглянути джерело

Change the timer used for SQVM profiling with a high resolution timer.

mingodad 12 роки тому
батько
коміт
efe64886c9

+ 132 - 0
SquiLu-ext/HighResolutionTimer.cpp

@@ -0,0 +1,132 @@
+//////////////////////////////////////////////////////////////////////////////
+// HighResolutionTimer.cpp
+// =========
+// High Resolution Timer.
+// This timer is able to measure the elapsed time with 1 micro-second accuracy
+// in both Windows, Linux and Unix system
+//
+//  AUTHOR: Song Ho Ahn ([email protected])
+// CREATED: 2003-01-13
+// UPDATED: 2006-01-13
+//
+// Copyright (c) 2003 Song Ho Ahn
+//////////////////////////////////////////////////////////////////////////////
+
+#include "HighResolutionTimer.h"
+#include <stdlib.h>
+
+///////////////////////////////////////////////////////////////////////////////
+// constructor
+///////////////////////////////////////////////////////////////////////////////
+HighResolutionTimer::HighResolutionTimer()
+{
+#ifdef WIN32
+    QueryPerformanceFrequency(&frequency);
+    startCount.QuadPart = 0;
+    endCount.QuadPart = 0;
+#else
+    startCount.tv_sec = startCount.tv_usec = 0;
+    endCount.tv_sec = endCount.tv_usec = 0;
+#endif
+
+    stopped = 0;
+    startTimeInMicroSec = 0;
+    endTimeInMicroSec = 0;
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// distructor
+///////////////////////////////////////////////////////////////////////////////
+HighResolutionTimer::~HighResolutionTimer()
+{
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// start timer.
+// startCount will be set at this point.
+///////////////////////////////////////////////////////////////////////////////
+void HighResolutionTimer::start()
+{
+    stopped = 0; // reset stop flag
+#ifdef WIN32
+    QueryPerformanceCounter(&startCount);
+#else
+    gettimeofday(&startCount, NULL);
+#endif
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// stop the timer.
+// endCount will be set at this point.
+///////////////////////////////////////////////////////////////////////////////
+void HighResolutionTimer::stop()
+{
+    stopped = 1; // set timer stopped flag
+
+#ifdef WIN32
+    QueryPerformanceCounter(&endCount);
+#else
+    gettimeofday(&endCount, NULL);
+#endif
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// compute elapsed time in micro-second resolution.
+// other getElapsedTime will call this first, then convert to correspond resolution.
+///////////////////////////////////////////////////////////////////////////////
+double HighResolutionTimer::getElapsedTimeInMicroSec()
+{
+#ifdef WIN32
+    if(!stopped)
+        QueryPerformanceCounter(&endCount);
+
+    startTimeInMicroSec = startCount.QuadPart * (1000000.0 / frequency.QuadPart);
+    endTimeInMicroSec = endCount.QuadPart * (1000000.0 / frequency.QuadPart);
+#else
+    if(!stopped)
+        gettimeofday(&endCount, NULL);
+
+    startTimeInMicroSec = (startCount.tv_sec * 1000000.0) + startCount.tv_usec;
+    endTimeInMicroSec = (endCount.tv_sec * 1000000.0) + endCount.tv_usec;
+#endif
+
+    return endTimeInMicroSec - startTimeInMicroSec;
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// divide elapsedTimeInMicroSec by 1000
+///////////////////////////////////////////////////////////////////////////////
+double HighResolutionTimer::getElapsedTimeInMilliSec()
+{
+    return this->getElapsedTimeInMicroSec() * 0.001;
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// divide elapsedTimeInMicroSec by 1000000
+///////////////////////////////////////////////////////////////////////////////
+double HighResolutionTimer::getElapsedTimeInSec()
+{
+    return this->getElapsedTimeInMicroSec() * 0.000001;
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// same as getElapsedTimeInSec()
+///////////////////////////////////////////////////////////////////////////////
+double HighResolutionTimer::getElapsedTime()
+{
+    return this->getElapsedTimeInSec();
+}

+ 56 - 0
SquiLu-ext/HighResolutionTimer.h

@@ -0,0 +1,56 @@
+//////////////////////////////////////////////////////////////////////////////
+// Timer.h
+// =======
+// High Resolution Timer.
+// This timer is able to measure the elapsed time with 1 micro-second accuracy
+// in both Windows, Linux and Unix system
+//
+//  AUTHOR: Song Ho Ahn ([email protected])
+// CREATED: 2003-01-13
+// UPDATED: 2006-01-13
+//
+// Copyright (c) 2003 Song Ho Ahn
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef HIGH_RESOLUTION_TIMER_H_DEF
+#define HIGH_RESOLUTION_TIMER_H_DEF
+
+#ifdef WIN32   // Windows system specific
+#include <windows.h>
+#else          // Unix based system specific
+#include <sys/time.h>
+#endif
+
+
+class HighResolutionTimer
+{
+public:
+    HighResolutionTimer();                                    // default constructor
+    ~HighResolutionTimer();                                   // default destructor
+
+    void   start();                             // start timer
+    void   stop();                              // stop the timer
+    double getElapsedTime();                    // get elapsed time in second
+    double getElapsedTimeInSec();               // get elapsed time in second (same as getElapsedTime)
+    double getElapsedTimeInMilliSec();          // get elapsed time in milli-second
+    double getElapsedTimeInMicroSec();          // get elapsed time in micro-second
+
+
+protected:
+
+
+private:
+    double startTimeInMicroSec;                 // starting time in micro-second
+    double endTimeInMicroSec;                   // ending time in micro-second
+    int    stopped;                             // stop flag
+#ifdef WIN32
+    LARGE_INTEGER frequency;                    // ticks per second
+    LARGE_INTEGER startCount;                   //
+    LARGE_INTEGER endCount;                     //
+#else
+    timeval startCount;                         //
+    timeval endCount;                           //
+#endif
+};
+
+#endif // HIGH_RESOLUTION_TIMER_H_DEF

+ 24 - 24
SquiLu/samples/process-profile-data.nut

@@ -1,25 +1,25 @@
 local profile_data = [==[
 local profile_data = [==[
-1	1	7	0	_OP_LOAD
-2	2	1193711	2266	_OP_LOADINT
-6	6	796719	1509	_OP_CALL
-8	8	265587	516	_OP_PREPCALLK
-9	9	6	0	_OP_GETK
-10	10	659839	1258	_OP_MOVE
-14	14	528410	1004	_OP_GET
-17	17	265574	552	_OP_ADD
-18	18	262849	532	_OP_SUB
-19	19	4	0	_OP_MUL
-23	23	531133	993	_OP_RETURN
-26	26	265566	513	_OP_LOADBOOL
-27	27	134148	244	_OP_DMOVE
-28	28	1364	2	_OP_JMP
-29	29	266936	512	_OP_JCMP
-30	30	265566	595	_OP_JZ
-32	32	525688	969	_OP_GETOUTER
-33	33	265566	517	_OP_NEWOBJ
-34	34	528410	1018	_OP_APPENDARRAY
-37	37	132782	254	_OP_INCL
-48	48	2	6	_OP_CLOSURE
+1	1	7	232.000000	_OP_LOAD
+2	2	1193711	2332681.000000	_OP_LOADINT
+6	6	796719	1642654.000000	_OP_CALL
+8	8	265587	546637.000000	_OP_PREPCALLK
+9	9	6	9.000000	_OP_GETK
+10	10	659839	1282802.000000	_OP_MOVE
+14	14	528410	1022085.000000	_OP_GET
+17	17	265574	554243.000000	_OP_ADD
+18	18	262849	501726.000000	_OP_SUB
+19	19	4	7.000000	_OP_MUL
+23	23	531133	1016261.000000	_OP_RETURN
+26	26	265566	521499.000000	_OP_LOADBOOL
+27	27	134148	280230.000000	_OP_DMOVE
+28	28	1364	2154.000000	_OP_JMP
+29	29	266936	539864.000000	_OP_JCMP
+30	30	265566	671098.000000	_OP_JZ
+32	32	525688	1059911.000000	_OP_GETOUTER
+33	33	265566	516803.000000	_OP_NEWOBJ
+34	34	528410	1138235.000000	_OP_APPENDARRAY
+37	37	132782	247946.000000	_OP_INCL
+48	48	2	25120.000000	_OP_CLOSURE
 ]==]
 ]==]
 
 
 local profile = [];
 local profile = [];
@@ -28,7 +28,7 @@ foreach(line in profile_data.split('\n')){
 	//print(line);
 	//print(line);
 	local rec = line.split('\t');
 	local rec = line.split('\t');
 	rec[2] = rec[2].tointeger();
 	rec[2] = rec[2].tointeger();
-	rec[3] = rec[3].tointeger();
+	rec[3] = rec[3].tofloat();
 	total_time += rec[3];
 	total_time += rec[3];
 	profile.push(rec);
 	profile.push(rec);
 }
 }
@@ -36,12 +36,12 @@ foreach(line in profile_data.split('\n')){
 foreach(rec in profile){
 foreach(rec in profile){
 	local pct = (rec[3] / total_time) * 100;
 	local pct = (rec[3] / total_time) * 100;
 	rec[1] = math.roundf(pct, 2);
 	rec[1] = math.roundf(pct, 2);
-	rec.insert(2, math.roundf(rec[3]/rec[2].tofloat(), 4));
+	rec.insert(3, math.roundf((rec[3]/rec[2]) * 0.001, 5));
 }
 }
 
 
 profile.sort(@(a,b) b[1] <=> a[1]);
 profile.sort(@(a,b) b[1] <=> a[1]);
 
 
-print("OP\t%time\t%call\t%ncalls\ttotal_time\tOP name");
+print("OP\t%time\t%ncalls\ttm_1call\ttm_allcalls\tOP name");
 foreach(rec in profile){
 foreach(rec in profile){
 	print(rec.concat("\t"));
 	print(rec.concat("\t"));
 }
 }

+ 381 - 32
SquiLu/squilu.cbp

@@ -11,7 +11,7 @@
 				<Option object_output="obj/Debug/" />
 				<Option object_output="obj/Debug/" />
 				<Option type="1" />
 				<Option type="1" />
 				<Option compiler="gcc" />
 				<Option compiler="gcc" />
-				<Option parameters="test-weakref.nut" />
+				<Option parameters="spectralnorm.nut" />
 				<Compiler>
 				<Compiler>
 					<Add option="-g" />
 					<Add option="-g" />
 					<Add directory="../../zeromq-3.2.2/include" />
 					<Add directory="../../zeromq-3.2.2/include" />
@@ -104,6 +104,8 @@
 				<Option type="1" />
 				<Option type="1" />
 				<Option compiler="gcc" />
 				<Option compiler="gcc" />
 				<Compiler>
 				<Compiler>
+					<Add option="-fomit-frame-pointer" />
+					<Add option="-fexpensive-optimizations" />
 					<Add option="-O3" />
 					<Add option="-O3" />
 					<Add option="-Wall" />
 					<Add option="-Wall" />
 					<Add option="-fno-rtti" />
 					<Add option="-fno-rtti" />
@@ -141,12 +143,13 @@
 			</Target>
 			</Target>
 			<Target title="Debug FLTK">
 			<Target title="Debug FLTK">
 				<Option output="bin/squilu-dbg" prefix_auto="1" extension_auto="1" />
 				<Option output="bin/squilu-dbg" prefix_auto="1" extension_auto="1" />
-				<Option working_dir="ourbiz" />
+				<Option working_dir="samples" />
 				<Option object_output="obj/Debug/" />
 				<Option object_output="obj/Debug/" />
 				<Option type="1" />
 				<Option type="1" />
 				<Option compiler="gcc" />
 				<Option compiler="gcc" />
 				<Option parameters="ourbiz-fltk.nut" />
 				<Option parameters="ourbiz-fltk.nut" />
 				<Compiler>
 				<Compiler>
+					<Add option="-O2" />
 					<Add option="-Wall" />
 					<Add option="-Wall" />
 					<Add option="-g" />
 					<Add option="-g" />
 					<Add option="-fno-rtti" />
 					<Add option="-fno-rtti" />
@@ -277,13 +280,43 @@
 					<Add directory="../libharu/src" />
 					<Add directory="../libharu/src" />
 				</Linker>
 				</Linker>
 			</Target>
 			</Target>
+			<Target title="Release alone">
+				<Option output="bin/squilu-alone" prefix_auto="1" extension_auto="1" />
+				<Option object_output="obj/Release-alone/" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-Os" />
+					<Add option="-Wall" />
+					<Add option="-fno-rtti" />
+					<Add option="-fno-strict-aliasing" />
+					<Add option="-DNEED_SUBLATIN_C=1" />
+					<Add option="-DSQUILU_ALONE=1" />
+					<Add directory="../../zeromq-3.2.2/include" />
+				</Compiler>
+				<Linker>
+					<Add option="-s" />
+					<Add library="../../zeromq-3.2.2/libzmq3.a" />
+					<Add library="pthread" />
+					<Add library="rt" />
+					<Add library="dl" />
+					<Add library="axtls" />
+					<Add library="mpdecimal" />
+					<Add library="discount" />
+					<Add library="fltk_z" />
+					<Add directory="../../zeromq-3.2.2" />
+					<Add directory="../fltk/lib" />
+				</Linker>
+			</Target>
 		</Build>
 		</Build>
 		<Compiler>
 		<Compiler>
 			<Add option="-Wall" />
 			<Add option="-Wall" />
 			<Add option="-fno-strict-aliasing" />
 			<Add option="-fno-strict-aliasing" />
+			<Add option="-DPROFILE_SQVM=1" />
 			<Add option="-DSQ_JIT_LLVM44=1" />
 			<Add option="-DSQ_JIT_LLVM44=1" />
 			<Add option="-D_DEBUG_DUMP33=1" />
 			<Add option="-D_DEBUG_DUMP33=1" />
 			<Add option="-DWITH_DAD_EXTRAS=1" />
 			<Add option="-DWITH_DAD_EXTRAS=1" />
+			<Add option="-DWITH_FULL_DAD_EXTRAS=1" />
 			<Add option="-DSQ_SUBLATIN=1" />
 			<Add option="-DSQ_SUBLATIN=1" />
 			<Add option="-DNEED_SUBLATIN_C2=1" />
 			<Add option="-DNEED_SUBLATIN_C2=1" />
 			<Add option="-DSQUSEDOUBLE=1" />
 			<Add option="-DSQUSEDOUBLE=1" />
@@ -323,6 +356,7 @@
 			<Add directory="/usr/lib/llvm-3.1/include" />
 			<Add directory="/usr/lib/llvm-3.1/include" />
 			<Add directory="../SquiLu-ext/threadObject" />
 			<Add directory="../SquiLu-ext/threadObject" />
 			<Add directory=".." />
 			<Add directory=".." />
+			<Add directory="../SquiLu-ext" />
 		</Compiler>
 		</Compiler>
 		<Linker>
 		<Linker>
 			<Add library="m" />
 			<Add library="m" />
@@ -331,51 +365,366 @@
 			<Add directory="../mpdecimal" />
 			<Add directory="../mpdecimal" />
 			<Add directory="../discount" />
 			<Add directory="../discount" />
 		</Linker>
 		</Linker>
-		<Unit filename="../SquiLu-ext/dynamic_library.cpp" />
-		<Unit filename="../SquiLu-ext/dynamic_library.h" />
-		<Unit filename="../SquiLu-ext/fpdf.cpp" />
-		<Unit filename="../SquiLu-ext/fpdf.h" />
-		<Unit filename="../SquiLu-ext/lua_socket.cpp" />
-		<Unit filename="../SquiLu-ext/lua_socket.h" />
+		<Unit filename="../SquiLu-ext/HighResolutionTimer.cpp" />
+		<Unit filename="../SquiLu-ext/HighResolutionTimer.h" />
+		<Unit filename="../SquiLu-ext/code_mix_prep.c">
+			<Option compilerVar="CC" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/dynamic_library.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/dynamic_library.h">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/fpdf.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/fpdf.h">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/lua_socket.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/lua_socket.h">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
 		<Unit filename="../SquiLu-ext/mongoose.c">
 		<Unit filename="../SquiLu-ext/mongoose.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/mongoose.h">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/pdf-font.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/pdf-font.h">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
 		</Unit>
 		</Unit>
-		<Unit filename="../SquiLu-ext/mongoose.h" />
-		<Unit filename="../SquiLu-ext/pdf-font.cpp" />
-		<Unit filename="../SquiLu-ext/pdf-font.h" />
 		<Unit filename="../SquiLu-ext/sq_axtls.c">
 		<Unit filename="../SquiLu-ext/sq_axtls.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_base64.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_decimal.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_fltk.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_fpdf.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
 		</Unit>
 		</Unit>
-		<Unit filename="../SquiLu-ext/sq_base64.cpp" />
-		<Unit filename="../SquiLu-ext/sq_decimal.cpp" />
-		<Unit filename="../SquiLu-ext/sq_fltk.cpp" />
-		<Unit filename="../SquiLu-ext/sq_fpdf.cpp" />
 		<Unit filename="../SquiLu-ext/sq_fs.c">
 		<Unit filename="../SquiLu-ext/sq_fs.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_markdown.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_mix.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_mongoose.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_parsecsv.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_postgresql.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
 		</Unit>
 		</Unit>
-		<Unit filename="../SquiLu-ext/sq_markdown.cpp" />
-		<Unit filename="../SquiLu-ext/sq_mix.cpp" />
-		<Unit filename="../SquiLu-ext/sq_mongoose.cpp" />
-		<Unit filename="../SquiLu-ext/sq_parsecsv.cpp" />
-		<Unit filename="../SquiLu-ext/sq_postgresql.cpp" />
 		<Unit filename="../SquiLu-ext/sq_rs232.c">
 		<Unit filename="../SquiLu-ext/sq_rs232.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_slave_vm.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_socket.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_sqlite3.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_tinyxml2.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_zlib.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sq_zmq3.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
 		</Unit>
 		</Unit>
-		<Unit filename="../SquiLu-ext/sq_slave_vm.cpp" />
-		<Unit filename="../SquiLu-ext/sq_socket.cpp" />
-		<Unit filename="../SquiLu-ext/sq_sqlite3.cpp" />
-		<Unit filename="../SquiLu-ext/sq_tinyxml2.cpp" />
-		<Unit filename="../SquiLu-ext/sq_zlib.cpp" />
-		<Unit filename="../SquiLu-ext/sq_zmq3.cpp" />
 		<Unit filename="../SquiLu-ext/sqlite3.c">
 		<Unit filename="../SquiLu-ext/sqlite3.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sqlite3.h">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sqmodule.h">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sqratimport.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/sqratimport.h">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/tinyxml2.cpp">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
+		</Unit>
+		<Unit filename="../SquiLu-ext/tinyxml2.h">
+			<Option target="Debug" />
+			<Option target="Release" />
+			<Option target="Release clang" />
+			<Option target="Release win32" />
+			<Option target="Release FLTK" />
+			<Option target="Debug FLTK" />
+			<Option target="Release FLTK win32" />
+			<Option target="Release FLTK win32 no console" />
 		</Unit>
 		</Unit>
-		<Unit filename="../SquiLu-ext/sqlite3.h" />
-		<Unit filename="../SquiLu-ext/sqmodule.h" />
-		<Unit filename="../SquiLu-ext/sqratimport.cpp" />
-		<Unit filename="../SquiLu-ext/sqratimport.h" />
-		<Unit filename="../SquiLu-ext/tinyxml2.cpp" />
-		<Unit filename="../SquiLu-ext/tinyxml2.h" />
 		<Unit filename="dadbiz.rc">
 		<Unit filename="dadbiz.rc">
 			<Option compilerVar="WINDRES" />
 			<Option compilerVar="WINDRES" />
 			<Option target="Release win32" />
 			<Option target="Release win32" />

+ 6 - 11
SquiLu/squirrel/sqvm.cpp

@@ -113,13 +113,7 @@ bool SQVM::ARITH_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,
 			}
 			}
 	}
 	}
 	return true;
 	return true;
-}
-
-#ifdef PROFILE_SQVM
-//from sqstdsystem
-int GetMilliCount();
-int GetMilliSpan( int nTimeStart );
-#endif
+}
 
 
 SQVM::SQVM(SQSharedState *ss)
 SQVM::SQVM(SQSharedState *ss)
 {
 {
@@ -144,7 +138,7 @@ SQVM::SQVM(SQSharedState *ss)
 	_check_delayed_relase_hooks = true;
 	_check_delayed_relase_hooks = true;
 #ifdef PROFILE_SQVM
 #ifdef PROFILE_SQVM
 	printf("SQVM::SQVM : %p\n", this);
 	printf("SQVM::SQVM : %p\n", this);
-	_last_op_profile_time = GetMilliCount();
+	_op_profile_timer.start();
 	_op_profile.resize(_OP__LAST__+1);
 	_op_profile.resize(_OP__LAST__+1);
 	for(SQUnsignedInteger i=0; i <= _OP__LAST__; ++i){
 	for(SQUnsignedInteger i=0; i <= _OP__LAST__; ++i){
 		OpProfile &opp = _op_profile[i];
 		OpProfile &opp = _op_profile[i];
@@ -176,7 +170,7 @@ void SQVM::Finalize()
 	printf("SQVM::Finalize : %p\n", this);
 	printf("SQVM::Finalize : %p\n", this);
 #define ENUM_OP(a,b) {\
 #define ENUM_OP(a,b) {\
 		OpProfile &opp = _op_profile[a];\
 		OpProfile &opp = _op_profile[a];\
-		if(opp.count) printf("%d\t%d\t%d\t%d\t%s\n", a, opp.op, opp.count, opp.total_time, _SC(#a));\
+		if(opp.count) printf("%d\t%d\t%d\t%f\t%s\n", a, opp.op, opp.count, opp.total_time, _SC(#a));\
 	}
 	}
     SQ_OP_CODE_LIST()
     SQ_OP_CODE_LIST()
 #undef ENUM_OP
 #undef ENUM_OP
@@ -783,8 +777,9 @@ exception_restore:
 		    if((ci->_ip->op == _OP_CALL) && _check_delayed_relase_hooks) _sharedstate->CallDelayedReleaseHooks(this);
 		    if((ci->_ip->op == _OP_CALL) && _check_delayed_relase_hooks) _sharedstate->CallDelayedReleaseHooks(this);
 #ifdef PROFILE_SQVM
 #ifdef PROFILE_SQVM
 			OpProfile &opp_last = _op_profile[ci->_ip->op];
 			OpProfile &opp_last = _op_profile[ci->_ip->op];
-			opp_last.total_time += GetMilliSpan(_last_op_profile_time);
-			_last_op_profile_time = GetMilliCount();
+			_op_profile_timer.stop();
+			opp_last.total_time += _op_profile_timer.getElapsedTimeInMicroSec();
+			_op_profile_timer.start();
 #endif
 #endif
 			const SQInstruction &_i_ = *ci->_ip++;
 			const SQInstruction &_i_ = *ci->_ip++;
 			//dumpstack(_stackbase);
 			//dumpstack(_stackbase);

+ 6 - 2
SquiLu/squirrel/sqvm.h

@@ -1,6 +1,10 @@
 /*	see copyright notice in squirrel.h */
 /*	see copyright notice in squirrel.h */
 #ifndef _SQVM_H_
 #ifndef _SQVM_H_
 #define _SQVM_H_
 #define _SQVM_H_
+
+#ifdef PROFILE_SQVM
+#include "HighResolutionTimer.h"
+#endif
 
 
 #include "sqopcodes.h"
 #include "sqopcodes.h"
 #include "sqobject.h"
 #include "sqobject.h"
@@ -47,7 +51,7 @@ struct SQVM : public CHAINABLE_OBJ
 
 
 typedef sqvector<CallInfo> CallInfoVec;
 typedef sqvector<CallInfo> CallInfoVec;
 #ifdef PROFILE_SQVM
 #ifdef PROFILE_SQVM
-	struct OpProfile {SQInteger op, count, total_time;};
+	struct OpProfile {SQInteger op, count; SQFloat total_time;};
 	typedef sqvector<OpProfile> OpProfileVec;
 	typedef sqvector<OpProfile> OpProfileVec;
 #endif
 #endif
 public:
 public:
@@ -186,7 +190,7 @@ public:
 	SQInteger _suspended_traps;
 	SQInteger _suspended_traps;
 #ifdef PROFILE_SQVM
 #ifdef PROFILE_SQVM
 	OpProfileVec _op_profile;
 	OpProfileVec _op_profile;
-	SQInteger _last_op_profile_time;
+	HighResolutionTimer _op_profile_timer;
 #endif
 #endif
 };
 };