static UINT32 effective_cpu_mask(int index) { char *s; char buf[5]; UINT32 mask = 0xFFFF; s = osd_getenv(SDLENV_CPUMASKS); if (s != NULL && strcmp(s,"none")) { if (!strcmp(s,"auto")) { if (index<2) mask = 0x01; /* main thread and io threads on cpu #0 */ else mask = (1 << (((index - 1) % (osd_get_num_processors() - 1)) + 1)); } else { if (strlen(s) % 4 != 0 || strlen(s) < (index+1)*4) { fprintf(stderr,"Invalid cpu mask @index %d: %s\n", index, s); } else { memcpy(buf,s+4*index,4); buf[4] = 0; if (sscanf(buf, "%04x", &mask) != 1) fprintf(stderr,"Invalid cpu mask element %d: %s\n", index, buf); } } } return mask; }
static int effective_num_processors(void) { // JJG: To keep mamehub completely deterministic, force the # of processors to 1. return 1; int physprocs = osd_get_num_processors(); // osd_num_processors == 0 for 'auto' if (osd_num_processors > 0) { return MIN(4 * physprocs, osd_num_processors); } else { int numprocs = 0; // if the OSDPROCESSORS environment variable is set, use that value if valid // note that we permit more than the real number of processors for testing const char *procsoverride = osd_getenv(ENV_PROCESSORS); if (procsoverride != NULL && sscanf(procsoverride, "%d", &numprocs) == 1 && numprocs > 0) return MIN(4 * physprocs, numprocs); // otherwise, return the info from the system return physprocs; } }
static int effective_num_processors(void) { char *procsoverride; int numprocs = 0; int physprocs = osd_get_num_processors(); // osd_num_processors == 0 for 'auto' if (osd_num_processors > 0) return MIN(4 * physprocs, osd_num_processors); else { // if the OSDPROCESSORS environment variable is set, use that value if valid procsoverride = osd_getenv(SDLENV_PROCESSORS); if (procsoverride != NULL && sscanf(procsoverride, "%d", &numprocs) == 1 && numprocs > 0) return MIN(4 * physprocs, numprocs); // otherwise, return the info from the system return physprocs; } }
static int effective_num_processors(void) { int physprocs = osd_get_num_processors(); // osd_num_processors == 0 for 'auto' if (osd_num_processors > 0) { return std::min(4 * physprocs, osd_num_processors); } else { int numprocs = 0; // if the OSDPROCESSORS environment variable is set, use that value if valid // note that we permit more than the real number of processors for testing const char *procsoverride = osd_getenv(ENV_PROCESSORS); if (procsoverride != nullptr && sscanf(procsoverride, "%d", &numprocs) == 1 && numprocs > 0) return std::min(4 * physprocs, numprocs); // otherwise, return the info from the system return physprocs; } }