Commit 4b020914 authored by Yilun Chong's avatar Yilun Chong

add cpp

parent cd32aae3
...@@ -100,6 +100,17 @@ $(benchmarks_protoc_outputs_header): protoc_middleman ...@@ -100,6 +100,17 @@ $(benchmarks_protoc_outputs_header): protoc_middleman
$(benchmarks_protoc_outputs_proto2): protoc_middleman2 $(benchmarks_protoc_outputs_proto2): protoc_middleman2
$(benchmarks_protoc_outputs_proto2_header): protoc_middleman2 $(benchmarks_protoc_outputs_proto2_header): protoc_middleman2
initialize_submodule:
oldpwd=`pwd`
cd $(top_srcdir)/third_party
git submodule update --init -r
cd $(top_srcdir)/third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make
cd $$oldpwd
touch initialize_submodule
$(top_srcdir)/src/libprotobuf.la: initialize_submodule
$(top_srcdir)/third_party/benchmark/src/libbenchmark.a: initialize_submodule
AM_CXXFLAGS = $(NO_OPT_CXXFLAGS) $(PROTOBUF_OPT_FLAG) -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare AM_CXXFLAGS = $(NO_OPT_CXXFLAGS) $(PROTOBUF_OPT_FLAG) -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
bin_PROGRAMS = cpp-benchmark bin_PROGRAMS = cpp-benchmark
...@@ -110,21 +121,21 @@ cpp_benchmark_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir) -I$(top_srcdir)/third_p ...@@ -110,21 +121,21 @@ cpp_benchmark_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir) -I$(top_srcdir)/third_p
# Explicit deps because BUILT_SOURCES are only done before a "make all/check" # Explicit deps because BUILT_SOURCES are only done before a "make all/check"
# so a direct "make test_cpp" could fail if parallel enough. # so a direct "make test_cpp" could fail if parallel enough.
# See: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually # See: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually
cpp_benchmark-cpp_benchmark.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) cpp_benchmark-cpp_benchmark.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a
nodist_cpp_benchmark_SOURCES = \ nodist_cpp_benchmark_SOURCES = \
$(benchmarks_protoc_outputs) \ $(benchmarks_protoc_outputs) \
$(benchmarks_protoc_outputs_proto2) \ $(benchmarks_protoc_outputs_proto2) \
$(benchmarks_protoc_outputs_proto2_header) \ $(benchmarks_protoc_outputs_proto2_header) \
$(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_header)
cpp: protoc_middleman protoc_middleman2 cpp-benchmark cpp: protoc_middleman protoc_middleman2 cpp-benchmark initialize_submodule
./cpp-benchmark $(all_data) ./cpp-benchmark $(all_data)
############ CPP RULES END ############ ############ CPP RULES END ############
############# JAVA RULES ############## ############# JAVA RULES ##############
java_benchmark_testing_files = java_benchmark_testing_files = \
java/src/main/java/com/google/protobuf/ProtoBench.java \ java/src/main/java/com/google/protobuf/ProtoBench.java \
java/src/main/java/com/google/protobuf/ProtoBenchCaliper.java java/src/main/java/com/google/protobuf/ProtoBenchCaliper.java
...@@ -152,6 +163,7 @@ CLEANFILES = \ ...@@ -152,6 +163,7 @@ CLEANFILES = \
$(benchmarks_protoc_outputs_header) \ $(benchmarks_protoc_outputs_header) \
$(benchmarks_protoc_outputs_proto2) \ $(benchmarks_protoc_outputs_proto2) \
$(benchmarks_protoc_outputs_proto2_header) \ $(benchmarks_protoc_outputs_proto2_header) \
initialize_submodule \
make_tmp_dir \ make_tmp_dir \
protoc_middleman \ protoc_middleman \
protoc_middleman2 \ protoc_middleman2 \
......
...@@ -5,21 +5,17 @@ This directory contains benchmarking schemas and data sets that you ...@@ -5,21 +5,17 @@ This directory contains benchmarking schemas and data sets that you
can use to test a variety of performance scenarios against your can use to test a variety of performance scenarios against your
protobuf language runtime. protobuf language runtime.
## Benchmark tools and build instructions ## Prerequisite
First, you need to follow the instruction in the root directory's README to First, you need to follow the instruction in the root directory's README to
build your language's protobuf, then: build your language's protobuf, then:
### CPP ### CPP
We are using [google/benchmark](https://github.com/google/benchmark) as the You need to install [cmake](https://cmake.org/) before building the benchmark.
benchmark tool for testing cpp. This is included as submodule under third_party
directory. To init and build this tools, you need to do this under root dirctory:
``` We are using [google/benchmark](https://github.com/google/benchmark) as the
$ cd third_party benchmark tool for testing cpp. This will be automaticly made during build the
$ git submodule update --init -r cpp benchmark.
$ cd benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make && cd ../..
```
### JAVA ### JAVA
We're using maven to build the java benchmarks, which is the same as to build We're using maven to build the java benchmarks, which is the same as to build
...@@ -62,13 +58,15 @@ $ ./cpp-benchmark $(specific generated dataset file name) ...@@ -62,13 +58,15 @@ $ ./cpp-benchmark $(specific generated dataset file name)
## Benchmark datasets ## Benchmark datasets
There's some big testing data not included in the directory initially, you need to There's some optional big testing data which is not included in the directory initially, you need to
run the following command to download the testing data: run the following command to download the testing data:
``` ```
$ ./download_data.sh $ ./download_data.sh
``` ```
After doing this the big data file will automaticly generated in the benchmark directory.
Each data set is in the format of benchmarks.proto: Each data set is in the format of benchmarks.proto:
1. name is the benchmark dataset's name. 1. name is the benchmark dataset's name.
......
...@@ -44,9 +44,6 @@ build_cpp() { ...@@ -44,9 +44,6 @@ build_cpp() {
# appears to be missing it: https://github.com/travis-ci/travis-ci/issues/6996 # appears to be missing it: https://github.com/travis-ci/travis-ci/issues/6996
if [[ $(type cmake 2>/dev/null) ]]; then if [[ $(type cmake 2>/dev/null) ]]; then
# Verify benchmarking code can build successfully. # Verify benchmarking code can build successfully.
git submodule init
git submodule update
cd third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make && cd ../..
cd benchmarks && make cpp-benchmark && cd .. cd benchmarks && make cpp-benchmark && cd ..
else else
echo "" echo ""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment