summaryrefslogtreecommitdiffstats
path: root/tpu.c
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-12-27 13:42:10 +0100
committerLouis Burda <quent.burda@gmail.com>2023-12-27 13:42:10 +0100
commitc06c696a20fa8987bbb13da608153ccfc3cd55e7 (patch)
tree83bfd0270564bab0e8832a9b8902b4493edf82cd /tpu.c
parent238ac5ab6c47bfe0c9cda1490f97f2d7f5d3eaf6 (diff)
downloadtis100-c06c696a20fa8987bbb13da608153ccfc3cd55e7.tar.gz
tis100-c06c696a20fa8987bbb13da608153ccfc3cd55e7.zip
Fixup idle calculation
Diffstat (limited to 'tpu.c')
-rw-r--r--tpu.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tpu.c b/tpu.c
index caa6730..3a62e11 100644
--- a/tpu.c
+++ b/tpu.c
@@ -770,7 +770,6 @@ tis_gen_stats(struct tis *tis)
stats.steps = MAX(stats.steps, tis->out_ports[i]->io_step + 1);
}
}
- if (!stats.steps) stats.steps = tis->steps;
all_steps = 0;
idle_steps = 0;
@@ -784,7 +783,12 @@ tis_gen_stats(struct tis *tis)
}
}
- stats.idle = (float) idle_steps / (float) all_steps;
+ if (!stats.steps) stats.steps = all_steps;
+
+ if (all_steps == 0)
+ stats.idle = 0;
+ else
+ stats.idle = (float) idle_steps / (float) all_steps;
return stats;
}