diff options
Diffstat (limited to 'docs/doxygen/nel/a03467.html')
-rw-r--r-- | docs/doxygen/nel/a03467.html | 811 |
1 files changed, 811 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03467.html b/docs/doxygen/nel/a03467.html new file mode 100644 index 00000000..d63943da --- /dev/null +++ b/docs/doxygen/nel/a03467.html @@ -0,0 +1,811 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NLMISC::CSystemInfo class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLMISC::CSystemInfo Class Reference</h1><code>#include <<a class="el" href="a06480.html">system_info.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +<dl compact><dt><b>Author:</b></dt><dd>Vianney Lecroart <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2000 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a06480.html#l00042">42</a> of file <a class="el" href="a06480.html">system_info.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03467.html#NLMISC_1_1CSystemInfoe0">availablePhysicalMemory</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="a03467.html#NLMISC_1_1CSystemInfoe1">getOS</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="a03467.html#NLMISC_1_1CSystemInfoe2">getProc</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a13">uint64</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03467.html#NLMISC_1_1CSystemInfoe3">getProcessorFrequency</a> (bool quick=false)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03467.html#NLMISC_1_1CSystemInfoe4">hasCPUID</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03467.html#NLMISC_1_1CSystemInfoe5">hasMMX</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03467.html#NLMISC_1_1CSystemInfoe6">hasSSE</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03467.html#NLMISC_1_1CSystemInfoe7">isNT</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a11">uint32</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03467.html#NLMISC_1_1CSystemInfoe8">totalPhysicalMemory</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Static Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03467.html#NLMISC_1_1CSystemInfov0">_HaveMMX</a> = DetectMMX ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03467.html#NLMISC_1_1CSystemInfov1">_HaveSSE</a> = DetectSSE ()</td></tr> + +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLMISC_1_1CSystemInfoe0" doxytag="NLMISC::CSystemInfo::availablePhysicalMemory" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLMISC::CSystemInfo::availablePhysicalMemory </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +returns all the physical memory available on this computer +<p> +Definition at line <a class="el" href="a06479.html#l00671">671</a> of file <a class="el" href="a06479.html">system_info.cpp</a>. +<p> +References <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>00672 { +00673 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span> +00674 <span class="preprocessor"></span> +00675 MEMORYSTATUS ms; +00676 GlobalMemoryStatus (&ms); +00677 <span class="keywordflow">return</span> ms.dwAvailPhys; +00678 +00679 <span class="preprocessor">#elif defined NL_OS_UNIX</span> +00680 <span class="preprocessor"></span> +00681 <span class="keywordflow">return</span> getSystemMemory (2) + getSystemMemory (4) + getSystemMemory (5); +00682 +00683 <span class="preprocessor">#endif</span> +00684 <span class="preprocessor"></span> +00685 <span class="keywordflow">return</span> 0; +00686 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CSystemInfoe1" doxytag="NLMISC::CSystemInfo::getOS" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> string NLMISC::CSystemInfo::getOS </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06479.html#l00049">49</a> of file <a class="el" href="a06479.html">system_info.cpp</a>. +<p> +References <a class="el" href="a05646.html#l00649">buffer</a>, <a class="el" href="a05646.html#l00235">len</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, and <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>. +<p> +<div class="fragment"><pre>00050 { +00051 string OSString = <span class="stringliteral">"Unknown"</span>; +00052 +00053 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span> +00054 <span class="preprocessor"></span> +00055 OSVERSIONINFOEX osvi; +00056 BOOL bOsVersionInfoEx; +00057 <span class="keyword">const</span> <span class="keywordtype">int</span> BUFSIZE = 80; +00058 +00059 <span class="comment">// Try calling GetVersionEx using the OSVERSIONINFOEX structure.</span> +00060 <span class="comment">// If that fails, try using the OSVERSIONINFO structure.</span> +00061 +00062 ZeroMemory(&osvi, <span class="keyword">sizeof</span>(OSVERSIONINFOEX)); +00063 osvi.dwOSVersionInfoSize = <span class="keyword">sizeof</span>(OSVERSIONINFOEX); +00064 +00065 <span class="keywordflow">if</span>( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) ) +00066 { +00067 osvi.dwOSVersionInfoSize = <span class="keyword">sizeof</span> (OSVERSIONINFO); +00068 <span class="keywordflow">if</span> (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) +00069 <span class="keywordflow">return</span> OSString+<span class="stringliteral">" Can't GetVersionEx()"</span>; +00070 } +00071 +00072 <span class="keywordflow">switch</span> (osvi.dwPlatformId) +00073 { +00074 <span class="comment">// Test for the Windows NT product family.</span> +00075 <span class="keywordflow">case</span> VER_PLATFORM_WIN32_NT: +00076 +00077 <span class="comment">// Test for the specific product family.</span> +00078 <span class="keywordflow">if</span> ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 ) +00079 OSString = <span class="stringliteral">"Microsoft Windows Server 2003 family "</span>; +00080 +00081 <span class="keywordflow">if</span> ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 ) +00082 OSString = <span class="stringliteral">"Microsoft Windows XP "</span>; +00083 +00084 <span class="keywordflow">if</span> ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 ) +00085 OSString = <span class="stringliteral">"Microsoft Windows 2000 "</span>; +00086 +00087 <span class="keywordflow">if</span> ( osvi.dwMajorVersion <= 4 ) +00088 OSString = <span class="stringliteral">"Microsoft Windows NT "</span>; +00089 +00090 <span class="comment">// Test for specific product on Windows NT 4.0 SP6 and later.</span> +00091 <span class="keywordflow">if</span>( bOsVersionInfoEx ) +00092 { +00093 <span class="comment">// not available on visual 6 SP4, then comment it</span> +00094 +00095 <span class="comment">/* // Test for the workstation type.</span> +00096 <span class="comment"> if ( osvi.wProductType == VER_NT_WORKSTATION )</span> +00097 <span class="comment"> {</span> +00098 <span class="comment"> if( osvi.dwMajorVersion == 4 )</span> +00099 <span class="comment"> printf ( "Workstation 4.0 " );</span> +00100 <span class="comment"> else if( osvi.wSuiteMask & VER_SUITE_PERSONAL )</span> +00101 <span class="comment"> printf ( "Home Edition " );</span> +00102 <span class="comment"> else</span> +00103 <span class="comment"> printf ( "Professional " );</span> +00104 <span class="comment"> }</span> +00105 <span class="comment"> </span> +00106 <span class="comment"> // Test for the server type.</span> +00107 <span class="comment"> else if ( osvi.wProductType == VER_NT_SERVER )</span> +00108 <span class="comment"> {</span> +00109 <span class="comment"> if( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )</span> +00110 <span class="comment"> {</span> +00111 <span class="comment"> if( osvi.wSuiteMask & VER_SUITE_DATACENTER )</span> +00112 <span class="comment"> printf ( "Datacenter Edition " );</span> +00113 <span class="comment"> else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )</span> +00114 <span class="comment"> printf ( "Enterprise Edition " );</span> +00115 <span class="comment"> else if ( osvi.wSuiteMask == VER_SUITE_BLADE )</span> +00116 <span class="comment"> printf ( "Web Edition " );</span> +00117 <span class="comment"> else</span> +00118 <span class="comment"> printf ( "Standard Edition " );</span> +00119 <span class="comment"> }</span> +00120 <span class="comment"></span> +00121 <span class="comment"> else if( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )</span> +00122 <span class="comment"> {</span> +00123 <span class="comment"> if( osvi.wSuiteMask & VER_SUITE_DATACENTER )</span> +00124 <span class="comment"> printf ( "Datacenter Server " );</span> +00125 <span class="comment"> else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )</span> +00126 <span class="comment"> printf ( "Advanced Server " );</span> +00127 <span class="comment"> else</span> +00128 <span class="comment"> printf ( "Server " );</span> +00129 <span class="comment"> }</span> +00130 <span class="comment"></span> +00131 <span class="comment"> else // Windows NT 4.0 </span> +00132 <span class="comment"> {</span> +00133 <span class="comment"> if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )</span> +00134 <span class="comment"> printf ("Server 4.0, Enterprise Edition " );</span> +00135 <span class="comment"> else</span> +00136 <span class="comment"> printf ( "Server 4.0 " );</span> +00137 <span class="comment"> }</span> +00138 <span class="comment"> }*/</span> +00139 } +00140 <span class="keywordflow">else</span> <span class="comment">// Test for specific product on Windows NT 4.0 SP5 and earlier</span> +00141 { +00142 HKEY hKey; +00143 <span class="keywordtype">char</span> szProductType[BUFSIZE]; +00144 DWORD dwBufLen=BUFSIZE; +00145 LONG lRet; +00146 +00147 lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE, <span class="stringliteral">"SYSTEM\\CurrentControlSet\\Control\\ProductOptions"</span>, 0, KEY_QUERY_VALUE, &hKey ); +00148 <span class="keywordflow">if</span>( lRet != ERROR_SUCCESS ) +00149 <span class="keywordflow">return</span> OSString + <span class="stringliteral">" Can't RegOpenKeyEx"</span>; +00150 +00151 lRet = RegQueryValueEx( hKey, <span class="stringliteral">"ProductType"</span>, NULL, NULL, (LPBYTE) szProductType, &dwBufLen); +00152 <span class="keywordflow">if</span>( (lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE) ) +00153 <span class="keywordflow">return</span> OSString + <span class="stringliteral">" Can't ReQueryValueEx"</span>; +00154 +00155 RegCloseKey( hKey ); +00156 +00157 <span class="keywordflow">if</span> ( lstrcmpi( <span class="stringliteral">"WINNT"</span>, szProductType) == 0 ) +00158 OSString += <span class="stringliteral">"Workstation "</span>; +00159 <span class="keywordflow">if</span> ( lstrcmpi( <span class="stringliteral">"LANMANNT"</span>, szProductType) == 0 ) +00160 OSString += <span class="stringliteral">"Server "</span>; +00161 <span class="keywordflow">if</span> ( lstrcmpi( <span class="stringliteral">"SERVERNT"</span>, szProductType) == 0 ) +00162 OSString += <span class="stringliteral">"Advanced Server "</span>; +00163 } +00164 +00165 <span class="comment">// Display service pack (if any) and build number.</span> +00166 +00167 <span class="keywordflow">if</span>( osvi.dwMajorVersion == 4 && lstrcmpi( osvi.szCSDVersion, <span class="stringliteral">"Service Pack 6"</span> ) == 0 ) +00168 { +00169 HKEY hKey; +00170 LONG lRet; +00171 +00172 <span class="comment">// Test for SP6 versus SP6a.</span> +00173 lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE, <span class="stringliteral">"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009"</span>, 0, KEY_QUERY_VALUE, &hKey ); +00174 <span class="keywordflow">if</span>( lRet == ERROR_SUCCESS ) +00175 OSString += <a class="code" href="a05378.html#a244">toString</a>(<span class="stringliteral">"Service Pack 6a (Build %d) "</span>, osvi.dwBuildNumber & 0xFFFF ); +00176 <span class="keywordflow">else</span> <span class="comment">// Windows NT 4.0 prior to SP6a</span> +00177 { +00178 OSString += <a class="code" href="a05378.html#a244">toString</a>(<span class="stringliteral">"%s (Build %d) "</span>, osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); +00179 } +00180 +00181 RegCloseKey( hKey ); +00182 } +00183 <span class="keywordflow">else</span> <span class="comment">// Windows NT 3.51 and earlier or Windows 2000 and later</span> +00184 { +00185 OSString += <a class="code" href="a05378.html#a244">toString</a>(<span class="stringliteral">"%s (Build %d) "</span>, osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); +00186 } +00187 +00188 <span class="keywordflow">break</span>; +00189 +00190 <span class="comment">// Test for the Windows 95 product family.</span> +00191 <span class="keywordflow">case</span> VER_PLATFORM_WIN32_WINDOWS: +00192 +00193 <span class="keywordflow">if</span> (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) +00194 { +00195 OSString = <span class="stringliteral">"Microsoft Windows 95 "</span>; +00196 <span class="keywordflow">if</span> ( osvi.szCSDVersion[1] == <span class="charliteral">'C'</span> || osvi.szCSDVersion[1] == <span class="charliteral">'B'</span> ) +00197 OSString += <span class="stringliteral">"OSR2 "</span>; +00198 } +00199 +00200 <span class="keywordflow">if</span> (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10) +00201 { +00202 OSString = <span class="stringliteral">"Microsoft Windows 98 "</span>; +00203 <span class="keywordflow">if</span> ( osvi.szCSDVersion[1] == <span class="charliteral">'A'</span> ) +00204 OSString += <span class="stringliteral">"SE "</span>; +00205 } +00206 +00207 <span class="keywordflow">if</span> (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) +00208 { +00209 OSString = <span class="stringliteral">"Microsoft Windows Millennium Edition "</span>; +00210 } +00211 <span class="keywordflow">break</span>; +00212 +00213 <span class="keywordflow">case</span> VER_PLATFORM_WIN32s: +00214 +00215 OSString = <span class="stringliteral">"Microsoft Win32s "</span>; +00216 <span class="keywordflow">break</span>; +00217 } +00218 +00219 OSString += <a class="code" href="a05378.html#a244">toString</a>( <span class="stringliteral">"(%d.%d %d)"</span>, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF); +00220 +00221 <span class="preprocessor">#elif defined NL_OS_UNIX</span> +00222 <span class="preprocessor"></span> +00223 <span class="keywordtype">int</span> fd = open(<span class="stringliteral">"/proc/version"</span>, O_RDONLY); +00224 <span class="keywordflow">if</span> (fd == -1) +00225 { +00226 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"SI: Can't get OS from /proc/version: %s"</span>, strerror (errno)); +00227 } +00228 <span class="keywordflow">else</span> +00229 { +00230 <span class="keywordtype">char</span> <a class="code" href="a04223.html#a589">buffer</a>[4096+1]; +00231 <span class="keywordtype">int</span> <a class="code" href="a04223.html#a571">len</a> = read(fd, buffer, <span class="keyword">sizeof</span>(buffer)-1); +00232 close(fd); +00233 +00234 <span class="comment">// remove the \n and set \0</span> +00235 <a class="code" href="a04223.html#a589">buffer</a>[<a class="code" href="a04223.html#a571">len</a>-1] = <span class="charliteral">'\0'</span>; +00236 +00237 OSString = <a class="code" href="a04223.html#a589">buffer</a>; +00238 } +00239 +00240 <span class="preprocessor">#endif // NL_OS_UNIX</span> +00241 <span class="preprocessor"></span> +00242 <span class="keywordflow">return</span> OSString; +00243 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CSystemInfoe2" doxytag="NLMISC::CSystemInfo::getProc" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> string NLMISC::CSystemInfo::getProc </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06479.html#l00374">374</a> of file <a class="el" href="a06479.html">system_info.cpp</a>. +<p> +References <a class="el" href="a05646.html#l01132">value</a>. +<p> +<div class="fragment"><pre>00375 { +00376 string ProcString = <span class="stringliteral">"Unknown"</span>; +00377 +00378 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span> +00379 <span class="preprocessor"></span> +00380 LONG result; +00381 <span class="keywordtype">char</span> <a class="code" href="a04223.html#a658">value</a>[1024]; +00382 DWORD valueSize; +00383 HKEY hKey; +00384 +00385 result = ::RegOpenKeyEx (HKEY_LOCAL_MACHINE, <span class="stringliteral">"Hardware\\Description\\System\\CentralProcessor\\0"</span>, 0, KEY_QUERY_VALUE, &hKey); +00386 <span class="keywordflow">if</span> (result == ERROR_SUCCESS) +00387 { +00388 <span class="comment">// get processor name</span> +00389 valueSize = 1024; +00390 result = ::RegQueryValueEx (hKey, _T(<span class="stringliteral">"ProcessorNameString"</span>), NULL, NULL, (LPBYTE)&<a class="code" href="a04223.html#a658">value</a>, &valueSize); +00391 <span class="keywordflow">if</span> (result == ERROR_SUCCESS) +00392 ProcString = <a class="code" href="a04223.html#a658">value</a>; +00393 <span class="keywordflow">else</span> +00394 ProcString = <span class="stringliteral">"UnknownProc"</span>; +00395 +00396 ProcString += <span class="stringliteral">" / "</span>; +00397 +00398 <span class="comment">// get processor identifier</span> +00399 valueSize = 1024; +00400 result = ::RegQueryValueEx (hKey, _T(<span class="stringliteral">"Identifier"</span>), NULL, NULL, (LPBYTE)&<a class="code" href="a04223.html#a658">value</a>, &valueSize); +00401 <span class="keywordflow">if</span> (result == ERROR_SUCCESS) +00402 ProcString += <a class="code" href="a04223.html#a658">value</a>; +00403 <span class="keywordflow">else</span> +00404 ProcString += <span class="stringliteral">"UnknownIdentifier"</span>; +00405 +00406 ProcString += <span class="stringliteral">" / "</span>; +00407 +00408 <span class="comment">// get processor vendor</span> +00409 valueSize = 1024; +00410 result = ::RegQueryValueEx (hKey, _T(<span class="stringliteral">"VendorIdentifier"</span>), NULL, NULL, (LPBYTE)&<a class="code" href="a04223.html#a658">value</a>, &valueSize); +00411 <span class="keywordflow">if</span> (result == ERROR_SUCCESS) +00412 ProcString += <a class="code" href="a04223.html#a658">value</a>; +00413 <span class="keywordflow">else</span> +00414 ProcString += <span class="stringliteral">"UnknownVendor"</span>; +00415 +00416 ProcString += <span class="stringliteral">" / "</span>; +00417 +00418 <span class="comment">// get processor frequence</span> +00419 result = ::RegQueryValueEx (hKey, _T(<span class="stringliteral">"~MHz"</span>), NULL, NULL, (LPBYTE)&<a class="code" href="a04223.html#a658">value</a>, &valueSize); +00420 <span class="keywordflow">if</span> (result == ERROR_SUCCESS) +00421 { +00422 ProcString += itoa (*(<span class="keywordtype">int</span> *)value, value, 10); +00423 ProcString += <span class="stringliteral">"MHz"</span>; +00424 } +00425 <span class="keywordflow">else</span> +00426 ProcString += <span class="stringliteral">"UnknownFreq"</span>; +00427 } +00428 +00429 <span class="comment">// Make sure to close the reg key</span> +00430 +00431 RegCloseKey (hKey); +00432 +00433 <span class="preprocessor">#elif defined NL_OS_UNIX</span> +00434 <span class="preprocessor"></span> +00435 +00436 <span class="preprocessor">#endif</span> +00437 <span class="preprocessor"></span> +00438 <span class="keywordflow">return</span> ProcString; +00439 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CSystemInfoe3" doxytag="NLMISC::CSystemInfo::getProcessorFrequency" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a13">uint64</a> NLMISC::CSystemInfo::getProcessorFrequency </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">bool </td> + <td class="mdname1" valign="top" nowrap> <em>quick</em> = false </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Gives an evalutation of the processor frequency, in hertz <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>quick</em> </td><td>true to do quick frequency evaluation </td></tr> + </table> +</dl> +<dl compact><dt><b>Warning:</b></dt><dd>Supports only intel architectures for now. Returns 0 if not implemented.</dd></dl> + +<p> +Definition at line <a class="el" href="a06479.html#l00441">441</a> of file <a class="el" href="a06479.html">system_info.cpp</a>. +<p> +References <a class="el" href="a06552.html#l00105">NLMISC::CTime::getPerformanceTime()</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a05586.html#l00073">NLMISC::nlSleep()</a>, <a class="el" href="a06553.html#l00048">NLMISC::TTicks</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00102">uint64</a>. +<p> +<div class="fragment"><pre>00442 { +00443 <span class="keyword">static</span> <a class="code" href="a04558.html#a13">uint64</a> freq = 0; +00444 <span class="preprocessor">#ifdef NL_CPU_INTEL</span> +00445 <span class="preprocessor"></span> <span class="keyword">static</span> <span class="keywordtype">bool</span> freqComputed = <span class="keyword">false</span>; +00446 <span class="keywordflow">if</span> (freqComputed) <span class="keywordflow">return</span> freq; +00447 +00448 <span class="keywordflow">if</span> (!quick) +00449 { +00450 <a class="code" href="a05378.html#a243">TTicks</a> bestNumTicks = 0; +00451 <a class="code" href="a04558.html#a13">uint64</a> bestNumCycles; +00452 <a class="code" href="a04558.html#a13">uint64</a> numCycles; +00453 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> numSamples = 5; +00454 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> numLoops = 50000000; +00455 +00456 <span class="keyword">volatile</span> <a class="code" href="a04558.html#a15">uint</a> k; <span class="comment">// prevent optimisation for the loop</span> +00457 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a05373.html#a2">l</a> = 0; <a class="code" href="a05373.html#a2">l</a> < numSamples; ++<a class="code" href="a05373.html#a2">l</a>) +00458 { +00459 <a class="code" href="a05378.html#a243">TTicks</a> startTick = <a class="code" href="a02142.html#NLMISC_1_1CTimee1">NLMISC::CTime::getPerformanceTime</a>(); +00460 <a class="code" href="a04558.html#a13">uint64</a> startCycle = rdtsc(); +00461 <span class="keyword">volatile</span> <a class="code" href="a04558.html#a15">uint</a> dummy = 0; +00462 <span class="keywordflow">for</span>(k = 0; k < numLoops; ++k) +00463 { +00464 ++ dummy; +00465 } +00466 numCycles = rdtsc() - startCycle; +00467 <a class="code" href="a05378.html#a243">TTicks</a> numTicks = <a class="code" href="a02142.html#NLMISC_1_1CTimee1">NLMISC::CTime::getPerformanceTime</a>() - startTick; +00468 <span class="keywordflow">if</span> (numTicks > bestNumTicks) +00469 { +00470 bestNumTicks = numTicks; +00471 bestNumCycles = numCycles; +00472 } +00473 } +00474 freq = (<a class="code" href="a04558.html#a13">uint64</a>) ((<span class="keywordtype">double</span>) bestNumCycles * 1 / CTime::ticksToSecond(bestNumTicks)); +00475 } +00476 <span class="keywordflow">else</span> +00477 { +00478 <a class="code" href="a05378.html#a243">TTicks</a> timeBefore = <a class="code" href="a02142.html#NLMISC_1_1CTimee1">NLMISC::CTime::getPerformanceTime</a>(); +00479 <a class="code" href="a04558.html#a13">uint64</a> tickBefore = rdtsc(); +00480 <a class="code" href="a05378.html#a256">nlSleep</a> (100); +00481 <a class="code" href="a05378.html#a243">TTicks</a> timeAfter = <a class="code" href="a02142.html#NLMISC_1_1CTimee1">NLMISC::CTime::getPerformanceTime</a>(); +00482 <a class="code" href="a05378.html#a243">TTicks</a> tickAfter = rdtsc(); +00483 +00484 <span class="keywordtype">double</span> timeDelta = CTime::ticksToSecond(timeAfter - timeBefore); +00485 <a class="code" href="a05378.html#a243">TTicks</a> tickDelta = tickAfter - tickBefore; +00486 +00487 freq = (<a class="code" href="a04558.html#a13">uint64</a>) ((<span class="keywordtype">double</span>)tickDelta / timeDelta); +00488 } +00489 +00490 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"SI: CSystemInfo: Processor frequency is %.0f MHz"</span>, (<span class="keywordtype">float</span>)freq/1000000.0); +00491 freqComputed = <span class="keyword">true</span>; +00492 <span class="preprocessor">#endif // NL_CPU_INTEL</span> +00493 <span class="preprocessor"></span> <span class="keywordflow">return</span> freq; +00494 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CSystemInfoe4" doxytag="NLMISC::CSystemInfo::hasCPUID" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CSystemInfo::hasCPUID </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +test wether the cpuid instruction is supported (always false on non intel architectures) +<p> +Definition at line <a class="el" href="a06479.html#l00570">570</a> of file <a class="el" href="a06479.html">system_info.cpp</a>. +<p> +References <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>00571 { +00572 <span class="preprocessor"> #ifdef NL_OS_WINDOWS</span> +00573 <span class="preprocessor"></span> <a class="code" href="a04558.html#a11">uint32</a> result; +00574 __asm +00575 { +00576 pushad +00577 pushfd +00578 <span class="comment">// If ID bit of EFLAGS can change, then cpuid is available</span> +00579 pushfd +00580 pop eax <span class="comment">// Get EFLAG</span> +00581 mov ecx,eax +00582 xor eax,0x200000 <span class="comment">// Flip ID bit</span> +00583 push eax +00584 popfd <span class="comment">// Write EFLAGS</span> +00585 pushfd +00586 pop eax <span class="comment">// read back EFLAG</span> +00587 xor eax,ecx +00588 je noCpuid <span class="comment">// no flip -> no CPUID instr.</span> +00589 +00590 popfd <span class="comment">// restore state</span> +00591 popad +00592 mov result, 1 +00593 jmp CPUIDPresent +00594 +00595 noCpuid: +00596 popfd <span class="comment">// restore state</span> +00597 popad +00598 mov result, 0 +00599 CPUIDPresent: +00600 } +00601 <span class="keywordflow">return</span> result == 1; +00602 <span class="preprocessor"> #else</span> +00603 <span class="preprocessor"></span> <span class="keywordflow">return</span> <span class="keyword">false</span>; +00604 <span class="preprocessor"> #endif</span> +00605 <span class="preprocessor"></span>} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CSystemInfoe5" doxytag="NLMISC::CSystemInfo::hasMMX" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CSystemInfo::hasMMX </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">void </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +helps to know wether the processor features mmx instruction set This is initialized at started, so its fast (always false on non 0x86 architecture ...) +<p> +Definition at line <a class="el" href="a06480.html#l00064">64</a> of file <a class="el" href="a06480.html">system_info.h</a>. +<p> +References <a class="el" href="a06479.html#l00567">_HaveMMX</a>. +<p> +Referenced by <a class="el" href="a06221.html#l00034">NL3D::computeGradient()</a>, and <a class="el" href="a06519.html#l00465">NL3D::CTextureFar::rebuildPatch()</a>. +<p> +<div class="fragment"><pre>00064 {<span class="keywordflow">return</span> <a class="code" href="a03467.html#NLMISC_1_1CSystemInfov0">_HaveMMX</a>;} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CSystemInfoe6" doxytag="NLMISC::CSystemInfo::hasSSE" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CSystemInfo::hasSSE </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">void </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +helps to know wether the processor has streaming SIMD instructions (the OS must supports it) This is initialized at started, so its fast (always false on non 0x86 architecture ...) +<p> +Definition at line <a class="el" href="a06480.html#l00070">70</a> of file <a class="el" href="a06480.html">system_info.h</a>. +<p> +References <a class="el" href="a06479.html#l00568">_HaveSSE</a>. +<p> +<div class="fragment"><pre>00070 {<span class="keywordflow">return</span> <a class="code" href="a03467.html#NLMISC_1_1CSystemInfov1">_HaveSSE</a>;} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CSystemInfoe7" doxytag="NLMISC::CSystemInfo::isNT" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CSystemInfo::isNT </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06479.html#l00608">608</a> of file <a class="el" href="a06479.html">system_info.cpp</a>. +<p> +<div class="fragment"><pre>00609 { +00610 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span> +00611 <span class="preprocessor"></span> OSVERSIONINFO ver; +00612 ver.dwOSVersionInfoSize = <span class="keyword">sizeof</span>(OSVERSIONINFO); +00613 GetVersionEx(&ver); +00614 <span class="keywordflow">return</span> ver.dwPlatformId == VER_PLATFORM_WIN32_NT; +00615 <span class="preprocessor">#else</span> +00616 <span class="preprocessor"></span> <span class="keywordflow">return</span> <span class="keyword">false</span>; +00617 <span class="preprocessor">#endif</span> +00618 <span class="preprocessor"></span>} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CSystemInfoe8" doxytag="NLMISC::CSystemInfo::totalPhysicalMemory" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a11">uint32</a> NLMISC::CSystemInfo::totalPhysicalMemory </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +returns all the physical memory on this computer +<p> +Definition at line <a class="el" href="a06479.html#l00688">688</a> of file <a class="el" href="a06479.html">system_info.cpp</a>. +<p> +References <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>00689 { +00690 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span> +00691 <span class="preprocessor"></span> +00692 MEMORYSTATUS ms; +00693 GlobalMemoryStatus (&ms); +00694 <span class="keywordflow">return</span> ms.dwTotalPhys; +00695 +00696 <span class="preprocessor">#elif defined NL_OS_UNIX</span> +00697 <span class="preprocessor"></span> +00698 <span class="keywordflow">return</span> getSystemMemory (0); +00699 +00700 <span class="preprocessor">#endif</span> +00701 <span class="preprocessor"></span> +00702 <span class="keywordflow">return</span> 0; +00703 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLMISC_1_1CSystemInfov0" doxytag="NLMISC::CSystemInfo::_HaveMMX" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a03467.html#NLMISC_1_1CSystemInfov0">NLMISC::CSystemInfo::_HaveMMX</a> = DetectMMX ()<code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06479.html#l00567">567</a> of file <a class="el" href="a06479.html">system_info.cpp</a>. +<p> +Referenced by <a class="el" href="a06480.html#l00064">hasMMX()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CSystemInfov1" doxytag="NLMISC::CSystemInfo::_HaveSSE" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a03467.html#NLMISC_1_1CSystemInfov1">NLMISC::CSystemInfo::_HaveSSE</a> = DetectSSE ()<code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06479.html#l00568">568</a> of file <a class="el" href="a06479.html">system_info.cpp</a>. +<p> +Referenced by <a class="el" href="a06480.html#l00070">hasSSE()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a06480.html">system_info.h</a><li><a class="el" href="a06479.html">system_info.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:37:04 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |