Non-perfect epoll patch

Shachar Shemesh wine-devel at
Thu Aug 26 16:43:40 CDT 2004

Shachar Shemesh wrote:

> Hi all,
> Attached is a non-perfect patch for review. This is a migration of the 
> wineserver to use epoll instead of poll (if it's available).
> current known issue with this patch:
> 1. Will not compile if HAVE_SYS_EPOLL_H is not 1 (i.e. - won't compile 
> if epoll not available at compile time)
> 2. Segfaults on wine exit.
> 3. Lots of debug asserts.
> Comments welcome.
>             Shachar
The patch is not yet ready for commit, but I do have preliminary benchmarks:
The attached program (compiled as winelib) was used. ulimit -n was 
raised to 10240.
With the current wine code:
real    0m41.076s
user    0m5.070s
sys     0m7.722s

the main wine process was taking 10% CPU time, and wineserver was taking 
over 60% cpu time. load average was over 2

With my preliminary path:
real    0m20.985s
user    0m5.316s
sys     0m11.421s
main wine process was still taking 10%, but so was wineserver. load 
average was about 1.5.

We can see that there is a significant drop in actual execution time, 
even though there is an INCREASE in user+system processing time. I 
believe this is not a fluke (results are pretty consistent), but rather 
that the poll behavior was taking a huge toll on the system in areas 
where it wasn't attributed towards wine, even though it was wine 
related. I would take the real time measurement as the indicative one.

Ideas for better benchmarks would be greatly appreciated.


Shachar Shemesh
Lingnu Open Source Consulting ltd.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: text/x-csrc
Size: 398 bytes
Desc: not available
Url :
-------------- next part --------------
### Generated by Winemaker

SRCDIR                = .
SUBDIRS               =
DLLS                  =
EXES                  = threadtest.exe

### Common settings

#CEXTRA                = -mno-cygwin
#CXXEXTRA              = -mno-cygwin
CEXTRA                =
CXXEXTRA              =
RCEXTRA               =
INCLUDE_PATH          = -I/home/sun/sources/wine/wine/include
DLL_PATH              =
LIBRARY_PATH          =
LIBRARIES             =

### threadtest.exe sources and settings

threadtest_exe_MODULE = threadtest.exe
threadtest_exe_C_SRCS = main.c
#threadtest_exe_LDFLAGS= -mconsole \
#			-mno-cygwin
threadtest_exe_LDFLAGS= -mconsole
threadtest_exe_DLLS   =
threadtest_exe_LIBRARY_PATH= -L/home/sun/sources/wine/wine/libs -L/home/sun/sources/wine/wine/dlls
threadtest_exe_LIBRARIES= uuid

threadtest_exe_OBJS   = $(threadtest_exe_C_SRCS:.c=.o) \
			$(threadtest_exe_CXX_SRCS:.cpp=.o) \

### Global source lists

C_SRCS                = $(threadtest_exe_C_SRCS)
CXX_SRCS              = $(threadtest_exe_CXX_SRCS)
RC_SRCS               = $(threadtest_exe_RC_SRCS)

### Tools

CC = winegcc
CXX = winegcc
RC = wrc
WINEBUILD = winebuild

### Generic targets

all: $(SUBDIRS) $( $(

### Build rules

.PHONY: all clean dummy

$(SUBDIRS): dummy
	@cd $@ && $(MAKE)

# Implicit rules

.SUFFIXES: .cpp .rc .res

	$(CC) -c $(CFLAGS) $(CEXTRA) $(DEFINCL) -o $@ $<

	$(CXX) -c $(CXXFLAGS) $(CXXEXTRA) $(DEFINCL) -o $@ $<

	$(CXX) -c $(CXXFLAGS) $(CXXEXTRA) $(DEFINCL) -o $@ $<

	$(RC) $(RCFLAGS) $(RCEXTRA) $(DEFINCL) -fo$@ $<

# Rules for cleaning

CLEAN_FILES     = *.dbg.c lex.yy.c \
                  core *.orig *.rej \
                  \\\#*\\\# *~ *% .\\\#*

clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
	$(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(C_SRCS:.c=.o) $(CXX_SRCS:.cpp=.o)
	$(RM) $(DLLS:%=%.dbg.o) $(
	$(RM) $(EXES:%=%.dbg.o) $( $(EXES:%.exe=%)

$(SUBDIRS:%=%/__clean__): dummy
	cd `dirname $@` && $(MAKE) clean

$(EXTRASUBDIRS:%=%/__clean__): dummy
	-cd `dirname $@` && $(RM) $(CLEAN_FILES)

### Target specific build rules

$(threadtest_exe_MODULE).dbg.c: $(threadtest_exe_C_SRCS) $(threadtest_exe_CXX_SRCS)
	$(WINEBUILD) -o $@ --debug -C$(SRCDIR) $(threadtest_exe_C_SRCS) $(threadtest_exe_CXX_SRCS)

$(threadtest_exe_MODULE).so: $(threadtest_exe_MODULE).dbg.o $(threadtest_exe_OBJS)
	$(CXX) $(threadtest_exe_LDFLAGS) -o $@ $(threadtest_exe_OBJS) $(threadtest_exe_MODULE).dbg.o $(threadtest_exe_LIBRARY_PATH) $(LIBRARY_PATH) $(threadtest_exe_DLLS:%=-l%) $(threadtest_exe_LIBRARIES:%=-l%)

More information about the wine-devel mailing list