Wine Profiler patch

Mike McCormack mike at codeweavers.com
Mon Jun 2 03:37:52 CDT 2003


Hi,

This is a profiler that was written by Charles Loep of Codeweavers.  At 
the moment I've missed a bit of the merge, but I haven't got time to 
figure out which bit is missing, so it doesn't work :(  I thought I'd 
put it up here and if anybody is interested in it....

Mike


ChangeLog:
Charles Loep <charles at codeweavers.com>
* implement a profiler for Wine


-------------- next part --------------
Index: Make.rules.in
===================================================================
RCS file: /home/wine/wine/Make.rules.in,v
retrieving revision 1.157
diff -u -r1.157 Make.rules.in
--- Make.rules.in	6 May 2003 18:34:53 -0000	1.157
+++ Make.rules.in	30 May 2003 09:24:44 -0000
@@ -54,7 +54,7 @@
 LINTFLAGS = @LINTFLAGS@
 INCLUDES     = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
 EXTRACFLAGS  = @EXTRACFLAGS@
-ALLCFLAGS    = $(INCLUDES) $(DEFS) $(EXTRACFLAGS) $(CFLAGS)
+ALLCFLAGS    = $(INCLUDES) $(DEFS) $(EXTRACFLAGS) $(CFLAGS) $(PROFILE_CFLAGS)
 ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
 MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs -m 755
 WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.160
diff -u -r1.160 configure.ac
--- configure.ac	21 May 2003 18:50:53 -0000	1.160
+++ configure.ac	30 May 2003 09:24:53 -0000
@@ -20,6 +20,25 @@
 AC_ARG_WITH(curses,    AC_HELP_STRING([--without-curses],[do not use curses]))
 AC_ARG_WITH(nptl,      AC_HELP_STRING([--with-nptl],[use glibc NPTL threading support]))
 AC_ARG_WITH(wine-tools,AC_HELP_STRING([--with-wine-tools=<dir>],[use Wine tools from directory <dir>]))
+AC_ARG_WITH(profiler,AC_HELP_STRING([--with-profiler],[build the profiler]))
+
+if test "x$with_profiler" = "xyes"
+then
+  GLIBC_THREAD_CFLAGS=`glib-config --cflags gthread`
+  GLIBC_THREAD_LIBS=`glib-config --libs gthread`
+  if test "x$GLIBC_THREAD_CFLAGS" != x
+  then
+    PROFILE_CFLAGS="-finstrument-functions  -D__NO_STRING_INLINES -DWINE_NO_PROFILE=\"__attribute__((no_instrument_function))\""
+    PROFILE_LIBS="-L\$(TOPOBJDIR)/libs/wprof -lwineprof -lm"
+    PROFILE_LIBNAME="libwineprof"
+    AC_DEFINE(HAVE_PROFILER,1,[Define to use glibc NPTL threading support.])
+  fi
+fi
+AC_SUBST(PROFILE_CFLAGS)
+AC_SUBST(PROFILE_LIBS)
+AC_SUBST(PROFILE_LIBNAME)
+AC_SUBST(GLIBC_THREAD_CFLAGS)
+AC_SUBST(GLIBC_THREAD_LIBS)
 
 AC_SUBST(WIN16_FILES,"\$(WIN16_FILES)")
 AC_SUBST(WIN16_INSTALL,"\$(WIN16_INSTALL)")
@@ -1500,6 +1519,7 @@
 libs/uuid/Makefile
 libs/wine/Makefile
 libs/wpp/Makefile
+libs/wprof/Makefile
 miscemu/Makefile
 programs/Makefile
 programs/avitools/Makefile
Index: dlls/Makedll.rules.in
===================================================================
RCS file: /home/wine/wine/dlls/Makedll.rules.in,v
retrieving revision 1.55
diff -u -r1.55 Makedll.rules.in
--- dlls/Makedll.rules.in	21 Apr 2003 23:54:06 -0000	1.55
+++ dlls/Makedll.rules.in	30 May 2003 09:24:53 -0000
@@ -9,13 +9,16 @@
 # plus all variables required by the global Make.rules.in
 #
 
+PROFILE_LIBS    = @PROFILE_LIBS@
+PROFILE_CFLAGS  = @PROFILE_CFLAGS@
+
 DEFS        = @DLLFLAGS@ -D__WINESRC__ $(EXTRADEFS)
 DLLEXT      = @DLLEXT@
 MAINSPEC    = $(MODULE:%.dll=%).spec
 SPEC_DEF    = $(MAINSPEC).def
 WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
 ALL_OBJS    = @WIN16_FILES@ $(OBJS) $(MODULE).dbg.o
-ALL_LIBS    = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LIBS)
+ALL_LIBS    = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LIBS) $(PROFILE_LIBS)
 IMPORTLIBS  = $(DELAYIMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
 
 all: $(MODULE)$(DLLEXT) $(SUBDIRS)
Index: libs/Makefile.in
===================================================================
RCS file: /home/wine/wine/libs/Makefile.in,v
retrieving revision 1.5
diff -u -r1.5 Makefile.in
--- libs/Makefile.in	1 May 2003 03:16:21 -0000	1.5
+++ libs/Makefile.in	30 May 2003 09:24:55 -0000
@@ -4,12 +4,15 @@
 VPATH     = @srcdir@
 MODULE    = none
 
+PROFILE_LIBNAME = @PROFILE_LIBNAME@
+
 SUBDIRS = \
 	port \
 	unicode \
 	uuid \
 	wine \
-	wpp
+	wpp \
+	wprof
 
 INSTALLSUBDIRS = \
 	unicode \
@@ -21,7 +24,8 @@
 	libwine_port.a \
 	libwine_unicode.$(LIBEXT) \
 	libwine_uuid.a \
-	libwpp.a
+	libwpp.a \
+	$(PROFILE_LIBNAME:%=%.$(LIBEXT))
 
 @MAKE_RULES@
 
@@ -51,6 +55,9 @@
 
 libwpp.a: wpp/libwpp.a
 	$(RM) $@ && $(LN_S) wpp/$@ $@
+
+libwineprof.so libwineprof.so.1 libwineprof.a: wprof/libwineprof.$(LIBEXT)
+	$(RM) $@ && $(LN_S) wprof/$@ $@
 
 # Directory dependencies
 
Index: miscemu/Makefile.in
===================================================================
RCS file: /home/wine/wine/miscemu/Makefile.in,v
retrieving revision 1.21
diff -u -r1.21 Makefile.in
--- miscemu/Makefile.in	22 May 2003 03:40:41 -0000	1.21
+++ miscemu/Makefile.in	30 May 2003 09:24:55 -0000
@@ -11,6 +11,9 @@
 
 @MAKE_RULES@
 
+PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PROFILE_LIBS = @PROFILE_LIBS@
+
 LDEXECFLAGS = @LDEXECFLAGS@
 
 $(MODULE): $(OBJS) Makefile.in $(DLLDIR)/libntdll.dll.$(LIBEXT)
Index: programs/Makeprog.rules.in
===================================================================
RCS file: /home/wine/wine/programs/Makeprog.rules.in,v
retrieving revision 1.28
diff -u -r1.28 Makeprog.rules.in
--- programs/Makeprog.rules.in	21 Apr 2003 23:54:05 -0000	1.28
+++ programs/Makeprog.rules.in	30 May 2003 09:24:55 -0000
@@ -9,10 +9,13 @@
 # plus all variables required by the global Make.rules.in
 #
 
+PROFILE_LIBS   = @PROFILE_LIBS@
+PROFILE_CFLAGS = @PROFILE_CFLAGS@
+
 DEFS        = @DLLFLAGS@ $(EXTRADEFS)
 LDDLLFLAGS  = @LDDLLFLAGS@
 ALL_OBJS    = $(OBJS) $(MODULE).dbg.o
-ALL_LIBS    = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LIBS)
+ALL_LIBS    = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LIBS) $(PROFILE_LIBS)
 BASEMODULE  = $(MODULE:.exe=)
 TESTIMPORTS = $(DELAYIMPORTS) $(IMPORTS)
 RUNTESTFLAGS= -q -P wine -T $(TOPOBJDIR) $(PLTESTPROGRAM:%=-p %)
Index: scheduler/pthread.c
===================================================================
RCS file: /home/wine/wine/scheduler/pthread.c,v
retrieving revision 1.32
diff -u -r1.32 pthread.c
--- scheduler/pthread.c	3 Apr 2003 02:54:54 -0000	1.32
+++ scheduler/pthread.c	30 May 2003 09:24:55 -0000
@@ -57,6 +57,10 @@
 
 #define PSTR(str) __ASM_NAME(#str)
 
+#ifndef WINE_NO_PROFILE
+#define WINE_NO_PROFILE
+#endif
+
 /* adapt as necessary (a construct like this is used in glibc sources) */
 #define strong_alias(orig, alias) \
  asm(".globl " PSTR(alias) "\n" \
@@ -67,7 +71,7 @@
 static pid_t (*libc_fork)(void);
 static int (*libc_sigaction)(int signum, const struct sigaction *act, struct sigaction *oldact);
 
-void PTHREAD_init_done(void)
+WINE_NO_PROFILE void PTHREAD_init_done(void)
 {
     init_done = 1;
     if (!libc_fork) libc_fork = dlsym( RTLD_NEXT, "fork" );
@@ -104,7 +108,7 @@
 
 #define P_OUTPUT(stuff) write(2,stuff,strlen(stuff))
 
-void __pthread_initialize(void)
+WINE_NO_PROFILE void __pthread_initialize(void)
 {
 }
 
@@ -113,14 +117,14 @@
 	 void* arg;
 };
 
-static DWORD CALLBACK pthread_thread_start(LPVOID data)
+WINE_NO_PROFILE static DWORD CALLBACK pthread_thread_start(LPVOID data)
 {
   struct pthread_thread_init init = *(struct pthread_thread_init*)data;
   HeapFree(GetProcessHeap(),0,data);
   return (DWORD)init.start_routine(init.arg);
 }
 
-int pthread_create(pthread_t* thread, const pthread_attr_t* attr, void*
+WINE_NO_PROFILE int pthread_create(pthread_t* thread, const pthread_attr_t* attr, void*
         (*start_routine)(void *), void* arg)
 {
   HANDLE hThread;
@@ -143,7 +147,7 @@
   return 0;
 }
 
-int pthread_cancel(pthread_t thread)
+WINE_NO_PROFILE int pthread_cancel(pthread_t thread)
 {
   HANDLE hThread = OpenThread(THREAD_ALL_ACCESS, FALSE, (DWORD)thread);
 
@@ -158,7 +162,7 @@
   return 0;             /* return success */
 }
 
-int pthread_join(pthread_t thread, void **value_ptr)
+WINE_NO_PROFILE int pthread_join(pthread_t thread, void **value_ptr)
 {
   HANDLE hThread = OpenThread(THREAD_ALL_ACCESS, FALSE, (DWORD)thread);
 
@@ -174,7 +178,7 @@
 }
 
 /*FIXME: not sure what to do with this one... */
-int pthread_detach(pthread_t thread)
+WINE_NO_PROFILE int pthread_detach(pthread_t thread)
 {
   P_OUTPUT("FIXME:pthread_detach\n");
   return 0;
@@ -182,28 +186,28 @@
 
 /* FIXME: we have no equivalents in win32 for the policys */
 /* so just keep this as a stub */
-int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
+WINE_NO_PROFILE int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
 {
   P_OUTPUT("FIXME:pthread_attr_setschedpolicy\n");
   return 0;
 }
 
 /* FIXME: no win32 equivalent for scope */
-int pthread_attr_setscope(pthread_attr_t *attr, int scope)
+WINE_NO_PROFILE int pthread_attr_setscope(pthread_attr_t *attr, int scope)
 {
   P_OUTPUT("FIXME:pthread_attr_setscope\n");
   return 0; /* return success */
 }
 
 /* FIXME: no win32 equivalent for schedule param */
-int pthread_attr_setschedparam(pthread_attr_t *attr,
+WINE_NO_PROFILE int pthread_attr_setschedparam(pthread_attr_t *attr,
     const struct sched_param *param)
 {
   P_OUTPUT("FIXME:pthread_attr_setschedparam\n");
   return 0; /* return success */
 }
 
-int __pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
+WINE_NO_PROFILE int __pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
 {
   static pthread_once_t the_once = PTHREAD_ONCE_INIT;
   LONG once_now;
@@ -215,7 +219,7 @@
 }
 strong_alias(__pthread_once, pthread_once);
 
-void __pthread_kill_other_threads_np(void)
+WINE_NO_PROFILE void __pthread_kill_other_threads_np(void)
 {
     /* we don't need to do anything here */
 }
@@ -232,7 +236,7 @@
 static atfork_handler atfork_child[MAX_ATFORK];
 static int atfork_count;
 
-int __pthread_atfork(void (*prepare)(void),
+WINE_NO_PROFILE int __pthread_atfork(void (*prepare)(void),
 		     void (*parent)(void),
 		     void (*child)(void))
 {
@@ -247,7 +251,7 @@
 }
 strong_alias(__pthread_atfork, pthread_atfork);
 
-pid_t __fork(void)
+WINE_NO_PROFILE pid_t __fork(void)
 {
     pid_t pid;
     int i;
@@ -276,7 +280,7 @@
 
 /***** MUTEXES *****/
 
-int __pthread_mutex_init(pthread_mutex_t *mutex,
+WINE_NO_PROFILE int __pthread_mutex_init(pthread_mutex_t *mutex,
                         const pthread_mutexattr_t *mutexattr)
 {
   /* glibc has a tendency to initialize mutexes very often, even
@@ -290,7 +294,7 @@
 }
 strong_alias(__pthread_mutex_init, pthread_mutex_init);
 
-static void mutex_real_init( pthread_mutex_t *mutex )
+WINE_NO_PROFILE static void mutex_real_init( pthread_mutex_t *mutex )
 {
   CRITICAL_SECTION *critsect = HeapAlloc(GetProcessHeap(), 0, sizeof(CRITICAL_SECTION));
   InitializeCriticalSection(critsect);
@@ -302,7 +306,7 @@
   }
 }
 
-int __pthread_mutex_lock(pthread_mutex_t *mutex)
+WINE_NO_PROFILE int __pthread_mutex_lock(pthread_mutex_t *mutex)
 {
   if (!init_done) return 0;
   if (!((wine_mutex)mutex)->critsect)
@@ -313,7 +317,7 @@
 }
 strong_alias(__pthread_mutex_lock, pthread_mutex_lock);
 
-int __pthread_mutex_trylock(pthread_mutex_t *mutex)
+WINE_NO_PROFILE int __pthread_mutex_trylock(pthread_mutex_t *mutex)
 {
   if (!init_done) return 0;
   if (!((wine_mutex)mutex)->critsect)
@@ -327,7 +331,7 @@
 }
 strong_alias(__pthread_mutex_trylock, pthread_mutex_trylock);
 
-int __pthread_mutex_unlock(pthread_mutex_t *mutex)
+WINE_NO_PROFILE int __pthread_mutex_unlock(pthread_mutex_t *mutex)
 {
   if (!((wine_mutex)mutex)->critsect) return 0;
   LeaveCriticalSection(((wine_mutex)mutex)->critsect);
@@ -335,7 +339,7 @@
 }
 strong_alias(__pthread_mutex_unlock, pthread_mutex_unlock);
 
-int __pthread_mutex_destroy(pthread_mutex_t *mutex)
+WINE_NO_PROFILE int __pthread_mutex_destroy(pthread_mutex_t *mutex)
 {
   if (!((wine_mutex)mutex)->critsect) return 0;
   if (((wine_mutex)mutex)->critsect->RecursionCount) {
@@ -356,38 +360,38 @@
 /***** MUTEX ATTRIBUTES *****/
 /* just dummies, since critical sections are always recursive */
 
-int __pthread_mutexattr_init(pthread_mutexattr_t *attr)
+WINE_NO_PROFILE int __pthread_mutexattr_init(pthread_mutexattr_t *attr)
 {
   return 0;
 }
 strong_alias(__pthread_mutexattr_init, pthread_mutexattr_init);
 
-int __pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
+WINE_NO_PROFILE int __pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
 {
   return 0;
 }
 strong_alias(__pthread_mutexattr_destroy, pthread_mutexattr_destroy);
 
-int __pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind)
+WINE_NO_PROFILE int __pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind)
 {
   return 0;
 }
 strong_alias(__pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np);
 
-int __pthread_mutexattr_getkind_np(pthread_mutexattr_t *attr, int *kind)
+WINE_NO_PROFILE int __pthread_mutexattr_getkind_np(pthread_mutexattr_t *attr, int *kind)
 {
   *kind = PTHREAD_MUTEX_RECURSIVE;
   return 0;
 }
 strong_alias(__pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np);
 
-int __pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind)
+WINE_NO_PROFILE int __pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind)
 {
   return 0;
 }
 strong_alias(__pthread_mutexattr_settype, pthread_mutexattr_settype);
 
-int __pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *kind)
+WINE_NO_PROFILE int __pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *kind)
 {
   *kind = PTHREAD_MUTEX_RECURSIVE;
   return 0;
@@ -397,7 +401,7 @@
 
 /***** THREAD-SPECIFIC VARIABLES (KEYS) *****/
 
-int __pthread_key_create(pthread_key_t *key, void (*destr_function)(void *))
+WINE_NO_PROFILE int __pthread_key_create(pthread_key_t *key, void (*destr_function)(void *))
 {
   static LONG keycnt = FIRST_KEY;
   *key = InterlockedExchangeAdd(&keycnt, 1);
@@ -405,13 +409,13 @@
 }
 strong_alias(__pthread_key_create, pthread_key_create);
 
-int __pthread_key_delete(pthread_key_t key)
+WINE_NO_PROFILE int __pthread_key_delete(pthread_key_t key)
 {
   return 0;
 }
 strong_alias(__pthread_key_delete, pthread_key_delete);
 
-int __pthread_setspecific(pthread_key_t key, const void *pointer)
+WINE_NO_PROFILE int __pthread_setspecific(pthread_key_t key, const void *pointer)
 {
   TEB *teb = NtCurrentTeb();
   if (!teb->pthread_data) {
@@ -422,7 +426,7 @@
 }
 strong_alias(__pthread_setspecific, pthread_setspecific);
 
-void *__pthread_getspecific(pthread_key_t key)
+WINE_NO_PROFILE void *__pthread_getspecific(pthread_key_t key)
 {
   TEB *teb = NtCurrentTeb();
   if (!teb) return NULL;
@@ -435,23 +439,23 @@
 /***** "EXCEPTION" FRAMES *****/
 /* not implemented right now */
 
-void _pthread_cleanup_push(struct _pthread_cleanup_buffer *buffer, void (*routine)(void *), void *arg)
+WINE_NO_PROFILE void _pthread_cleanup_push(struct _pthread_cleanup_buffer *buffer, void (*routine)(void *), void *arg)
 {
   ((wine_cleanup)buffer)->routine = routine;
   ((wine_cleanup)buffer)->arg = arg;
 }
 
-void _pthread_cleanup_pop(struct _pthread_cleanup_buffer *buffer, int execute)
+WINE_NO_PROFILE void _pthread_cleanup_pop(struct _pthread_cleanup_buffer *buffer, int execute)
 {
   if (execute) (*(((wine_cleanup)buffer)->routine))(((wine_cleanup)buffer)->arg);
 }
 
-void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer *buffer, void (*routine)(void *), void *arg)
+WINE_NO_PROFILE void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer *buffer, void (*routine)(void *), void *arg)
 {
   _pthread_cleanup_push(buffer, routine, arg);
 }
 
-void _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer *buffer, int execute)
+WINE_NO_PROFILE void _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer *buffer, int execute)
 {
   _pthread_cleanup_pop(buffer, execute);
 }
@@ -460,37 +464,37 @@
 /***** CONDITIONS *****/
 /* not implemented right now */
 
-int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *cond_attr)
+WINE_NO_PROFILE int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *cond_attr)
 {
   P_OUTPUT("FIXME:pthread_cond_init\n");
   return 0;
 }
 
-int pthread_cond_destroy(pthread_cond_t *cond)
+WINE_NO_PROFILE int pthread_cond_destroy(pthread_cond_t *cond)
 {
   P_OUTPUT("FIXME:pthread_cond_destroy\n");
   return 0;
 }
 
-int pthread_cond_signal(pthread_cond_t *cond)
+WINE_NO_PROFILE int pthread_cond_signal(pthread_cond_t *cond)
 {
   P_OUTPUT("FIXME:pthread_cond_signal\n");
   return 0;
 }
 
-int pthread_cond_broadcast(pthread_cond_t *cond)
+WINE_NO_PROFILE int pthread_cond_broadcast(pthread_cond_t *cond)
 {
   P_OUTPUT("FIXME:pthread_cond_broadcast\n");
   return 0;
 }
 
-int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
+WINE_NO_PROFILE int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
 {
   P_OUTPUT("FIXME:pthread_cond_wait\n");
   return 0;
 }
 
-int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
+WINE_NO_PROFILE int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime)
 {
   P_OUTPUT("FIXME:pthread_cond_timedwait\n");
   return 0;
@@ -499,12 +503,12 @@
 /**** CONDITION ATTRIBUTES *****/
 /* not implemented right now */
 
-int pthread_condattr_init(pthread_condattr_t *attr)
+WINE_NO_PROFILE int pthread_condattr_init(pthread_condattr_t *attr)
 {
   return 0;
 }
 
-int pthread_condattr_destroy(pthread_condattr_t *attr)
+WINE_NO_PROFILE int pthread_condattr_destroy(pthread_condattr_t *attr)
 {
   return 0;
 }
@@ -512,7 +516,7 @@
 #if (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2)
 /***** READ-WRITE LOCKS *****/
 
-static void rwlock_real_init(pthread_rwlock_t *rwlock)
+WINE_NO_PROFILE static void rwlock_real_init(pthread_rwlock_t *rwlock)
 {
   RTL_RWLOCK *lock = HeapAlloc(GetProcessHeap(), 0, sizeof(RTL_RWLOCK));
   RtlInitializeResource(lock);
@@ -524,14 +528,14 @@
   }
 }
 
-int __pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *rwlock_attr)
+WINE_NO_PROFILE int __pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *rwlock_attr)
 {
   ((wine_rwlock)rwlock)->lock = NULL;
   return 0;
 }
 strong_alias(__pthread_rwlock_init, pthread_rwlock_init);
 
-int __pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
+WINE_NO_PROFILE int __pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
 {
   if (!((wine_rwlock)rwlock)->lock) return 0;
   RtlDeleteResource(((wine_rwlock)rwlock)->lock);
@@ -540,7 +544,7 @@
 }
 strong_alias(__pthread_rwlock_destroy, pthread_rwlock_destroy);
 
-int __pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
+WINE_NO_PROFILE int __pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
 {
   if (!init_done) return 0;
   if (!((wine_rwlock)rwlock)->lock)
@@ -552,7 +556,7 @@
 }
 strong_alias(__pthread_rwlock_rdlock, pthread_rwlock_rdlock);
 
-int __pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock)
+WINE_NO_PROFILE int __pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock)
 {
   if (!init_done) return 0;
   if (!((wine_rwlock)rwlock)->lock)
@@ -566,7 +570,7 @@
 }
 strong_alias(__pthread_rwlock_tryrdlock, pthread_rwlock_tryrdlock);
 
-int __pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
+WINE_NO_PROFILE int __pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
 {
   if (!init_done) return 0;
   if (!((wine_rwlock)rwlock)->lock)
@@ -578,7 +582,7 @@
 }
 strong_alias(__pthread_rwlock_wrlock, pthread_rwlock_wrlock);
 
-int __pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock)
+WINE_NO_PROFILE int __pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock)
 {
   if (!init_done) return 0;
   if (!((wine_rwlock)rwlock)->lock)
@@ -592,7 +596,7 @@
 }
 strong_alias(__pthread_rwlock_trywrlock, pthread_rwlock_trywrlock);
 
-int __pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
+WINE_NO_PROFILE int __pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
 {
   if (!((wine_rwlock)rwlock)->lock) return 0;
   RtlReleaseResource( ((wine_rwlock)rwlock)->lock );
@@ -603,24 +607,24 @@
 /**** READ-WRITE LOCK ATTRIBUTES *****/
 /* not implemented right now */
 
-int pthread_rwlockattr_init(pthread_rwlockattr_t *attr)
+WINE_NO_PROFILE int pthread_rwlockattr_init(pthread_rwlockattr_t *attr)
 {
   return 0;
 }
 
-int __pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr)
+WINE_NO_PROFILE int __pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr)
 {
   return 0;
 }
 strong_alias(__pthread_rwlockattr_destroy, pthread_rwlockattr_destroy);
 
-int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *attr, int *pref)
+WINE_NO_PROFILE int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *attr, int *pref)
 {
   *pref = 0;
   return 0;
 }
 
-int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *attr, int pref)
+WINE_NO_PROFILE int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *attr, int pref)
 {
   return 0;
 }
@@ -628,23 +632,23 @@
 
 /***** MISC *****/
 
-pthread_t pthread_self(void)
+WINE_NO_PROFILE pthread_t pthread_self(void)
 {
   return (pthread_t)GetCurrentThreadId();
 }
 
-int pthread_equal(pthread_t thread1, pthread_t thread2)
+WINE_NO_PROFILE int pthread_equal(pthread_t thread1, pthread_t thread2)
 {
   return (DWORD)thread1 == (DWORD)thread2;
 }
 
-void pthread_exit(void *retval)
+WINE_NO_PROFILE void pthread_exit(void *retval)
 {
   /* FIXME: pthread cleanup */
   ExitThread((DWORD)retval);
 }
 
-int pthread_setcanceltype(int type, int *oldtype)
+WINE_NO_PROFILE int pthread_setcanceltype(int type, int *oldtype)
 {
   if (oldtype) *oldtype = PTHREAD_CANCEL_ASYNCHRONOUS;
   return 0;
@@ -653,7 +657,7 @@
 /***** ANTI-OVERRIDES *****/
 /* pthreads tries to override these, point them back to libc */
 
-int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
+WINE_NO_PROFILE int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
 {
     if (!libc_sigaction)
     {
Index: scheduler/sysdeps.c
===================================================================
RCS file: /home/wine/wine/scheduler/sysdeps.c,v
retrieving revision 1.67
diff -u -r1.67 sysdeps.c
--- scheduler/sysdeps.c	13 May 2003 00:49:49 -0000	1.67
+++ scheduler/sysdeps.c	30 May 2003 09:24:55 -0000
@@ -69,6 +69,10 @@
     int   status;
 };
 
+#ifndef WINE_NO_PROFILE
+#define WINE_NO_PROFILE
+#endif
+
 /* temporary stacks used on thread exit */
 #define TEMP_STACK_SIZE 1024
 #define NB_TEMP_STACKS  8
@@ -362,27 +366,27 @@
 #ifndef HAVE_NPTL
 
 /* default errno before threading is initialized */
-static int *default_errno_location(void)
+WINE_NO_PROFILE static int *default_errno_location(void)
 {
     static int static_errno;
     return &static_errno;
 }
 
 /* default h_errno before threading is initialized */
-static int *default_h_errno_location(void)
+WINE_NO_PROFILE static int *default_h_errno_location(void)
 {
     static int static_h_errno;
     return &static_h_errno;
 }
 
 /* errno once threading is working */
-static int *thread_errno_location(void)
+WINE_NO_PROFILE static int *thread_errno_location(void)
 {
     return &NtCurrentTeb()->thread_errno;
 }
 
 /* h_errno once threading is working */
-static int *thread_h_errno_location(void)
+WINE_NO_PROFILE static int *thread_h_errno_location(void)
 {
     return &NtCurrentTeb()->thread_h_errno;
 }
@@ -395,18 +399,18 @@
  *
  * Get the per-thread errno location.
  */
-int *__errno_location(void) { return errno_location_ptr(); }  /* Linux */
-int *__error(void)          { return errno_location_ptr(); }  /* FreeBSD */
-int *__errno(void)          { return errno_location_ptr(); }  /* NetBSD */
-int *___errno(void)         { return errno_location_ptr(); }  /* Solaris */
-int *__thr_errno(void)      { return errno_location_ptr(); }  /* UnixWare */
+WINE_NO_PROFILE int *__errno_location(void) { return errno_location_ptr(); }  /* Linux */
+WINE_NO_PROFILE int *__error(void)          { return errno_location_ptr(); }  /* FreeBSD */
+WINE_NO_PROFILE int *__errno(void)          { return errno_location_ptr(); }  /* NetBSD */
+WINE_NO_PROFILE int *___errno(void)         { return errno_location_ptr(); }  /* Solaris */
+WINE_NO_PROFILE int *__thr_errno(void)      { return errno_location_ptr(); }  /* UnixWare */
 
 /***********************************************************************
  *           __h_errno_location
  *
  * Get the per-thread h_errno location.
  */
-int *__h_errno_location(void)
+WINE_NO_PROFILE int *__h_errno_location(void)
 {
     return h_errno_location_ptr();
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wprof.tar.gz
Type: application/x-tar
Size: 11740 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20030602/64ac6ee1/wprof.tar.tar


More information about the wine-patches mailing list