int ProbeMhz() { int mhz=0; char *res; res = atlsys_1L(NULL, "hinv -c processor | fgrep MHz", 0, 0); if (res) { /* Itanium's use MHz */ mhz = GetIntBeforeWord("MHz", res); if (mhz == BADINT) mhz = 0; free(res); } if (!mhz) { res = atlsys_1L(NULL, "hinv -c processor | fgrep MHZ", 0, 0); if (res) { /* MIPS uses MHZ */ mhz = GetIntBeforeWord("MHZ", res); if (mhz == BADINT) mhz = 0; free(res); } } if (!mhz) { res = atlsys_1L(NULL, "hinv -c processor | fgrep GHz", 0, 0); if (res) { /* Don't think MIPS will ever get here, nobody pres uses GHz */ mhz = GetIntBeforeWord("GHz", res); mhz = (mhz == BADINT) ? 0 : mhz*1000; free(res); } } return(mhz); }
int ProbeMhz() { int mhz=0; char res[1024]; if (!CmndOneLine(NULL, "/usr/sbin/psrinfo -v | fgrep MHz", res)) { mhz = GetIntBeforeWord("MHz", res); if (mhz == BADINT) mhz = 0; } if (!mhz && !CmndOneLine(NULL, "/usr/sbin/psrinfo -v | fgrep GHz", res)) { mhz = GetIntBeforeWord("GHz", res); mhz = (mhz == BADINT) ? 0 : mhz*1000; } return(mhz); }
int ProbeMhz() { int mhz=0; char res[1024]; if (!CmndOneLine(NULL, "hinv -c processor | fgrep MHz", res)) { /* Itanium's use MHz */ mhz = GetIntBeforeWord("MHz", res); if (mhz == BADINT) mhz = 0; } if (!mhz && !CmndOneLine(NULL, "hinv -c processor | fgrep MHZ", res)) { /* MIPS uses MHZ */ mhz = GetIntBeforeWord("MHZ", res); if (mhz == BADINT) mhz = 0; } if (!mhz && !CmndOneLine(NULL, "hinv -c processor | fgrep GHz", res)) { /* Don't think MIPS will ever get hear, nobody pres uses GHz */ mhz = GetIntBeforeWord("GHz", res); mhz = (mhz == BADINT) ? 0 : mhz*1000; } return(mhz); }
enum MACHTYPE ProbeArch() { enum ARCHFAM fam; enum MACHTYPE mach=MACHOther; int ierr, i; char res[1024]; fam = ProbeArchFam(NULL); switch(fam) { case AFSPARC: if (!CmndOneLine(NULL, "/usr/sbin/psrinfo -pv | fgrep UltraSPARC", res)) { if (strstr(res, "UltraSPARC-IV")) mach = SunUSIV; else if (strstr(res, "UltraSPARC-III")) mach = SunUSIII; else if (strstr(res, "UltraSPARC-II")) mach = SunUSII; else if (strstr(res, "UltraSPARC-I")) mach = SunUSI; } /* * sparcv9 could be UltraSPARC I,II, III or IV. Only USIII/IV run faster * than 650Mhz (AFAIK), and as far as ATLAS is concerned, USIII & IV are * same processor; so declare anything with Mhz > 700 as an USIII. Newer * chips should have the newer psrinfo used above, which allows more * precise determination anyway. Actually, USIII redesign happened at * 1050Mhz, so I should probably call anything Mhz > 1040 an USIV, but * I assume most USIV will have the newer SunOS/psrinfo above, so declare * anything using this to be USIII, to minimize user confusion. */ else if (!CmndOneLine(NULL, "/usr/sbin/psrinfo -v | fgrep sparcv9", res)) { mach = SunUSX; if (!CmndOneLine(NULL, "/usr/sbin/psrinfo -v | fgrep MHz", res)) { i = GetIntBeforeWord("MHz", res); if (i != BADINT && i > 700) mach = SunUSIII; } else if (!CmndOneLine(NULL, "/usr/sbin/psrinfo -v | fgrep GHz", res)) mach = SunUSIII; } break; } return(mach); }