m5.c (5754:b50a557f93df) m5.c (5755:8ef4ad572a6b)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
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;

--- 14 unchanged lines hidden (view full) ---

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.
27 *
28 * Authors: Nathan Binkert
29 */
30
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
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;

--- 14 unchanged lines hidden (view full) ---

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.
27 *
28 * Authors: Nathan Binkert
29 */
30
31#ifdef linux
32#define _GNU_SOURCE
33#include <sched.h>
34#endif
35
31#include <inttypes.h>
32#include <err.h>
33#include <fcntl.h>
34#include <stdio.h>
35#include <stdlib.h>
36#include <string.h>
37#include <unistd.h>
38

--- 124 unchanged lines hidden (view full) ---

163 uint64_t param = m5_initparam();
164
165 // run-time, rampup-time, rampdown-time, warmup-time, connections
166 printf("%d %d %d %d %d", (param >> 48) & 0xfff,
167 (param >> 36) & 0xfff, (param >> 24) & 0xfff,
168 (param >> 12) & 0xfff, (param >> 0) & 0xfff);
169}
170
36#include <inttypes.h>
37#include <err.h>
38#include <fcntl.h>
39#include <stdio.h>
40#include <stdlib.h>
41#include <string.h>
42#include <unistd.h>
43

--- 124 unchanged lines hidden (view full) ---

168 uint64_t param = m5_initparam();
169
170 // run-time, rampup-time, rampdown-time, warmup-time, connections
171 printf("%d %d %d %d %d", (param >> 48) & 0xfff,
172 (param >> 36) & 0xfff, (param >> 24) & 0xfff,
173 (param >> 12) & 0xfff, (param >> 0) & 0xfff);
174}
175
176#ifdef linux
177void
178do_pin(int argc, char *argv[])
179{
180 if (argc < 2)
181 usage();
182
183 cpu_set_t mask;
184 CPU_ZERO(&mask);
185
186 const char *sep = ",";
187 char *target = strtok(argv[0], sep);
188 while (target) {
189 CPU_SET(atoi(target), &mask);
190 target = strtok(NULL, sep);
191 }
192
193 if (sched_setaffinity(0, sizeof(cpu_set_t), &mask) < 0)
194 err(1, "setaffinity");
195
196 execvp(argv[1], &argv[1]);
197 err(1, "execvp failed!");
198}
199#endif
200
171struct MainFunc
172{
173 char *name;
174 void (*func)(int argc, char *argv[]);
175 char *usage;
176};
177
178struct MainFunc mainfuncs[] = {
179 { "exit", do_exit, "[delay]" },
180 { "resetstats", do_reset_stats, "[delay [period]]" },
181 { "dumpstats", do_dump_stats, "[delay [period]]" },
182 { "dumpresetstats", do_dump_reset_stats, "[delay [period]]" },
183 { "readfile", do_read_file, "[filename]" },
184 { "execfile", do_exec_file, "<filename>" },
185 { "checkpoint", do_checkpoint, "[delay [period]]" },
186 { "loadsymbol", do_load_symbol, "<address> <symbol>" },
187 { "initparam", do_initparam, "" },
188 { "sw99param", do_sw99param, "" },
201struct MainFunc
202{
203 char *name;
204 void (*func)(int argc, char *argv[]);
205 char *usage;
206};
207
208struct MainFunc mainfuncs[] = {
209 { "exit", do_exit, "[delay]" },
210 { "resetstats", do_reset_stats, "[delay [period]]" },
211 { "dumpstats", do_dump_stats, "[delay [period]]" },
212 { "dumpresetstats", do_dump_reset_stats, "[delay [period]]" },
213 { "readfile", do_read_file, "[filename]" },
214 { "execfile", do_exec_file, "<filename>" },
215 { "checkpoint", do_checkpoint, "[delay [period]]" },
216 { "loadsymbol", do_load_symbol, "<address> <symbol>" },
217 { "initparam", do_initparam, "" },
218 { "sw99param", do_sw99param, "" },
219#ifdef linux
220 { "pin", do_pin, "<cpu> <program> [args ...]" }
221#endif
189};
190int numfuncs = sizeof(mainfuncs) / sizeof(mainfuncs[0]);
191
192void
193usage()
194{
195 int i;
196

--- 34 unchanged lines hidden ---
222};
223int numfuncs = sizeof(mainfuncs) / sizeof(mainfuncs[0]);
224
225void
226usage()
227{
228 int i;
229

--- 34 unchanged lines hidden ---