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
7cc9ccbd
Commit
7cc9ccbd
authored
May 22, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Move GetProcessTimes() implementation to kernelbase and ntdll.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b65ca133
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
69 deletions
+41
-69
kernel32.spec
dlls/kernel32/kernel32.spec
+1
-1
time.c
dlls/kernel32/time.c
+0
-64
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+1
-1
process.c
dlls/kernelbase/process.c
+23
-0
process.c
dlls/ntdll/process.c
+16
-3
No files found.
dlls/kernel32/kernel32.spec
View file @
7cc9ccbd
...
...
@@ -791,7 +791,7 @@
@ stdcall -import GetProcessPriorityBoost(long ptr)
@ stdcall -import GetProcessShutdownParameters(ptr ptr)
# @ stub GetProcessorSystemCycleTime
@ stdcall GetProcessTimes(long ptr ptr ptr ptr)
@ stdcall
-import
GetProcessTimes(long ptr ptr ptr ptr)
# @ stub GetProcessUserModeExceptionPolicy
@ stdcall GetProcessVersion(long)
@ stdcall GetProcessWorkingSetSize(long ptr ptr)
...
...
dlls/kernel32/time.c
View file @
7cc9ccbd
...
...
@@ -55,12 +55,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(time);
static
const
struct
_KUSER_SHARED_DATA
*
user_shared_data
=
(
struct
_KUSER_SHARED_DATA
*
)
0x7ffe0000
;
static
inline
void
longlong_to_filetime
(
LONGLONG
t
,
FILETIME
*
ft
)
{
ft
->
dwLowDateTime
=
(
DWORD
)
t
;
ft
->
dwHighDateTime
=
(
DWORD
)(
t
>>
32
);
}
/***********************************************************************
* GetSystemTimeAdjustment (KERNEL32.@)
...
...
@@ -110,64 +104,6 @@ BOOL WINAPI SetSystemTimeAdjustment( DWORD dwTimeAdjustment, BOOL bTimeAdjustmen
}
/*********************************************************************
* TIME_ClockTimeToFileTime (olorin@fandra.org, 20-Sep-1998)
*
* Used by GetProcessTimes to convert clock_t into FILETIME.
*
* Differences to UnixTimeToFileTime:
* 1) Divided by CLK_TCK
* 2) Time is relative. There is no 'starting date', so there is
* no need for offset correction, like in UnixTimeToFileTime
*/
static
void
TIME_ClockTimeToFileTime
(
clock_t
unix_time
,
LPFILETIME
filetime
)
{
long
clocksPerSec
=
sysconf
(
_SC_CLK_TCK
);
ULONGLONG
secs
=
(
ULONGLONG
)
unix_time
*
10000000
/
clocksPerSec
;
filetime
->
dwLowDateTime
=
(
DWORD
)
secs
;
filetime
->
dwHighDateTime
=
(
DWORD
)(
secs
>>
32
);
}
/*********************************************************************
* GetProcessTimes (KERNEL32.@)
*
* Get the user and kernel execution times of a process,
* along with the creation and exit times if known.
*
* PARAMS
* hprocess [in] The process to be queried.
* lpCreationTime [out] The creation time of the process.
* lpExitTime [out] The exit time of the process if exited.
* lpKernelTime [out] The time spent in kernel routines in 100's of nanoseconds.
* lpUserTime [out] The time spent in user routines in 100's of nanoseconds.
*
* RETURNS
* TRUE.
*
* NOTES
* olorin@fandra.org:
* Would be nice to subtract the cpu time used by Wine at startup.
* Also, there is a need to separate times used by different applications.
*
* BUGS
* KernelTime and UserTime are always for the current process
*/
BOOL
WINAPI
GetProcessTimes
(
HANDLE
hprocess
,
LPFILETIME
lpCreationTime
,
LPFILETIME
lpExitTime
,
LPFILETIME
lpKernelTime
,
LPFILETIME
lpUserTime
)
{
struct
tms
tms
;
KERNEL_USER_TIMES
pti
;
times
(
&
tms
);
TIME_ClockTimeToFileTime
(
tms
.
tms_utime
,
lpUserTime
);
TIME_ClockTimeToFileTime
(
tms
.
tms_stime
,
lpKernelTime
);
if
(
NtQueryInformationProcess
(
hprocess
,
ProcessTimes
,
&
pti
,
sizeof
(
pti
),
NULL
))
return
FALSE
;
longlong_to_filetime
(
pti
.
CreateTime
.
QuadPart
,
lpCreationTime
);
longlong_to_filetime
(
pti
.
ExitTime
.
QuadPart
,
lpExitTime
);
return
TRUE
;
}
/*********************************************************************
* GetCalendarInfoA (KERNEL32.@)
*
*/
...
...
dlls/kernelbase/kernelbase.spec
View file @
7cc9ccbd
...
...
@@ -635,7 +635,7 @@
@ stdcall GetProcessPreferredUILanguages(long ptr ptr ptr) kernel32.GetProcessPreferredUILanguages
@ stdcall GetProcessPriorityBoost(long ptr)
@ stdcall GetProcessShutdownParameters(ptr ptr)
@ stdcall GetProcessTimes(long ptr ptr ptr ptr)
kernel32.GetProcessTimes
@ stdcall GetProcessTimes(long ptr ptr ptr ptr)
@ stdcall GetProcessVersion(long) kernel32.GetProcessVersion
@ stdcall GetProcessWorkingSetSizeEx(long ptr ptr ptr)
# @ stub GetProcessorSystemCycleTime
...
...
dlls/kernelbase/process.c
View file @
7cc9ccbd
...
...
@@ -791,6 +791,29 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetProcessShutdownParameters( LPDWORD level, LPDWO
}
/*********************************************************************
* GetProcessTimes (kernelbase.@)
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
GetProcessTimes
(
HANDLE
process
,
FILETIME
*
create
,
FILETIME
*
exit
,
FILETIME
*
kernel
,
FILETIME
*
user
)
{
KERNEL_USER_TIMES
time
;
if
(
!
set_ntstatus
(
NtQueryInformationProcess
(
process
,
ProcessTimes
,
&
time
,
sizeof
(
time
),
NULL
)))
return
FALSE
;
create
->
dwLowDateTime
=
time
.
CreateTime
.
u
.
LowPart
;
create
->
dwHighDateTime
=
time
.
CreateTime
.
u
.
HighPart
;
exit
->
dwLowDateTime
=
time
.
ExitTime
.
u
.
LowPart
;
exit
->
dwHighDateTime
=
time
.
ExitTime
.
u
.
HighPart
;
kernel
->
dwLowDateTime
=
time
.
KernelTime
.
u
.
LowPart
;
kernel
->
dwHighDateTime
=
time
.
KernelTime
.
u
.
HighPart
;
user
->
dwLowDateTime
=
time
.
UserTime
.
u
.
LowPart
;
user
->
dwHighDateTime
=
time
.
UserTime
.
u
.
HighPart
;
return
TRUE
;
}
/***********************************************************************
* GetProcessWorkingSetSizeEx (kernelbase.@)
*/
...
...
dlls/ntdll/process.c
View file @
7cc9ccbd
...
...
@@ -32,6 +32,12 @@
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
...
...
@@ -359,7 +365,7 @@ NTSTATUS WINAPI NtQueryInformationProcess(
break
;
case
ProcessTimes
:
{
KERNEL_USER_TIMES
pti
;
KERNEL_USER_TIMES
pti
=
{{{
0
}}}
;
if
(
ProcessInformationLength
>=
sizeof
(
KERNEL_USER_TIMES
))
{
...
...
@@ -369,8 +375,15 @@ NTSTATUS WINAPI NtQueryInformationProcess(
ret
=
STATUS_INVALID_HANDLE
;
else
{
/* FIXME : User- and KernelTime have to be implemented */
memset
(
&
pti
,
0
,
sizeof
(
KERNEL_USER_TIMES
));
long
ticks
=
sysconf
(
_SC_CLK_TCK
);
struct
tms
tms
;
/* FIXME: user/kernel times only work for current process */
if
(
ticks
&&
times
(
&
tms
)
!=
-
1
)
{
pti
.
UserTime
.
QuadPart
=
(
ULONGLONG
)
tms
.
tms_utime
*
10000000
/
ticks
;
pti
.
KernelTime
.
QuadPart
=
(
ULONGLONG
)
tms
.
tms_stime
*
10000000
/
ticks
;
}
SERVER_START_REQ
(
get_process_info
)
{
...
...
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