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