2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * Authors: Nathan Binkert
44 printf("usage: m5 ivlb <interval>\n"
45 " m5 ivle <interval>\n"
49 " m5 resetstats [delay [period]]\n"
50 " m5 dumpstats [delay [period]]\n"
51 " m5 dumpresetstats [delay [period]]\n"
52 " m5 checkpoint [delay [period]]\n"
55 "All times in nanoseconds!\n");
59 #define COMPARE(X) (strcmp(X, command) == 0)
62 main(int argc
, char *argv
[])
75 if (COMPARE("ivlb")) {
79 arg1
= strtoul(argv
[2], NULL
, 0);
84 if (COMPARE("ivle")) {
88 arg1
= strtoul(argv
[2], NULL
, 0);
93 if (COMPARE("initparam")) {
97 printf("%ld", m5_initparam());
101 if (COMPARE("sw99param")) {
105 param
= m5_initparam();
106 // run-time, rampup-time, rampdown-time, warmup-time, connections
107 printf("%d %d %d %d %d", (param
>> 48) & 0xfff,
108 (param
>> 36) & 0xfff, (param
>> 24) & 0xfff,
109 (param
>> 12) & 0xfff, (param
>> 0) & 0xfff);
114 if (COMPARE("exit")) {
117 arg1
= strtoul(argv
[2], NULL
, 0);
127 if (COMPARE("resetstats")) {
130 arg2
= strtoul(argv
[3], NULL
, 0);
132 arg1
= strtoul(argv
[2], NULL
, 0);
134 m5_reset_stats(arg1
, arg2
);
142 if (COMPARE("dumpstats")) {
145 arg2
= strtoul(argv
[3], NULL
, 0);
147 arg1
= strtoul(argv
[2], NULL
, 0);
149 m5_dump_stats(arg1
, arg2
);
157 if (COMPARE("dumpresetstats")) {
160 arg2
= strtoul(argv
[3], NULL
, 0);
162 arg1
= strtoul(argv
[2], NULL
, 0);
164 m5_dumpreset_stats(arg1
, arg2
);
172 if (COMPARE("readfile")) {
180 while ((len
= m5_readfile(buf
, sizeof(buf
), offset
)) > 0) {
181 write(STDOUT_FILENO
, buf
, len
);
188 if (COMPARE("checkpoint")) {
191 arg2
= strtoul(argv
[3], NULL
, 0);
193 arg1
= strtoul(argv
[2], NULL
, 0);
195 m5_checkpoint(arg1
, arg2
);
205 if (COMPARE("loadsymbol")) {
208 if (COMPARE("readfile")) {
216 while ((len
= m5_readfile(buf
, sizeof(buf
), offset
)) > 0) {
217 write(STDOUT_FILENO
, buf
, len
);