aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/love
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-08-10 04:22:59 +1000
committerDavid Walter Seikel2014-08-10 04:22:59 +1000
commit7513607fd13559a9d169354acb3a60c598c134ce (patch)
treec808f7a47d5b04fea380e5ee184e66f0a8e2b82d /src/love
parentBitch about not being able to load the compiled Lua. (diff)
downloadSledjHamr-7513607fd13559a9d169354acb3a60c598c134ce.zip
SledjHamr-7513607fd13559a9d169354acb3a60c598c134ce.tar.gz
SledjHamr-7513607fd13559a9d169354acb3a60c598c134ce.tar.bz2
SledjHamr-7513607fd13559a9d169354acb3a60c598c134ce.tar.xz
Rejig the compile timing stats.
Diffstat (limited to 'src/love')
-rw-r--r--src/love/love.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/love/love.c b/src/love/love.c
index e18afe7..e7b8e40 100644
--- a/src/love/love.c
+++ b/src/love/love.c
@@ -46,10 +46,8 @@ typedef struct _Lscript
46{ 46{
47 char SID[PATH_MAX]; 47 char SID[PATH_MAX];
48 char fileName[PATH_MAX]; 48 char fileName[PATH_MAX];
49 struct timeval startTime;
50 float compileTime; 49 float compileTime;
51 int bugs, warnings; 50 int bugs, warnings;
52 boolean running;
53} LoveScript; 51} LoveScript;
54 52
55 53
@@ -58,7 +56,6 @@ static Eina_Strbuf *LuaSLStream;
58static Eina_Strbuf *clientStream; 56static Eina_Strbuf *clientStream;
59static int scriptCount = 0; 57static int scriptCount = 0;
60static int compiledCount = 0; 58static int compiledCount = 0;
61static float compileTime = 0.0;
62static struct timeval startTime; 59static struct timeval startTime;
63//static int timedEvent = 0; 60//static int timedEvent = 0;
64static char *ownerKey = "12345678-1234-4321-abcd-0123456789ab"; 61static char *ownerKey = "12345678-1234-4321-abcd-0123456789ab";
@@ -145,7 +142,6 @@ static void dirList_compile(const char *name, const char *path, void *data)
145 LoveScript *me = calloc(1, sizeof(LoveScript)); 142 LoveScript *me = calloc(1, sizeof(LoveScript));
146 143
147 scriptCount++; 144 scriptCount++;
148 gettimeofday(&me->startTime, NULL);
149 snprintf(me->SID, sizeof(me->SID), FAKE_UUID); 145 snprintf(me->SID, sizeof(me->SID), FAKE_UUID);
150 snprintf(me->fileName, sizeof(me->fileName), "%s/%s", path, name); 146 snprintf(me->fileName, sizeof(me->fileName), "%s/%s", path, name);
151 eina_hash_add(ourGlobals->scripts, me->SID, me); 147 eina_hash_add(ourGlobals->scripts, me->SID, me);
@@ -161,8 +157,14 @@ static Eina_Bool _addLuaSL(void *data, int type, Ecore_Con_Event_Server_Add *ev)
161 157
162 ourGlobals->serverLuaSL = ev->server; 158 ourGlobals->serverLuaSL = ev->server;
163 159
164 // Compile and run scripts. 160 // Zero everything.
161 eina_hash_free(ourGlobals->scripts);
162 ourGlobals->scripts = eina_hash_string_superfast_new(NULL);
165 gettimeofday(&startTime, NULL); 163 gettimeofday(&startTime, NULL);
164 compiledCount = 0;
165 scriptCount = 0;
166
167 // Compile and run scripts.
166 snprintf(buf, sizeof(buf), "%s/Test%%20sim", prefix_data_get()); 168 snprintf(buf, sizeof(buf), "%s/Test%%20sim", prefix_data_get());
167 eina_file_dir_list(buf, EINA_TRUE, dirList_compile, data); 169 eina_file_dir_list(buf, EINA_TRUE, dirList_compile, data);
168 170
@@ -273,12 +275,12 @@ static Eina_Bool _dataLuaSL(void *data, int type, Ecore_Con_Event_Server_Data *e
273 { 275 {
274 struct timeval now; 276 struct timeval now;
275 277
276 me->compileTime = timeDiff(&now, &me->startTime);
277 compiledCount++; 278 compiledCount++;
278 compileTime += me->compileTime;
279//// PD("Average compile speed is %f scripts per second", compiledCount / compileTime);
280 if (compiledCount == scriptCount) 279 if (compiledCount == scriptCount)
281 PD("TOTAL compile speed is %f scripts per second", compiledCount / timeDiff(&now, &startTime)); 280 {
281 float total = timeDiff(&now, &startTime);
282 PD("Compile speed scripts: %d time: %fs total: %f scripts per second", compiledCount, total, compiledCount / total);
283 }
282 } 284 }
283 } 285 }
284 else if (0 == strcmp(command, "compiled(true)")) 286 else if (0 == strcmp(command, "compiled(true)"))
@@ -287,16 +289,14 @@ static Eina_Bool _dataLuaSL(void *data, int type, Ecore_Con_Event_Server_Data *e
287 { 289 {
288 struct timeval now; 290 struct timeval now;
289 291
290 me->compileTime = timeDiff(&now, &me->startTime);
291 me->running = TRUE;
292 compiledCount++; 292 compiledCount++;
293 compileTime += me->compileTime;
294// PD("Average compile speed is %f scripts per second", compiledCount / compileTime);
295 if (compiledCount == scriptCount) 293 if (compiledCount == scriptCount)
296 PD("TOTAL compile speed is %f scripts per second", compiledCount / timeDiff(&now, &startTime)); 294 {
295 float total = timeDiff(&now, &startTime);
296 PD("Compile speed scripts: %d time: %fs total: %f scripts per second", compiledCount, total, compiledCount / total);
297 }
297 } 298 }
298// PD("The compile of %s worked, running it now.", SID); 299 sendForth(ourGlobals->serverLuaSL, SID, "run(%s)", me->fileName);
299 sendForth(ourGlobals->serverLuaSL, SID, "run()");
300 } 300 }
301 else 301 else
302 { 302 {