summaryrefslogtreecommitdiff
path: root/util/m5/m5.c
diff options
context:
space:
mode:
authorLluís Vilanova <vilanova@ac.upc.edu>2013-01-08 08:54:12 -0500
committerLluís Vilanova <vilanova@ac.upc.edu>2013-01-08 08:54:12 -0500
commit807168a1de1b101622d084c5fe160cf41ff3f59d (patch)
tree171b272f8fa038c30aceb957a0e259f9419be775 /util/m5/m5.c
parent858d99b7cc6515aa6a0e75859aa7b5f460b40bb7 (diff)
downloadgem5-807168a1de1b101622d084c5fe160cf41ff3f59d.tar.xz
util: add m5_fail op.
Used as a command in full-system scripts helps the user ensure the benchmarks have finished successfully. For example, one can use: /path/to/benchmark args || /sbin/m5 fail 1 and thus ensure gem5 will exit with an error if the benchmark fails.
Diffstat (limited to 'util/m5/m5.c')
-rw-r--r--util/m5/m5.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/util/m5/m5.c b/util/m5/m5.c
index e9fe8f1f3..021816ce3 100644
--- a/util/m5/m5.c
+++ b/util/m5/m5.c
@@ -135,6 +135,15 @@ do_exit(int argc, char *argv[])
}
void
+do_fail(int argc, char *argv[])
+{
+ if (argc < 1 || argc > 2)
+ usage();
+
+ m5_fail((argc > 1) ? strtoul(argv[1], NULL, 0) : 0, strtoul(argv[0], NULL, 0));
+}
+
+void
do_reset_stats(int argc, char *argv[])
{
uint64_t ints[2];
@@ -273,6 +282,7 @@ struct MainFunc
struct MainFunc mainfuncs[] = {
{ "exit", do_exit, "[delay]" },
+ { "fail", do_fail, "<code> [delay]" },
{ "resetstats", do_reset_stats, "[delay [period]]" },
{ "dumpstats", do_dump_stats, "[delay [period]]" },
{ "dumpresetstats", do_dump_reset_stats, "[delay [period]]" },