aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-11 22:54:17 +1000
committerDavid Walter Seikel2012-02-11 22:54:17 +1000
commitc97dc3d036506ff8b0156cb623752e2dfc784aba (patch)
tree23613bca87a485eb2c2a6f76e2e7e0355b955bbc /LuaSL
parentTrack details of scripts in the test harness. Use that to quit them, and pri... (diff)
downloadSledjHamr-c97dc3d036506ff8b0156cb623752e2dfc784aba.zip
SledjHamr-c97dc3d036506ff8b0156cb623752e2dfc784aba.tar.gz
SledjHamr-c97dc3d036506ff8b0156cb623752e2dfc784aba.tar.bz2
SledjHamr-c97dc3d036506ff8b0156cb623752e2dfc784aba.tar.xz
Measure compile speed the right way. lol
Diffstat (limited to 'LuaSL')
-rw-r--r--LuaSL/src/LuaSL_test.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/LuaSL/src/LuaSL_test.c b/LuaSL/src/LuaSL_test.c
index 134c536..90dc5ac 100644
--- a/LuaSL/src/LuaSL_test.c
+++ b/LuaSL/src/LuaSL_test.c
@@ -16,7 +16,9 @@ typedef struct
16 16
17static Eina_Strbuf *clientStream; 17static Eina_Strbuf *clientStream;
18static int scriptCount = 0; 18static int scriptCount = 0;
19static int compiledCount = 0;
19static float compileTime = 0.0; 20static float compileTime = 0.0;
21static struct timeval startTime;
20 22
21static const char *names[] = 23static const char *names[] =
22{ 24{
@@ -96,6 +98,7 @@ static void dirList_compile(const char *name, const char *path, void *data)
96 { 98 {
97 script *me = calloc(1, sizeof(script)); 99 script *me = calloc(1, sizeof(script));
98 100
101 scriptCount++;
99 gettimeofday(&me->startTime, NULL); 102 gettimeofday(&me->startTime, NULL);
100 snprintf(me->SID, sizeof(me->SID), "%s/%s", path, name); 103 snprintf(me->SID, sizeof(me->SID), "%s/%s", path, name);
101 snprintf(me->fileName, sizeof(me->fileName), "%s/%s", path, name); 104 snprintf(me->fileName, sizeof(me->fileName), "%s/%s", path, name);
@@ -136,6 +139,7 @@ static Eina_Bool _add(void *data, int type __UNUSED__, Ecore_Con_Event_Server_Ad
136 char buf[PATH_MAX]; 139 char buf[PATH_MAX];
137 140
138 game->server = ev->server; 141 game->server = ev->server;
142 gettimeofday(&startTime, NULL);
139 snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR); 143 snprintf(buf, sizeof(buf), "%s/Test sim/objects", PACKAGE_DATA_DIR);
140 eina_file_dir_list(buf, EINA_TRUE, dirList_compile, game); 144 eina_file_dir_list(buf, EINA_TRUE, dirList_compile, game);
141 // Wait awhile, then quit all scripts we started, for testing. 145 // Wait awhile, then quit all scripts we started, for testing.
@@ -178,9 +182,13 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Server_D
178 182
179 me->compileTime = timeDiff(&now, &me->startTime); 183 me->compileTime = timeDiff(&now, &me->startTime);
180 me->running = TRUE; 184 me->running = TRUE;
181 scriptCount++; 185 compiledCount++;
182 compileTime += me->compileTime; 186 compileTime += me->compileTime;
183 PI("Average compile speed is %f scripts per second", scriptCount / compileTime); 187 PI("Average compile speed is %f scripts per second", compiledCount / compileTime);
188 if (compiledCount == scriptCount)
189 {
190 PI("*********************TOTAL compile speed is %f scripts per second", compiledCount / timeDiff(&now, &startTime));
191 }
184 } 192 }
185 PD("The compile of %s worked, running it now.", SID); 193 PD("The compile of %s worked, running it now.", SID);
186 snprintf(buf, sizeof(buf), "%s.lua.out.start()\n", SID); 194 snprintf(buf, sizeof(buf), "%s.lua.out.start()\n", SID);