Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
59a54b0f
Commit
59a54b0f
authored
Sep 04, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Sep 04, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Added numa nodes information to SystemLogicalProcessorInformation (linux).
parent
a3d0a196
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
1 deletion
+81
-1
nt.c
dlls/ntdll/nt.c
+81
-1
No files found.
dlls/ntdll/nt.c
View file @
59a54b0f
...
...
@@ -1369,12 +1369,26 @@ static inline BOOL logical_proc_info_add_cache(SYSTEM_LOGICAL_PROCESSOR_INFORMAT
return
TRUE
;
}
static
inline
BOOL
logical_proc_info_add_numa_node
(
SYSTEM_LOGICAL_PROCESSOR_INFORMATION
*
data
,
DWORD
*
len
,
DWORD
max_len
,
ULONG_PTR
mask
,
DWORD
node_id
)
{
if
(
*
len
==
max_len
)
return
FALSE
;
data
[
*
len
].
Relationship
=
RelationNumaNode
;
data
[
*
len
].
ProcessorMask
=
mask
;
data
[
*
len
].
u
.
NumaNode
.
NodeNumber
=
node_id
;
(
*
len
)
++
;
return
TRUE
;
}
static
NTSTATUS
create_logical_proc_info
(
SYSTEM_LOGICAL_PROCESSOR_INFORMATION
**
data
,
DWORD
*
max_len
)
{
static
const
char
core_info
[]
=
"/sys/devices/system/cpu/cpu%d/%s"
;
static
const
char
cache_info
[]
=
"/sys/devices/system/cpu/cpu%d/cache/index%d/%s"
;
static
const
char
numa_info
[]
=
"/sys/devices/system/node/node%d/cpumap"
;
FILE
*
fcpu_list
,
*
f
;
FILE
*
fcpu_list
,
*
f
numa_list
,
*
f
;
DWORD
len
=
0
,
beg
,
end
,
i
,
j
,
r
;
char
op
,
name
[
MAX_PATH
];
...
...
@@ -1523,6 +1537,72 @@ static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION **
}
fclose
(
fcpu_list
);
fnuma_list
=
fopen
(
"/sys/devices/system/node/online"
,
"r"
);
if
(
!
fnuma_list
)
{
ULONG_PTR
mask
=
0
;
for
(
i
=
0
;
i
<
len
;
i
++
)
if
((
*
data
)[
i
].
Relationship
==
RelationProcessorCore
)
mask
|=
(
*
data
)[
i
].
ProcessorMask
;
if
(
len
==
*
max_len
)
{
SYSTEM_LOGICAL_PROCESSOR_INFORMATION
*
new_data
;
*
max_len
*=
2
;
new_data
=
RtlReAllocateHeap
(
GetProcessHeap
(),
0
,
*
data
,
*
max_len
*
sizeof
(
*
new_data
));
if
(
!
new_data
)
return
STATUS_NO_MEMORY
;
*
data
=
new_data
;
}
logical_proc_info_add_numa_node
(
*
data
,
&
len
,
*
max_len
,
mask
,
0
);
}
else
{
while
(
!
feof
(
fnuma_list
))
{
if
(
!
fscanf
(
fnuma_list
,
"%u%c "
,
&
beg
,
&
op
))
break
;
if
(
op
==
'-'
)
fscanf
(
fnuma_list
,
"%u%c "
,
&
end
,
&
op
);
else
end
=
beg
;
for
(
i
=
beg
;
i
<=
end
;
i
++
)
{
ULONG_PTR
mask
=
0
;
sprintf
(
name
,
numa_info
,
i
);
f
=
fopen
(
name
,
"r"
);
if
(
!
f
)
continue
;
while
(
!
feof
(
f
))
{
if
(
!
fscanf
(
f
,
"%x%c "
,
&
r
,
&
op
))
break
;
mask
=
(
sizeof
(
ULONG_PTR
)
>
sizeof
(
int
)
?
mask
<<
(
8
*
sizeof
(
DWORD
))
:
0
)
+
r
;
}
fclose
(
f
);
if
(
len
==
*
max_len
)
{
SYSTEM_LOGICAL_PROCESSOR_INFORMATION
*
new_data
;
*
max_len
*=
2
;
new_data
=
RtlReAllocateHeap
(
GetProcessHeap
(),
0
,
*
data
,
*
max_len
*
sizeof
(
*
new_data
));
if
(
!
new_data
)
{
fclose
(
fnuma_list
);
return
STATUS_NO_MEMORY
;
}
*
data
=
new_data
;
}
logical_proc_info_add_numa_node
(
*
data
,
&
len
,
*
max_len
,
mask
,
i
);
}
}
fclose
(
fnuma_list
);
}
*
max_len
=
len
*
sizeof
(
**
data
);
return
STATUS_SUCCESS
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment