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
67755d25
Commit
67755d25
authored
Mar 06, 2011
by
Maarten Lankhorst
Committed by
Alexandre Julliard
Mar 08, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Fix time units for SystemPerformanceProcessorInformation, and steal idle…
ntdll: Fix time units for SystemPerformanceProcessorInformation, and steal idle time for kernel time.
parent
254b8f85
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
nt.c
dlls/ntdll/nt.c
+22
-15
No files found.
dlls/ntdll/nt.c
View file @
67755d25
...
@@ -1310,6 +1310,25 @@ void fill_cpu_info(void)
...
@@ -1310,6 +1310,25 @@ void fill_cpu_info(void)
cached_sci
.
Architecture
,
cached_sci
.
Level
,
cached_sci
.
Revision
,
cached_sci
.
FeatureSet
);
cached_sci
.
Architecture
,
cached_sci
.
Level
,
cached_sci
.
Revision
,
cached_sci
.
FeatureSet
);
}
}
static
void
fill_in_sppi
(
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
*
sppi
,
DWORD64
idle
,
DWORD64
sys
,
DWORD64
usr
)
{
DWORD64
steal
;
sppi
->
IdleTime
.
QuadPart
=
idle
*
10000000
/
sysconf
(
_SC_CLK_TCK
);
sppi
->
KernelTime
.
QuadPart
=
sys
*
10000000
/
sysconf
(
_SC_CLK_TCK
);
sppi
->
UserTime
.
QuadPart
=
usr
*
10000000
/
sysconf
(
_SC_CLK_TCK
);
/* Add 1% from idle time to kernel time, to make .NET happy */
steal
=
sppi
->
IdleTime
.
QuadPart
/
100
;
sppi
->
IdleTime
.
QuadPart
-=
steal
;
sppi
->
KernelTime
.
QuadPart
+=
steal
;
/* DPC time */
sppi
->
Reserved1
[
0
].
QuadPart
=
0
;
/* Interrupt time */
sppi
->
Reserved1
[
1
].
QuadPart
=
0
;
sppi
->
Reserved2
=
0
;
}
/******************************************************************************
/******************************************************************************
* NtQuerySystemInformation [NTDLL.@]
* NtQuerySystemInformation [NTDLL.@]
* ZwQuerySystemInformation [NTDLL.@]
* ZwQuerySystemInformation [NTDLL.@]
...
@@ -1610,11 +1629,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
...
@@ -1610,11 +1629,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
usr
+=
nice
;
usr
+=
nice
;
sppi
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sppi
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
));
sizeof
(
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
));
sppi
->
IdleTime
.
QuadPart
=
idle
;
fill_in_sppi
(
sppi
,
idle
,
sys
,
usr
);
sppi
->
KernelTime
.
QuadPart
=
sys
;
sppi
->
UserTime
.
QuadPart
=
usr
+
nice
;
sppi
->
Reserved1
[
0
].
QuadPart
=
0
;
sppi
->
Reserved1
[
1
].
QuadPart
=
0
;
cpus
=
1
;
cpus
=
1
;
len
=
sizeof
(
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
);
len
=
sizeof
(
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
);
}
}
...
@@ -1638,20 +1653,12 @@ NTSTATUS WINAPI NtQuerySystemInformation(
...
@@ -1638,20 +1653,12 @@ NTSTATUS WINAPI NtQuerySystemInformation(
usr
+=
nice
;
usr
+=
nice
;
out_cpus
--
;
out_cpus
--
;
if
(
name
[
3
]
==
'0'
)
/* first cpu */
if
(
name
[
3
]
==
'0'
)
/* first cpu */
{
fill_in_sppi
(
sppi
,
idle
,
sys
,
usr
);
sppi
->
IdleTime
.
QuadPart
=
idle
;
sppi
->
KernelTime
.
QuadPart
=
sys
;
sppi
->
UserTime
.
QuadPart
=
usr
;
}
else
/* new cpu */
else
/* new cpu */
{
{
len
=
sizeof
(
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
)
*
(
cpus
+
1
);
len
=
sizeof
(
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
)
*
(
cpus
+
1
);
sppi
=
RtlReAllocateHeap
(
GetProcessHeap
(),
0
,
sppi
,
len
);
sppi
=
RtlReAllocateHeap
(
GetProcessHeap
(),
0
,
sppi
,
len
);
sppi
[
cpus
].
IdleTime
.
QuadPart
=
idle
;
fill_in_sppi
(
sppi
+
cpus
,
idle
,
sys
,
usr
);
sppi
[
cpus
].
KernelTime
.
QuadPart
=
sys
;
sppi
[
cpus
].
UserTime
.
QuadPart
=
usr
;
sppi
[
cpus
].
Reserved1
[
0
].
QuadPart
=
0
;
sppi
[
cpus
].
Reserved1
[
1
].
QuadPart
=
0
;
cpus
++
;
cpus
++
;
}
}
}
}
...
...
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