diff options
author | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 02:29:14 +0100 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 02:29:14 +0100 |
commit | 36e1e5222d094714e673506d857e6d93cdcd8e38 (patch) | |
tree | 88fdc7a07cf63d73208220808409089bd25e31fb | |
parent | da015293b605f82399361f12cff367ebf70eaf69 (diff) |
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.
-rw-r--r-- | bin/printer.py | 3 | ||||
-rw-r--r-- | include/process.h | 5 | ||||
-rw-r--r-- | src/process.c | 8 |
3 files changed, 0 insertions, 16 deletions
diff --git a/bin/printer.py b/bin/printer.py index 58af55a..5628737 100644 --- a/bin/printer.py +++ b/bin/printer.py @@ -521,9 +521,6 @@ class Printer: ("e", "capacity", self.__sim.lib.sal_proc_get_capacity), ("e", "first", self.__sim.lib.sal_proc_get_first), ("e", "last", self.__sim.lib.sal_proc_get_last), - ("e", "exec", - self.__sim.lib.sal_proc_get_instructions_executed - ), ]), ("WORLD", [ ("e", "position", lambda: self.world.pos), diff --git a/include/process.h b/include/process.h index bd46462..26772c3 100644 --- a/include/process.h +++ b/include/process.h @@ -56,11 +56,6 @@ SALIS_API uint32 sal_proc_get_first(void); */ SALIS_API uint32 sal_proc_get_last(void); -/** Get instructions executed on last cycle. -* @return Amount of executed instructions during the last cycle -*/ -SALIS_API uint32 sal_proc_get_instructions_executed(void); - /** Check if process is currently free. * @param proc_id ID of process whose status we want to check * @return Status (either free or running) of the process with the given ID 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). |