From: Michael Hampton Date: Tue, 16 Mar 2004 19:05:50 +0000 (+0000) Subject: * Further changes to stress.c, Makefile.in to build it, .cvsignore X-Git-Tag: v7.86~5526 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=0aa9e26b30af9549c650c496a4d3da85badecb19;p=citadel.git * Further changes to stress.c, Makefile.in to build it, .cvsignore (but it's still broken) --- diff --git a/citadel/.cvsignore b/citadel/.cvsignore index 2088cc38a..f8dc8dbcb 100644 --- a/citadel/.cvsignore +++ b/citadel/.cvsignore @@ -49,6 +49,7 @@ sendcommand setup so_locations stats +stress sysdep.h sysdep.h.in sysoputil diff --git a/citadel/ChangeLog b/citadel/ChangeLog index a26ad69d6..5333bfd05 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,8 @@ $Log$ + Revision 614.83 2004/03/16 19:05:50 error + * Further changes to stress.c, Makefile.in to build it, .cvsignore + (but it's still broken) + Revision 614.82 2004/03/15 18:11:34 error * stress.c: various fixed/improvements (but it still isn't working) @@ -5534,4 +5538,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 27bd18640..1ab4eb718 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -21,7 +21,7 @@ all: $(TARGETS) EXEEXT=@EXEEXT@ -CLIENT_TARGETS=citadel$(EXEEXT) whobbs$(EXEEXT) +CLIENT_TARGETS=citadel$(EXEEXT) whobbs$(EXEEXT) stress$(EXEEXT) SERVER_TARGETS=citserver setup $(CHKPWD) SERV_MODULES=serv_chat.o \ serv_upgrade.o \ @@ -82,9 +82,9 @@ SOURCES=aidepost.c auth.c base64.c chkpwd.c citadel.c citadel_ipc.c \ citmail.c citserver.c client_chat.c client_passwords.c \ clientsocket.c commands.c config.c control.c $(DATABASE) \ domain.c serv_extensions.c file_ops.c genstamp.c getutline.c \ - housekeeping.c html.c imap_fetch.c imap_misc.c imap_search.c \ - imap_store.c imap_tools.c internet_addressing.c ipc_c_tcp.c \ - locate_host.c md5.c messages.c \ + housekeeping.c html.c ical_dezonify.c imap_fetch.c imap_misc.c \ + imap_search.c imap_store.c imap_tools.c internet_addressing.c \ + ipc_c_tcp.c locate_host.c md5.c messages.c \ mime_parser.c msgbase.c msgform.c parsedate.c policy.c \ room_ops.c rooms.c routines.c routines2.c \ screen.c sendcommand.c serv_bio.c serv_calendar.c serv_chat.c \ @@ -93,8 +93,8 @@ SOURCES=aidepost.c auth.c base64.c chkpwd.c citadel.c citadel_ipc.c \ serv_newuser.c serv_pas2.c serv_pop3.c serv_rwho.c serv_smtp.c \ serv_spam.c serv_test.c serv_mrtg.c serv_spam.c serv_upgrade.c \ serv_vandelay.c serv_vcard.c server_main.c setup.c snprintf.c \ - support.c sysdep.c tools.c user_ops.c userlist.c \ - whobbs.c vcard.c ical_dezonify.c + stress.c support.c sysdep.c tools.c user_ops.c userlist.c \ + whobbs.c vcard.c DEP_FILES=$(SOURCES:.c=.d) @@ -153,6 +153,9 @@ chkpwd: chkpwd.o auth.o config.o whobbs$(EXEEXT): whobbs.o ipc_c_tcp.o tools.o citadel_ipc.o $(LIBOBJS) $(CC) whobbs.o ipc_c_tcp.o tools.o citadel_ipc.o $(LIBOBJS) $(LDFLAGS) -o whobbs $(LIBS) +stress$(EXEEXT): stress.o ipc_c_tcp.o tools.o citadel_ipc.o $(LIBOBJS) + $(CC) stress.o ipc_c_tcp.o tools.o citadel_ipc.o $(LIBOBJS) $(LDFLAGS) -o stress $(LIBS) + sendcommand: sendcommand.o ipc_c_tcp.o citadel_ipc.o tools.o config.o $(LIBOBJS) $(CC) sendcommand.o ipc_c_tcp.o citadel_ipc.o tools.o config.o \ $(LIBOBJS) $(LDFLAGS) -o sendcommand $(LIBS) diff --git a/citadel/stress.c b/citadel/stress.c index 9c709e643..4fd046191 100644 --- a/citadel/stress.c +++ b/citadel/stress.c @@ -87,6 +87,7 @@ static int m = 1000; /* Number of messages to send; see above */ static volatile int count = 0; /* Total count of messages posted */ static volatile int total = 0; /* Total messages to be posted */ static pthread_mutex_t count_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t arg_mutex = PTHREAD_MUTEX_INITIALIZER; static char username[12]; static char password[12]; @@ -151,7 +152,9 @@ void* worker(void* data) strcpy(msg.author, username); fprintf(stderr, "Trying to connect to Citadel\n"); + pthread_mutex_lock(&arg_mutex); ipc = CtdlIPC_new(*argc_, *argv_, "", ""); + pthread_mutex_unlock(&arg_mutex); if (!ipc) return NULL; /* oops, something happened... */ @@ -273,6 +276,8 @@ int main(int argc, char** argv) int i; /* Counters */ long runtime; /* Run time for each thread */ + setvbuf(stderr, NULL, _IONBF, 0); + /* Read argument list */ for (i = 0; i < argc; i++) { if (!strcmp(argv[i], "-n")) { @@ -320,8 +325,8 @@ int main(int argc, char** argv) /* Then thread attributes (all defaults for now) */ pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - fprintf(stderr, "Creating threads\n"); /* Then, create some threads */ for (i = 0; i < n; ++i) { fprintf(stderr, "\rCreating thread %d", i);