Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
I think these can be useful for profiling / debugging. The client-side request tracking may seem a bit redundant with the +server channel.
I however think that knowing in which functions the requests were made, as well as the time they took from the client perspective can greatly help debugging, especially in high load situations where the server is busy and doesn't read the requests fast enough.
dlls/ntdll/unix/debug.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/debug.c b/dlls/ntdll/unix/debug.c index 368baac46f4..2fd4c435ddf 100644 --- a/dlls/ntdll/unix/debug.c +++ b/dlls/ntdll/unix/debug.c @@ -42,6 +42,7 @@
WINE_DECLARE_DEBUG_CHANNEL(pid); WINE_DECLARE_DEBUG_CHANNEL(timestamp); +WINE_DECLARE_DEBUG_CHANNEL(microsecs);
static BOOL init_done; static struct debug_info initial_info; /* debug info for initial thread */ @@ -272,7 +273,14 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_
if (init_done) { - if (TRACE_ON(timestamp)) + if (TRACE_ON(microsecs)) + { + LARGE_INTEGER counter, frequency, microsecs; + NtQueryPerformanceCounter(&counter, &frequency); + microsecs.QuadPart = counter.QuadPart * 1000000 / frequency.QuadPart; + pos += sprintf( pos, "%3u.%06u:", (unsigned int)(microsecs.QuadPart / 1000000), (unsigned int)(microsecs.QuadPart % 1000000) ); + } + else if (TRACE_ON(timestamp)) { ULONG ticks = NtGetTickCount(); pos += sprintf( pos, "%3u.%03u:", ticks / 1000, ticks % 1000 );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- include/wine/server.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/include/wine/server.h b/include/wine/server.h index ac5dcc6f8bc..1f22a56a184 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -26,6 +26,7 @@ #include <winbase.h> #include <winternl.h> #include <wine/server_protocol.h> +#include <wine/debug.h>
/* client communication functions */
@@ -125,6 +126,8 @@ static inline void *wine_server_get_ptr( client_ptr_t ptr )
#define SERVER_START_REQ(type) \ do { \ + WINE_DECLARE_DEBUG_CHANNEL(client); \ + static const char *const __req_name = #type; \ struct __server_request_info __req; \ struct type##_request * const req = &__req.u.req.type##_request; \ const struct type##_reply * const reply = &__req.u.reply.type##_reply; \ @@ -132,10 +135,12 @@ static inline void *wine_server_get_ptr( client_ptr_t ptr ) __req.u.req.request_header.req = REQ_##type; \ __req.data_count = 0; \ (void)reply; \ + TRACE_(client)("start %s\n", __req_name); \ do
#define SERVER_END_REQ \ while(0); \ + TRACE_(client)("end %s\n", __req_name); \ } while(0)