Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
8b9a0a95
Commit
8b9a0a95
authored
14 years ago
by
Mark Palange (Mani)
Browse files
Options
Downloads
Patches
Plain Diff
EXT-3780 - Fixed up linux errs
parent
07095449
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llcommon/llprocessor.cpp
+74
-33
74 additions, 33 deletions
indra/llcommon/llprocessor.cpp
with
74 additions
and
33 deletions
indra/llcommon/llprocessor.cpp
+
74
−
33
View file @
8b9a0a95
...
...
@@ -180,6 +180,49 @@ namespace
"Altivec"
};
std
::
string
intel_CPUFamilyName
(
int
composed_family
)
{
switch
(
composed_family
)
{
case
3
:
return
"Intel i386"
;
case
4
:
return
"Intel i486"
;
case
5
:
return
"Intel Pentium"
;
case
6
:
return
"Intel Pentium Pro/2/3, Core"
;
case
7
:
return
"Intel Itanium (IA-64)"
;
case
0xF
:
return
"Intel Pentium 4"
;
case
0x10
:
return
"Intel Itanium 2 (IA-64)"
;
}
return
"Unknown"
;
}
std
::
string
amd_CPUFamilyName
(
int
composed_family
)
{
switch
(
composed_family
)
{
case
4
:
return
"AMD 80486/5x86"
;
case
5
:
return
"AMD K5/K6"
;
case
6
:
return
"AMD K7"
;
case
0xF
:
return
"AMD K8"
;
case
0x10
:
return
"AMD K8L"
;
}
return
"Unknown"
;
}
std
::
string
compute_CPUFamilyName
(
const
char
*
cpu_vendor
,
int
composed_family
)
{
const
char
*
intel_string
=
"GenuineIntel"
;
const
char
*
amd_string
=
"AuthenticAMD"
;
if
(
!
strncmp
(
cpu_vendor
,
intel_string
,
strlen
(
intel_string
)))
{
return
intel_CPUFamilyName
(
composed_family
);
}
else
if
(
!
strncmp
(
cpu_vendor
,
amd_string
,
strlen
(
amd_string
)))
{
return
amd_CPUFamilyName
(
composed_family
);
}
return
"Unknown"
;
}
std
::
string
compute_CPUFamilyName
(
const
char
*
cpu_vendor
,
int
family
,
int
ext_family
)
{
const
char
*
intel_string
=
"GenuineIntel"
;
...
...
@@ -187,35 +230,18 @@ namespace
if
(
!
strncmp
(
cpu_vendor
,
intel_string
,
strlen
(
intel_string
)))
{
U32
composed_family
=
family
+
ext_family
;
switch
(
composed_family
)
{
case
3
:
return
"Intel i386"
;
case
4
:
return
"Intel i486"
;
case
5
:
return
"Intel Pentium"
;
case
6
:
return
"Intel Pentium Pro/2/3, Core"
;
case
7
:
return
"Intel Itanium (IA-64)"
;
case
0xF
:
return
"Intel Pentium 4"
;
case
0x10
:
return
"Intel Itanium 2 (IA-64)"
;
default:
return
"Unknown"
;
}
return
intel_CPUFamilyName
(
composed_family
);
}
else
if
(
!
strncmp
(
cpu_vendor
,
amd_string
,
strlen
(
amd_string
)))
{
U32
composed_family
=
(
family
==
0xF
)
?
family
+
ext_family
:
family
;
switch
(
composed_family
)
{
case
4
:
return
"AMD 80486/5x86"
;
case
5
:
return
"AMD K5/K6"
;
case
6
:
return
"AMD K7"
;
case
0xF
:
return
"AMD K8"
;
case
0x10
:
return
"AMD K8L"
;
default:
return
"Unknown"
;
}
return
amd_CPUFamilyName
(
composed_family
);
}
return
"Unknown"
;
}
}
// end unnamed namespace
// The base class for implementations.
...
...
@@ -322,13 +348,16 @@ class LLProcessorInfoImpl
void
setInfo
(
const
std
::
string
&
name
,
const
LLSD
&
value
)
{
mProcessorInfo
[
"info"
][
name
]
=
value
;
}
LLSD
getInfo
(
const
std
::
string
&
name
,
const
LLSD
&
defaultVal
)
const
{
LLSD
r
=
mProcessorInfo
[
"info"
].
get
(
name
);
return
r
.
isDefined
()
?
r
:
defaultVal
;
if
(
mProcessorInfo
[
"info"
].
has
(
name
))
{
return
mProcessorInfo
[
"info"
][
name
];
}
return
defaultVal
;
}
void
setConfig
(
const
std
::
string
&
name
,
const
LLSD
&
value
)
{
mProcessorInfo
[
"config"
][
name
]
=
value
;
}
LLSD
getConfig
(
const
std
::
string
&
name
,
const
LLSD
&
defaultVal
)
const
{
LLSD
r
=
mProcessorInfo
[
"config"
].
get
(
name
);
LLSD
r
=
mProcessorInfo
[
"config"
].
get
(
name
);
return
r
.
isDefined
()
?
r
:
defaultVal
;
}
...
...
@@ -736,11 +765,17 @@ class LLProcessorInfoLinuxImpl : public LLProcessorInfoImpl
// *NOTE:Mani - eww, macros! srry.
#define LLPI_SET_INFO_STRING(llpi_id, cpuinfo_id) \
if (!cpuinfo[cpuinfo_id].empty()) { setInfo(llpi_id, cpuinfo[cpuinfo_id]);}
if (!cpuinfo[cpuinfo_id].empty()) \
{ setInfo(llpi_id, cpuinfo[cpuinfo_id]);}
#define LLPI_SET_INFO_INT(llpi_id, cpuinfo_id) \
if (!cpuinfo[cpuinfo_id].empty()) { setInfo(llpi_id, LLStringUtil::convertToS32(cpuinfo[cpuinfo_id]));}
{\
S32 result; \
if (!cpuinfo[cpuinfo_id].empty() \
&& LLStringUtil::convertToS32(cpuinfo[cpuinfo_id], result)) \
{ setInfo(llpi_id, result);} \
}
F64
mhz
;
if
(
LLStringUtil
::
convertToF64
(
cpuinfo
[
"cpu mhz"
],
mhz
)
&&
200.0
<
mhz
&&
mhz
<
10000.0
)
...
...
@@ -753,11 +788,17 @@ class LLProcessorInfoLinuxImpl : public LLProcessorInfoImpl
LLPI_SET_INFO_INT
(
eStepping
,
"stepping"
);
LLPI_SET_INFO_INT
(
eModel
,
"model"
);
int
family
=
LLStringUtil
::
convertTos32getSysctlInt
(
"machdep.cpu.family"
);
int
ext_family
=
getSysctlInt
(
"machdep.cpu.extfamily"
);
LLPI_SET_INFO_INT
(
eFamily
,
"cpu family"
);
//LLPI_SET_INFO_INT(eExtendedFamily, ext_family);
// setInfo(eFamilyName, compute_CPUFamilyName(cpu_vendor, family, ext_family));
S32
family
;
if
(
!
cpuinfo
[
"cpu family"
].
empty
()
&&
LLStringUtil
::
convertToS32
(
cpuinfo
[
"cpu family"
],
family
))
{
setInfo
(
eFamily
,
family
);
}
setInfo
(
eFamilyName
,
compute_CPUFamilyName
(
cpuinfo
[
"vendor_id"
].
c_str
(),
family
));
// setInfo(eExtendedModel, getSysctlInt("machdep.cpu.extmodel"));
// setInfo(eBrandID, getSysctlInt("machdep.cpu.brand"));
// setInfo(eType, 0); // ? where to find this?
...
...
@@ -774,12 +815,12 @@ class LLProcessorInfoLinuxImpl : public LLProcessorInfoImpl
if
(
flags
.
find
(
" sse "
)
!=
std
::
string
::
npos
)
{
setExtension
(
eSSE_Ext
);
setExtension
(
cpu_feature_names
[
eSSE_Ext
]
);
}
if
(
flags
.
find
(
" sse2 "
)
!=
std
::
string
::
npos
)
{
setExtension
(
eSSE2_Ext
);
setExtension
(
cpu_feature_names
[
eSSE2_Ext
]
);
}
# endif // LL_X86
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment