[Assorted-commits] SF.net SVN: assorted:[1316] ydb/trunk/src
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-03-20 20:40:36
|
Revision: 1316 http://assorted.svn.sourceforge.net/assorted/?rev=1316&view=rev Author: yangzhang Date: 2009-03-20 20:40:27 +0000 (Fri, 20 Mar 2009) Log Message: ----------- - simplified Makefile a bit for aux programs - made ccache, pch usage optional - updated, fixed warnings in aux programs Modified Paths: -------------- ydb/trunk/src/Makefile ydb/trunk/src/main.lzz.clamp ydb/trunk/src/serperf.cc ydb/trunk/src/stxn.lzz.clamp ydb/trunk/src/tpcc/Makefile ydb/trunk/src/tpcc/tpcctables.h ydb/trunk/src/unsetprefs.h ydb/trunk/src/util.lzz ydb/trunk/src/ydb.lzz.clamp Modified: ydb/trunk/src/Makefile =================================================================== --- ydb/trunk/src/Makefile 2009-03-20 20:20:25 UTC (rev 1315) +++ ydb/trunk/src/Makefile 2009-03-20 20:40:27 UTC (rev 1316) @@ -1,5 +1,6 @@ TARGET := ydb WTF := wtf +CCACHE := ccache CLAMPS := $(wildcard *.lzz.clamp) PURELZZS := $(foreach lzz,$(wildcard *.lzz),$(if $(wildcard $(lzz).clamp),,$(lzz))) @@ -39,7 +40,7 @@ OPT := -g3 endif # CXX := $(WTF) ag++ -k --Xcompiler # $(CXX) -CXX := $(WTF) ccache $(CXX) -pipe +CXX := $(WTF) $(CCACHE) $(CXX) -pipe CC := $(CXX) # for linking LDFLAGS := -pthread $(GPROF) LDLIBS := -lstx -lst -lresolv -lprotobuf -lgtest \ @@ -79,7 +80,6 @@ -std=gnu++0x \ -march=native \ $(CXXFLAGS) -CXXFLAGS := $(CXXFLAGS0) -include pch.h # \ -Wmissing-noreturn \ @@ -93,6 +93,13 @@ -Wstrict-overflow \ -Winline \ +ifeq ($(NPCH),) + CXXFLAGS := $(CXXFLAGS0) -include pch.h +%.o: pch.h.gch +else + CXXFLAGS := $(CXXFLAGS0) +endif + PBCXXFLAGS := $(OPT) -Wall -Werror $(GPROF) all: $(TARGET) @@ -100,13 +107,12 @@ %.pb.o: %.pb.cc %.pb.h $(CXX) -c $(PBCXXFLAGS) $(OUTPUT_OPTION) $< -%.o: pch.h.gch stxn.o: main.hh $(PBHDRS) main.o: util.hh msg.h $(PBHDRS) util.o: msg.h $(PBHDRS) ydb.o: main.hh stxn.hh tpcc.hh util.hh $(PBHDRS) tpcc.o: main.hh util.hh $(PBHDRS) -ydb: ydb.o tpcc.o main.o util.o stxn.o ydb.pb.o $(TPCC_OBJS) # $(OBJS) +ydb: $(OBJS) tpcc/%.o: tpcc/%.cc make -C tpcc/ @@ -135,7 +141,7 @@ pch.h: svn ls -rHEAD -R | \ - grep -v '/$$' | \ + egrep -v '/$$|Makefile' | \ xargs sed 's/.*\binclude\b *<\(.*\)>.*/\#include <\1>/; t succ; d; :succ /commons/ d' | \ sort -u > $@ @@ -157,17 +163,10 @@ .PHONY: clean -.SECONDARY: $(SRCS) $(HDRS) $(OBJS) main.lzz +.SECONDARY: $(SRCS) $(HDRS) $(OBJS) main.lzz pch.h.gch ### -serperf: serperf.o ydb.pb.o - $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION) - -# serperf.cc ydb.pb.h - -p2: p2.cc - $(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION) - -ser: ser.cc msg.h ydb.pb.o - $(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION) +serperf: ydb.pb.o +ser: ydb.pb.o +ser.o: msg.h Modified: ydb/trunk/src/main.lzz.clamp =================================================================== --- ydb/trunk/src/main.lzz.clamp 2009-03-20 20:20:25 UTC (rev 1315) +++ ydb/trunk/src/main.lzz.clamp 2009-03-20 20:40:27 UTC (rev 1316) @@ -2,17 +2,9 @@ #include "unsetprefs.h" #include <boost/archive/binary_iarchive.hpp> #include <boost/archive/binary_oarchive.hpp> -#include <boost/bind.hpp> -#include <boost/foreach.hpp> -//#include <boost/range/iterator_range.hpp> -//#include <boost/shared_ptr.hpp> #include <boost/tuple/tuple.hpp> -#include <commons/assert.h> -#include <commons/nullptr.h> #include <commons/st/st.h> -#include <commons/time.h> #include <fstream> // ofstream -#include <iostream> #include <vector> #include "msg.h" #include "util.hh" @@ -27,7 +19,14 @@ #end #src +#include "unsetprefs.h" +#include <boost/foreach.hpp> +#include <commons/assert.h> +#include <commons/nullptr.h> +#include <commons/time.h> +#include <iostream> #include <unistd.h> // pipe, write, sync +#include "setprefs.h" #end typedef tuple<sized_array<char>, char*, char*> chunk; Modified: ydb/trunk/src/serperf.cc =================================================================== --- ydb/trunk/src/serperf.cc 2009-03-20 20:20:25 UTC (rev 1315) +++ ydb/trunk/src/serperf.cc 2009-03-20 20:40:27 UTC (rev 1316) @@ -1,16 +1,18 @@ #include <iostream> #include <sstream> #include <commons/time.h> +#include <commons/utility.h> #include "ydb.pb.h" #include <boost/archive/binary_oarchive.hpp> using namespace boost::archive; using namespace std; using namespace commons; +using namespace ydb::pb; -int main(int argc, char **argv) { +int main(UNUSED int argc, char **argv) { const int count = atoi(argv[1]), batchsize = atoi(argv[2]); - + TxnBatch batch; for (int i = 0; i < batchsize; ++i) { Txn &txn = *batch.add_txn(); @@ -30,7 +32,7 @@ batch.SerializeToOstream(&ss); } long long time = current_time_millis() - start; - double tps = 1000 * static_cast<double>(count * batchsize) / time; + double tps = 1000 * count * batchsize / double(time); cout << "protobuf: " << time << " ms, " << tps << " tps" << endl; } @@ -51,7 +53,7 @@ } } long long time = current_time_millis() - start; - double tps = 1000 * static_cast<double>(count * batchsize) / time; + double tps = 1000 * count * batchsize / double(time); cout << "boost: " << time << " ms, " << tps << " tps" << endl; } @@ -61,7 +63,7 @@ stringbuf sb; for (int j = 0; j < batchsize; ++j) { const Txn &txn = batch.txn(j); -#define write(x) { typeof(x) __x = x; sb.sputn((char*)(&__x), sizeof __x); } +#define write(x) { typeof(x) __x = x; sb.sputn(reinterpret_cast<char*>(&__x), sizeof __x); } write(txn.seqno()); for (int k = 0; k < 5; ++k) { const Op &op = txn.op(k); @@ -72,7 +74,7 @@ } } long long time = current_time_millis() - start; - double tps = 1000 * static_cast<double>(count * batchsize) / time; + double tps = 1000 * count * batchsize / double(time); cout << "streambuf.sputn: " << time << " ms, " << tps << " tps" << endl; } Modified: ydb/trunk/src/stxn.lzz.clamp =================================================================== --- ydb/trunk/src/stxn.lzz.clamp 2009-03-20 20:20:25 UTC (rev 1315) +++ ydb/trunk/src/stxn.lzz.clamp 2009-03-20 20:40:27 UTC (rev 1316) @@ -1,5 +1,6 @@ #hdr #include "unsetprefs.h" +#include <boost/bind.hpp> #include <commons/memory.h> #include <boost/foreach.hpp> #include <commons/snap_map.h> Modified: ydb/trunk/src/tpcc/Makefile =================================================================== --- ydb/trunk/src/tpcc/Makefile 2009-03-20 20:20:25 UTC (rev 1315) +++ ydb/trunk/src/tpcc/Makefile 2009-03-20 20:40:27 UTC (rev 1316) @@ -1,6 +1,7 @@ WARNINGS = -Werror -Wall -Wextra -Wconversion -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Wno-unused-parameter -CXX := ccache $(CXX) +CCACHE := ccache +CXX := $(CCACHE) $(CXX) # Debug flags ifeq ($(OPT),) Modified: ydb/trunk/src/tpcc/tpcctables.h =================================================================== --- ydb/trunk/src/tpcc/tpcctables.h 2009-03-20 20:20:25 UTC (rev 1315) +++ ydb/trunk/src/tpcc/tpcctables.h 2009-03-20 20:40:27 UTC (rev 1316) @@ -1,6 +1,7 @@ #ifndef TPCCTABLES_H__ #define TPCCTABLES_H__ +#include <limits> #include <map> #include <set> #include <vector> Modified: ydb/trunk/src/unsetprefs.h =================================================================== --- ydb/trunk/src/unsetprefs.h 2009-03-20 20:20:25 UTC (rev 1315) +++ ydb/trunk/src/unsetprefs.h 2009-03-20 20:40:27 UTC (rev 1316) @@ -1,5 +0,0 @@ -#undef function -#undef shared_ptr -#undef ref -#undef tuple -#undef make_tuple Modified: ydb/trunk/src/util.lzz =================================================================== --- ydb/trunk/src/util.lzz 2009-03-20 20:20:25 UTC (rev 1315) +++ ydb/trunk/src/util.lzz 2009-03-20 20:40:27 UTC (rev 1316) @@ -7,12 +7,10 @@ #include <map> #include <set> #include <utility> -#include <boost/function.hpp> #include <boost/scoped_array.hpp> #include <commons/array.h> #include <commons/nullptr.h> #include <commons/time.h> -#include <sys/socket.h> // getpeername #include <google/protobuf/io/zero_copy_stream_impl.h> #include "msg.h" using namespace std; @@ -21,6 +19,7 @@ using namespace google::protobuf::io; #end #src +#include <sys/socket.h> // getpeername #include <gtest/gtest.h> #include <netinet/in.h> // in_addr etc. #end Modified: ydb/trunk/src/ydb.lzz.clamp =================================================================== --- ydb/trunk/src/ydb.lzz.clamp 2009-03-20 20:20:25 UTC (rev 1315) +++ ydb/trunk/src/ydb.lzz.clamp 2009-03-20 20:40:27 UTC (rev 1316) @@ -1,5 +1,6 @@ #hdr #include "unsetprefs.h" +#include <boost/bind.hpp> #include <boost/function.hpp> #include <boost/scoped_ptr.hpp> #include <string> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |