diff --git a/pynars/ConsolePlus.py b/pynars/ConsolePlus.py index b6ff2f2..0b62ec8 100644 --- a/pynars/ConsolePlus.py +++ b/pynars/ConsolePlus.py @@ -222,10 +222,9 @@ def toggle_silent() -> None: @cmd_register('cycles') def cycles(*args: List[str]) -> None: - '''Format: volume [volume:int 0~100] - Set the Output Volume of the console to control its output (same as OpenNARS)''' + '''Prints the "average cycles per second" metric''' current_NARS_interface.print_output( - type=PrintType.INFO, content=f'''Cycles per second is {current_NARS_interface.reasoner.cycles_per_second}.''') + type=PrintType.INFO, content=f'''Cycles per second is {current_NARS_interface.reasoner.cycles_per_second}. Last cycle took {current_NARS_interface.reasoner.last_cycle_duration:f} seconds.''') @cmd_register(('volume'), (int, 100)) def volume(vol:int) -> None: diff --git a/pynars/NARS/Control/Reasoner.py b/pynars/NARS/Control/Reasoner.py index d8d34b7..d2e3e56 100644 --- a/pynars/NARS/Control/Reasoner.py +++ b/pynars/NARS/Control/Reasoner.py @@ -54,7 +54,7 @@ def __init__(self, n_memory, capacity, config='./config.json', nal_rules={1, 2, self.cycles_per_second_timer = 0 self.cycles_per_second_counter = 0 self.cycles_per_second = 0 - self.last_cycle_time = 0 + self.last_cycle_duration = 0 def reset(self): self.memory.reset() @@ -115,13 +115,11 @@ def cycle(self): tasks_derived = [ task for task in tasks_derived if task.term.complexity <= thresh_complexity] - - # done with cycle - + """done with cycle""" # record some metrics - total_cycle_time_in_seconds = time.time() - start_cycle_time_in_seconds - self.last_cycle_time = total_cycle_time_in_seconds - self.cycles_per_second_timer += total_cycle_time_in_seconds + total_cycle_duration_in_seconds = time.time() - start_cycle_time_in_seconds + self.last_cycle_duration = total_cycle_duration_in_seconds + self.cycles_per_second_timer += total_cycle_duration_in_seconds self.cycles_per_second_counter += 1 if self.cycles_per_second_timer > 1: # 1 second has passed @@ -129,7 +127,6 @@ def cycle(self): self.cycles_per_second_timer = 0 # reset the timer self.cycles_per_second_counter = 0 # reset the counter - return tasks_derived, judgement_revised, goal_revised, answers_question, answers_quest, ( task_operation_return, task_executed)