From 36e1e5222d094714e673506d857e6d93cdcd8e38 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 29 Feb 2024 02:29:14 +0100 Subject: Removed executed instruction counter. [#17] After having removed organisms' reward/punishment mechanisms, the number of executed instructions will always match the number of processes. No need to keep this. --- src/process.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src') diff --git a/src/process.c b/src/process.c index 7483aa7..d997c9b 100644 --- a/src/process.c +++ b/src/process.c @@ -15,7 +15,6 @@ static uint32 g_count; static uint32 g_capacity; static uint32 g_first; static uint32 g_last; -static uint32 g_instructions_executed; static Process *g_procs; void _sal_proc_init(void) @@ -45,7 +44,6 @@ void _sal_proc_quit(void) g_capacity = 0; g_first = 0; g_last = 0; - g_instructions_executed = 0; g_procs = NULL; } @@ -60,7 +58,6 @@ void _sal_proc_load_from(FILE *file) fread(&g_capacity, sizeof(uint32), 1, file); fread(&g_first, sizeof(uint32), 1, file); fread(&g_last, sizeof(uint32), 1, file); - fread(&g_instructions_executed, sizeof(uint32), 1, file); g_procs = calloc(g_capacity, sizeof(Process)); assert(g_procs); fread(g_procs, sizeof(Process), g_capacity, file); @@ -77,7 +74,6 @@ void _sal_proc_save_into(FILE *file) fwrite(&g_capacity, sizeof(uint32), 1, file); fwrite(&g_first, sizeof(uint32), 1, file); fwrite(&g_last, sizeof(uint32), 1, file); - fwrite(&g_instructions_executed, sizeof(uint32), 1, file); fwrite(g_procs, sizeof(Process), g_capacity, file); } @@ -87,7 +83,6 @@ UINT32_GETTER(proc, count) UINT32_GETTER(proc, capacity) UINT32_GETTER(proc, first) UINT32_GETTER(proc, last) -UINT32_GETTER(proc, instructions_executed) boolean sal_proc_is_free(uint32 proc_id) { @@ -1280,9 +1275,7 @@ static void proc_cycle(uint32 pidx) assert(g_is_init); assert(pidx < g_capacity); assert(!sal_proc_is_free(pidx)); - inst = sal_mem_get_inst(g_procs[pidx].ip); - g_instructions_executed++; switch (inst) { case JMPB: @@ -1357,7 +1350,6 @@ void _sal_proc_cycle(void) */ assert(g_is_init); assert(module_is_valid()); - g_instructions_executed = 0; /* Iterate through all organisms in the reaper queue. First organism to execute is the one pointed to by 'g_last' (the one on top of the queue). -- cgit v1.2.1