diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llcommon/llprocessor.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/llcommon/llprocessor.h')
-rw-r--r-- | linden/indra/llcommon/llprocessor.h | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/linden/indra/llcommon/llprocessor.h b/linden/indra/llcommon/llprocessor.h new file mode 100644 index 0000000..cbadb42 --- /dev/null +++ b/linden/indra/llcommon/llprocessor.h | |||
@@ -0,0 +1,176 @@ | |||
1 | /** | ||
2 | * @file llprocessor.h | ||
3 | * @brief Code to figure out the processor. Originally by Benjamin Jurke. | ||
4 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * 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 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | // Author: Benjamin Jurke | ||
29 | // File history: 27.02.2002 File created. | ||
30 | /////////////////////////////////////////// | ||
31 | |||
32 | |||
33 | #ifndef LLPROCESSOR_H | ||
34 | #define LLPROCESSOR_H | ||
35 | |||
36 | // Options: | ||
37 | /////////// | ||
38 | #if LL_WINDOWS | ||
39 | #define PROCESSOR_FREQUENCY_MEASURE_AVAILABLE | ||
40 | #endif | ||
41 | |||
42 | |||
43 | typedef struct ProcessorExtensions | ||
44 | { | ||
45 | bool FPU_FloatingPointUnit; | ||
46 | bool VME_Virtual8086ModeEnhancements; | ||
47 | bool DE_DebuggingExtensions; | ||
48 | bool PSE_PageSizeExtensions; | ||
49 | bool TSC_TimeStampCounter; | ||
50 | bool MSR_ModelSpecificRegisters; | ||
51 | bool PAE_PhysicalAddressExtension; | ||
52 | bool MCE_MachineCheckException; | ||
53 | bool CX8_COMPXCHG8B_Instruction; | ||
54 | bool APIC_AdvancedProgrammableInterruptController; | ||
55 | unsigned int APIC_ID; | ||
56 | bool SEP_FastSystemCall; | ||
57 | bool MTRR_MemoryTypeRangeRegisters; | ||
58 | bool PGE_PTE_GlobalFlag; | ||
59 | bool MCA_MachineCheckArchitecture; | ||
60 | bool CMOV_ConditionalMoveAndCompareInstructions; | ||
61 | bool FGPAT_PageAttributeTable; | ||
62 | bool PSE36_36bitPageSizeExtension; | ||
63 | bool PN_ProcessorSerialNumber; | ||
64 | bool CLFSH_CFLUSH_Instruction; | ||
65 | unsigned int CLFLUSH_InstructionCacheLineSize; | ||
66 | bool DS_DebugStore; | ||
67 | bool ACPI_ThermalMonitorAndClockControl; | ||
68 | bool EMMX_MultimediaExtensions; | ||
69 | bool MMX_MultimediaExtensions; | ||
70 | bool FXSR_FastStreamingSIMD_ExtensionsSaveRestore; | ||
71 | bool SSE_StreamingSIMD_Extensions; | ||
72 | bool SSE2_StreamingSIMD2_Extensions; | ||
73 | bool SS_SelfSnoop; | ||
74 | bool HT_HyperThreading; | ||
75 | unsigned int HT_HyterThreadingSiblings; | ||
76 | bool TM_ThermalMonitor; | ||
77 | bool IA64_Intel64BitArchitecture; | ||
78 | bool _3DNOW_InstructionExtensions; | ||
79 | bool _E3DNOW_InstructionExtensions; | ||
80 | bool AA64_AMD64BitArchitecture; | ||
81 | } ProcessorExtensions; | ||
82 | |||
83 | typedef struct ProcessorCache | ||
84 | { | ||
85 | bool bPresent; | ||
86 | char strSize[32]; /* Flawfinder: ignore */ | ||
87 | unsigned int uiAssociativeWays; | ||
88 | unsigned int uiLineSize; | ||
89 | bool bSectored; | ||
90 | char strCache[128]; /* Flawfinder: ignore */ | ||
91 | } ProcessorCache; | ||
92 | |||
93 | typedef struct ProcessorL1Cache | ||
94 | { | ||
95 | ProcessorCache Instruction; | ||
96 | ProcessorCache Data; | ||
97 | } ProcessorL1Cache; | ||
98 | |||
99 | typedef struct ProcessorTLB | ||
100 | { | ||
101 | bool bPresent; | ||
102 | char strPageSize[32]; /* Flawfinder: ignore */ | ||
103 | unsigned int uiAssociativeWays; | ||
104 | unsigned int uiEntries; | ||
105 | char strTLB[128]; /* Flawfinder: ignore */ | ||
106 | } ProcessorTLB; | ||
107 | |||
108 | typedef struct ProcessorInfo | ||
109 | { | ||
110 | char strVendor[16]; /* Flawfinder: ignore */ | ||
111 | unsigned int uiFamily; | ||
112 | unsigned int uiExtendedFamily; | ||
113 | char strFamily[64]; /* Flawfinder: ignore */ | ||
114 | unsigned int uiModel; | ||
115 | unsigned int uiExtendedModel; | ||
116 | char strModel[128]; /* Flawfinder: ignore */ | ||
117 | unsigned int uiStepping; | ||
118 | unsigned int uiType; | ||
119 | char strType[64]; /* Flawfinder: ignore */ | ||
120 | unsigned int uiBrandID; | ||
121 | char strBrandID[64]; /* Flawfinder: ignore */ | ||
122 | char strProcessorSerial[64]; /* Flawfinder: ignore */ | ||
123 | unsigned long MaxSupportedLevel; | ||
124 | unsigned long MaxSupportedExtendedLevel; | ||
125 | ProcessorExtensions _Ext; | ||
126 | ProcessorL1Cache _L1; | ||
127 | ProcessorCache _L2; | ||
128 | ProcessorCache _L3; | ||
129 | ProcessorCache _Trace; | ||
130 | ProcessorTLB _Instruction; | ||
131 | ProcessorTLB _Data; | ||
132 | } ProcessorInfo; | ||
133 | |||
134 | |||
135 | // CProcessor | ||
136 | // ========== | ||
137 | // Class for detecting the processor name, type and available | ||
138 | // extensions as long as it's speed. | ||
139 | ///////////////////////////////////////////////////////////// | ||
140 | class CProcessor | ||
141 | { | ||
142 | // Constructor / Destructor: | ||
143 | //////////////////////////// | ||
144 | public: | ||
145 | CProcessor(); | ||
146 | |||
147 | // Private vars: | ||
148 | //////////////// | ||
149 | public: | ||
150 | F64 uqwFrequency; | ||
151 | char strCPUName[128]; /* Flawfinder: ignore */ | ||
152 | ProcessorInfo CPUInfo; | ||
153 | |||
154 | // Private functions: | ||
155 | ///////////////////// | ||
156 | private: | ||
157 | bool AnalyzeIntelProcessor(); | ||
158 | bool AnalyzeAMDProcessor(); | ||
159 | bool AnalyzeUnknownProcessor(); | ||
160 | bool CheckCPUIDPresence(); | ||
161 | void DecodeProcessorConfiguration(unsigned int cfg); | ||
162 | void TranslateProcessorConfiguration(); | ||
163 | void GetStandardProcessorConfiguration(); | ||
164 | void GetStandardProcessorExtensions(); | ||
165 | |||
166 | // Public functions: | ||
167 | //////////////////// | ||
168 | public: | ||
169 | F64 GetCPUFrequency(unsigned int uiMeasureMSecs); | ||
170 | const ProcessorInfo *GetCPUInfo(); | ||
171 | bool CPUInfoToText(char *strBuffer, unsigned int uiMaxLen); | ||
172 | bool WriteInfoTextFile(const char *strFilename); | ||
173 | }; | ||
174 | |||
175 | |||
176 | #endif | ||