Permalink
Browse files

Down-integrate from google3.

  • Loading branch information...
haberman committed Sep 4, 2018
1 parent 45d03a9 commit d61aede89cf188367766b971f59cf57d7835d8e8
Showing 363 changed files with 15,847 additions and 15,969 deletions.
@@ -45,9 +45,10 @@ def __extract_file_name(file_name):
# "benchmarks": [
# {
# "bytes_per_second": int,
# "cpu_time": int,
# "cpu_time_ns": double,
# "iterations": int,
# "name: string,
# "time_unit: string,
# "real_time_ns: double,
# ...
# },
# ...
@@ -75,6 +76,36 @@ def __parse_cpp_result(filename):
})
# Synthetic benchmark results example:
# [
# "benchmarks": [
# {
# "cpu_time_ns": double,
# "iterations": int,
# "name: string,
# "real_time_ns: double,
# ...
# },
# ...
# ],
# ...
# ]
def __parse_synthetic_result(filename):
if filename == "":
return
if filename[0] != "/":
filename = os.path.dirname(os.path.abspath(__file__)) + "/" + filename
with open(filename) as f:
results = json.loads(f.read())
for benchmark in results["benchmarks"]:
__results.append({
"language": "cpp",
"dataFilename": "",
"behavior": "synthetic",
"throughput": 10.0**9 / benchmark["cpu_time_ns"]
})
# Python results example:
# [
# [
@@ -204,7 +235,12 @@ def __parse_go_result(filename):
"language": "go"
})
def get_result_from_file(cpp_file="", java_file="", python_file="", go_file=""):
def get_result_from_file(cpp_file="",
java_file="",
python_file="",
go_file="",
synthetic_file=""):
results = {}
if cpp_file != "":
__parse_cpp_result(cpp_file)
@@ -214,5 +250,7 @@ def get_result_from_file(cpp_file="", java_file="", python_file="", go_file=""):
__parse_python_result(python_file)
if go_file != "":
__parse_go_result(go_file)
if synthetic_file != "":
__parse_synthetic_result(synthetic_file)
return __results
return __results
@@ -18,14 +18,6 @@ __EOF__
exit 1
fi
if test ! -e src/Makefile; then
cat >&2 << __EOF__
Could not find src/Makefile. You must run ./configure (and perhaps
./autogen.sh) first.
__EOF__
exit 1
fi
cd src
declare -a RUNTIME_PROTO_FILES=(\
@@ -51,7 +43,7 @@ while [ $# -gt 0 ]; do
case $1 in
--bootstrap_protoc)
BOOTSTRAP_PROTOC=$2
shift
shift 2
;;
*)
break
@@ -78,8 +70,8 @@ do
PROTOC="./protoc"
fi
$PROTOC --cpp_out=dllexport_decl=LIBPROTOBUF_EXPORT:$TMP ${RUNTIME_PROTO_FILES[@]} && \
$PROTOC --cpp_out=dllexport_decl=LIBPROTOC_EXPORT:$TMP ${COMPILER_PROTO_FILES[@]}
$PROTOC --cpp_out=dllexport_decl=PROTOBUF_EXPORT:$TMP ${RUNTIME_PROTO_FILES[@]} && \
$PROTOC --cpp_out=dllexport_decl=PROTOC_EXPORT:$TMP ${COMPILER_PROTO_FILES[@]}
for PROTO_FILE in ${RUNTIME_PROTO_FILES[@]} ${COMPILER_PROTO_FILES[@]}; do
BASE_NAME=${PROTO_FILE%.*}
Oops, something went wrong.

0 comments on commit d61aede

Please sign in to comment.