diff options
author | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
commit | b2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch) | |
tree | 3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/llcommon/llsys.cpp | |
parent | Second Life viewer sources 1.14.0.1 (diff) | |
download | meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2 meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz |
Second Life viewer sources 1.15.0.2
Diffstat (limited to 'linden/indra/llcommon/llsys.cpp')
-rw-r--r-- | linden/indra/llcommon/llsys.cpp | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/linden/indra/llcommon/llsys.cpp b/linden/indra/llcommon/llsys.cpp index 906bc65..48f2474 100644 --- a/linden/indra/llcommon/llsys.cpp +++ b/linden/indra/llcommon/llsys.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | 5 | * Copyright (c) 2002-2007, Linden Research, Inc. |
6 | * | 6 | * |
7 | * Second Life Viewer Source Code | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | 8 | * The source code in this file ("Source Code") is provided by Linden Lab |
8 | * to you under the terms of the GNU General Public License, version 2.0 | 9 | * to you under the terms of the GNU General Public License, version 2.0 |
9 | * ("GPL"), unless you have obtained a separate licensing agreement | 10 | * ("GPL"), unless you have obtained a separate licensing agreement |
@@ -31,6 +32,7 @@ | |||
31 | 32 | ||
32 | #include <iostream> | 33 | #include <iostream> |
33 | #include <zlib/zlib.h> | 34 | #include <zlib/zlib.h> |
35 | |||
34 | #include "processor.h" | 36 | #include "processor.h" |
35 | 37 | ||
36 | #if LL_WINDOWS | 38 | #if LL_WINDOWS |
@@ -143,7 +145,7 @@ LLOSInfo::LLOSInfo() : | |||
143 | } | 145 | } |
144 | else | 146 | else |
145 | { | 147 | { |
146 | snprintf( /* Flawfinder: ignore */ | 148 | snprintf( /* Flawfinder: ignore */ |
147 | tmp, | 149 | tmp, |
148 | sizeof(tmp), | 150 | sizeof(tmp), |
149 | "%s (Build %d)", | 151 | "%s (Build %d)", |
@@ -308,50 +310,28 @@ LLCPUInfo::LLCPUInfo() | |||
308 | mFamily.assign( info->strFamily ); | 310 | mFamily.assign( info->strFamily ); |
309 | } | 311 | } |
310 | 312 | ||
313 | |||
311 | std::string LLCPUInfo::getCPUString() const | 314 | std::string LLCPUInfo::getCPUString() const |
312 | { | 315 | { |
313 | std::string cpu_string; | ||
314 | |||
315 | #if LL_WINDOWS || LL_DARWIN | 316 | #if LL_WINDOWS || LL_DARWIN |
316 | // gather machine information. | 317 | std::ostringstream out; |
317 | char proc_buf[CPUINFO_BUFFER_SIZE]; /* Flawfinder: ignore */ | ||
318 | CProcessor proc; | ||
319 | if(proc.CPUInfoToText(proc_buf, CPUINFO_BUFFER_SIZE)) | ||
320 | { | ||
321 | cpu_string.append(proc_buf); | ||
322 | } | ||
323 | #else | ||
324 | cpu_string.append("Can't get CPU information"); | ||
325 | #endif | ||
326 | |||
327 | return cpu_string; | ||
328 | } | ||
329 | |||
330 | std::string LLCPUInfo::getCPUStringTerse() const | ||
331 | { | ||
332 | std::string cpu_string; | ||
333 | 318 | ||
334 | #if LL_WINDOWS || LL_DARWIN | ||
335 | CProcessor proc; | 319 | CProcessor proc; |
336 | const ProcessorInfo *info = proc.GetCPUInfo(); | 320 | (void) proc.GetCPUInfo(); |
337 | 321 | out << proc.strCPUName << " "; | |
338 | cpu_string.append(info->strBrandID); | ||
339 | 322 | ||
340 | F64 freq = (F64)(S64)proc.GetCPUFrequency(50) / 1000000.f; | 323 | F32 freq = (F32)(proc.GetCPUFrequency(50) / 1000000.0); |
341 | 324 | ||
342 | // cpu speed is often way wrong, do a sanity check | 325 | // cpu speed is often way wrong, do a sanity check |
343 | if (freq < 10000.f && freq > 200.f ) | 326 | if (200.f < freq && freq < 10000.f) |
344 | { | 327 | { |
345 | char tmp[MAX_STRING]; /* Flawfinder: ignore */ | 328 | out << "(" << (S32)(freq) << " MHz)"; |
346 | snprintf(tmp, sizeof(tmp), " (%.0f Mhz)", freq); /* Flawfinder: ignore */ | ||
347 | |||
348 | cpu_string.append(tmp); | ||
349 | } | 329 | } |
330 | |||
331 | return out.str(); | ||
350 | #else | 332 | #else |
351 | cpu_string.append("Can't get terse CPU information"); | 333 | return "Can't get terse CPU information"; |
352 | #endif | 334 | #endif |
353 | |||
354 | return cpu_string; | ||
355 | } | 335 | } |
356 | 336 | ||
357 | void LLCPUInfo::stream(std::ostream& s) const | 337 | void LLCPUInfo::stream(std::ostream& s) const |