Skip to content

Commit

Permalink
Updated TimeLimit to print time per reaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Soroosh129 committed Oct 2, 2021
1 parent f825840 commit 77acbd1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/Python/src/TimeLimit.lf
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,23 @@ reactor Destination {
reaction(x) {=
# print(x.value)
if x.value != self.s:
sys.stderr.write("Error: Expected {:d} and got {:d}.\n".format(self.s, x.value))
sys.stderr.write("ERROR: Expected {:d} and got {:d}.\n".format(self.s, x.value))
exit(1)
self.s += 1
=}
reaction(shutdown) {=
print("**** shutdown reaction invoked.")
if self.s != 10000002:
sys.stderr.write("ERROR: Expected 10000002 but got {:d}.\n".format(self.s))
exit(1)
print(f"Approx. time per reaction: {get_elapsed_physical_time()/(self.s+1):.1f}ns")
=}
}
main reactor TimeLimit(period(1 usec)) {
timer stop(1 secs);
timer stop(10 secs);
reaction(stop) {=
request_stop()
=}
reaction(shutdown) {=
print("**** shutdown reaction invoked.")
=}
c = new Clock(period = period);
d = new Destination();
c.y -> d.x;
Expand Down

0 comments on commit 77acbd1

Please sign in to comment.