Permalink
Browse files

refactor stats collection into simplehttp; add generic logging to sim…

…plehttp with -V option; update all apps to compile; add gitignore
  • Loading branch information...
mreiferson committed Mar 15, 2011
1 parent 0b11575 commit e91b668e03a7b14d43b95ba61fb5cd38d1662ff1
View
@@ -0,0 +1,4 @@
+*.o
+*.a
+*.dSYM
+sortdb/sortdb
View
@@ -1 +0,0 @@
-void simplehttp_log(const char type, const char *host, struct evhttp_request *req, uint64_t req_time, const char *id);
View
@@ -1,15 +0,0 @@
-#if _POSIX_TIMERS > 0
-
-static struct timespec ts1, ts2;
-
-void _gettime(struct timespec *ts);
-unsigned int _ts_diff(struct timespec start, struct timespec end);
-
-#else
-
-static struct timeval ts1, ts2;
-
-void _gettime(struct timeval *ts);
-unsigned int _ts_diff(struct timeval start, struct timeval end);
-
-#endif
View
@@ -4,10 +4,8 @@
#include <string.h>
#include <unistd.h>
#include <time.h>
-
-#include "simplehttp/pubsubclient.h"
-#include "event.h"
-#include "evhttp.h"
+#include <simplehttp/pubsubclient.h>
+#include <simplehttp/simplehttp.h>
#define DEBUG 0
View
@@ -5,7 +5,7 @@ LIBSIMPLEHTTP_INC ?= $(LIBSIMPLEHTTP)/..
LIBSIMPLEHTTP_LIB ?= $(LIBSIMPLEHTTP)
CFLAGS = -I. -I$(LIBSIMPLEHTTP_INC) -I$(LIBEVENT)/include -O2 -g
-LIBS = -L. -L$(LIBSIMPLEHTTP_LIB) -L$(LIBEVENT)/lib -levent -lsimplehttp -lpcre
+LIBS = -L. -L$(LIBSIMPLEHTTP_LIB) -L$(LIBEVENT)/lib -levent -lsimplehttp -lpcre -lm
pubsub: pubsub.c
$(CC) $(CFLAGS) -o $@ $< $(LIBS)
View
@@ -2,8 +2,8 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
-#include "simplehttp/queue.h"
-#include "simplehttp/simplehttp.h"
+#include <simplehttp/queue.h>
+#include <simplehttp/simplehttp.h>
#include "http-internal.h"
#define BOUNDARY "xXPubSubXx"
View
@@ -5,7 +5,7 @@ LIBSIMPLEHTTP_INC ?= $(LIBSIMPLEHTTP)/..
LIBSIMPLEHTTP_LIB ?= $(LIBSIMPLEHTTP)
CFLAGS = -I. -I$(LIBSIMPLEHTTP_INC) -I$(LIBEVENT)/include -g -O2
-LIBS = -L. -L$(LIBSIMPLEHTTP_LIB) -L$(LIBEVENT)/lib -levent -lsimplehttp -ljson -lpcre
+LIBS = -L. -L$(LIBSIMPLEHTTP_LIB) -L$(LIBEVENT)/lib -levent -lsimplehttp -ljson -lpcre -lm
pubsub_filtered: pubsub_filtered.c md5.c
$(CC) $(CFLAGS) -o $@ md5.c $< $(LIBS)
@@ -3,11 +3,10 @@
#include <string.h>
#include <unistd.h>
#include <time.h>
-#include "simplehttp/queue.h"
-#include "simplehttp/simplehttp.h"
-#include "event.h"
+#include <simplehttp/queue.h>
+#include <simplehttp/simplehttp.h>
+#include <json/json.h>
#include "http-internal.h"
-#include "json/json.h"
#include "md5.h"
#include "pcre.h"
@@ -5,7 +5,7 @@ LIBSIMPLEHTTP_INC ?= $(LIBSIMPLEHTTP)/..
LIBSIMPLEHTTP_LIB ?= $(LIBSIMPLEHTTP)
CFLAGS = -I. -I$(LIBSIMPLEHTTP_INC) -I$(LIBEVENT)/include -g -O2
-LIBS = -L. -L$(LIBSIMPLEHTTP_LIB) -L$(LIBEVENT)/lib -levent -ljson -ldl -lm -lc
+LIBS = -L. -L$(LIBSIMPLEHTTP_LIB) -L$(LIBEVENT)/lib -levent -ljson -ldl -lm -lc -lpubsub_to_pubsub
AR = ar
AR_FLAGS = rc
RANLIB = ranlib
@@ -16,7 +16,7 @@ libpubsub_to_pubsub.a: pubsub_to_pubsub.o
$(RANLIB) $@
ps_to_ps: ps_to_ps.c
- $(CC) $(CFLAGS) -o $@ $< $(LIBS) -lpubsub_to_pubsub
+ $(CC) $(CFLAGS) -o $@ $< $(LIBS)
all: libpubsub_to_pubsub.a ps_to_ps
@@ -3,11 +3,8 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
-
-#include "simplehttp/pubsub_to_pubsub.h"
-#include "event.h"
-#include "evhttp.h"
+#include <simplehttp/pubsub_to_pubsub.h>
+#include <simplehttp/simplehttp.h>
#define DEBUG 0
View
@@ -5,7 +5,7 @@ LIBSIMPLEHTTP_INC ?= $(LIBSIMPLEHTTP)/..
LIBSIMPLEHTTP_LIB ?= $(LIBSIMPLEHTTP)
CFLAGS = -I. -I$(LIBSIMPLEHTTP_INC) -I$(LIBEVENT)/include -g
-LIBS = -L. -L$(LIBSIMPLEHTTP_LIB) -L$(LIBEVENT)/lib -levent -ldl -lm -lc
+LIBS = -L. -L$(LIBSIMPLEHTTP_LIB) -L$(LIBEVENT)/lib -levent -ldl -lm -lc -lsimplehttp -lpubsubclient -lpthread -lcurl
AR = ar
AR_FLAGS = rc
RANLIB = ranlib
@@ -16,7 +16,7 @@ libpubsubclient.a: pubsubclient.o
$(RANLIB) $@
pubsub-reader: pubsub-reader.o
- $(CC) $(CFLAGS) -o $@ $< $(LIBS) -lsimplehttp -lpubsubclient -lpthread -lcurl
+ $(CC) $(CFLAGS) -o $@ $< $(LIBS)
all: libpubsubclient.a pubsub-reader
@@ -1,11 +1,11 @@
-
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "event.h"
-#include "evhttp.h"
+#include <simplehttp/queue.h>
+#include <simplehttp/simplehttp.h>
#include "pubsubclient.h"
+
#define DEBUG 0
#define BOUNDARY_LENGTH 14
// \r\n--xXPubSubXx\r\n
View
@@ -1,11 +1,12 @@
-#include "queue.h"
#include <stdlib.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <simplehttp/queue.h>
+#include <simplehttp/simplehttp.h>
+#include <json/json.h>
#include "png.h"
#include "qrencode.h"
-#include "simplehttp.h"
/*
* libqrencode
@@ -5,11 +5,11 @@ LIBSIMPLEHTTP_INC ?= $(LIBSIMPLEHTTP)/..
LIBSIMPLEHTTP_LIB ?= $(LIBSIMPLEHTTP)
CFLAGS = -I. -I$(LIBSIMPLEHTTP_INC) -I$(LIBEVENT)/include -g
-LIBS = -L. -L$(LIBSIMPLEHTTP_LIB) -L$(LIBEVENT)/lib -L/usr/local/lib -levent -ljson -ltokyotyrant -ltokyocabinet -lz -lbz2 -lresolv -ldl -lpthread -lm -lc
+LIBS = -L. -L$(LIBSIMPLEHTTP_LIB) -L$(LIBEVENT)/lib -L/usr/local/lib -lsimplehttp -levent -ljson -ltokyotyrant -ltokyocabinet -lz -lbz2 -lresolv -ldl -lpthread -lm -lc
simpleattributes: simpleattributes.c
- $(CC) $(CFLAGS) -o $@ $< $(LIBS) -lsimplehttp
+ $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
install:
/usr/bin/install -d $(TARGET)/bin
@@ -1,12 +1,12 @@
#include <tcrdb.h>
-#include "queue.h"
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include "simplehttp.h"
-#include "json/json.h"
+#include <simplehttp/queue.h>
+#include <simplehttp/simplehttp.h>
+#include <json/json.h>
#define RECONNECT 5
#define MAXRES 1000
@@ -37,7 +37,7 @@ void finalize_json(struct evhttp_request *req, struct evbuffer *evb,
char *json, *jsonp;
jsonp = (char *)evhttp_find_header(args, "jsonp");
- json = json_object_to_json_string(jsobj);
+ json = (char *)json_object_to_json_string(jsobj);
if (jsonp) {
evbuffer_add_printf(evb, "%s(%s)\n", jsonp, json);
} else {
@@ -228,8 +228,8 @@ void put_cb(struct evhttp_request *req, struct evbuffer *evb, void *ctx)
for (i=0; i < json_object_array_length(jsonPtr); i++) {
jsonPtr2 = json_object_array_get_idx(jsonPtr, i);
- key = json_object_get_string(json_object_array_get_idx(jsonPtr2, 0));
- value = json_object_get_string(json_object_array_get_idx(jsonPtr2, 1));
+ key = (char *)json_object_get_string(json_object_array_get_idx(jsonPtr2, 0));
+ value = (char *)json_object_get_string(json_object_array_get_idx(jsonPtr2, 1));
tcmapput2(cols, key, value);
}
@@ -280,15 +280,15 @@ void get_cb(struct evhttp_request *req, struct evbuffer *evb, void *ctx)
if (key) {
- value = tcmapget2(cols, key);
+ value = (char *)tcmapget2(cols, key);
if (!value) {
value = "";
}
json_object_object_add(jsobj2, key, json_object_new_string(value));
} else {
- while ((name = tcmapiternext2(cols)) != NULL) {
+ while ((name = (char *)tcmapiternext2(cols)) != NULL) {
json_object_object_add(jsobj2, name, json_object_new_string(tcmapget2(cols, name)));
}
}
View
@@ -5,10 +5,10 @@ LIBSIMPLEHTTP_INC ?= $(LIBSIMPLEHTTP)/..
LIBSIMPLEHTTP_LIB ?= $(LIBSIMPLEHTTP)
CFLAGS = -I. -I$(LIBSIMPLEHTTP_INC) -I$(LIBEVENT)/include -g
-LIBS = -L. -L$(LIBSIMPLEHTTP_INC) -L$(LIBEVENT)/lib -L/usr/local/lib -levent -ljson -ltokyotyrant -ltokyocabinet -lz -lbz2 -lresolv -ldl -lpthread -lm -lc
+LIBS = -L. -L$(LIBSIMPLEHTTP_INC) -L$(LIBEVENT)/lib -L/usr/local/lib -lsimplehttp -levent -ljson -ltokyotyrant -ltokyocabinet -lz -lbz2 -lresolv -ldl -lpthread -lm -lc
simplegeo: simplegeo.c
- $(CC) $(CFLAGS) -o $@ $< $(LIBS) -lsimplehttp
+ $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
install:
/usr/bin/install -d $(TARGET)/bin
View
@@ -1,13 +1,13 @@
#include <tcrdb.h>
-#include "queue.h"
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
-#include "simplehttp.h"
-#include "json/json.h"
+#include <simplehttp/queue.h>
+#include <simplehttp/simplehttp.h>
+#include <json/json.h>
#define RECONNECT 5
#define MAXRES 1000
View
@@ -2,15 +2,15 @@ LIBEVENT ?= /usr/local
TARGET ?= /usr/local
CFLAGS = -I. -I$(LIBEVENT)/include -Wall -g -O2
-LIBS = -L. -L$(LIBEVENT)/lib -levent
+LIBS = -L. -L$(LIBEVENT)/lib -levent -lm
AR = ar
AR_FLAGS = rc
RANLIB = ranlib
-libsimplehttp.a: simplehttp.o
+libsimplehttp.a: simplehttp.o timer.o log.o util.o stat.o
/bin/rm -f $@
- $(AR) $(AR_FLAGS) $@ $<
+ $(AR) $(AR_FLAGS) $@ $^
$(RANLIB) $@
testserver: testserver.c
File renamed without changes.
Oops, something went wrong.

0 comments on commit e91b668

Please sign in to comment.