Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
49a8918e
Commit
49a8918e
authored
Apr 29, 2016
by
Josh Haberman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Read files directly from filesystem since xxd isn't always available.
parent
cb36bde0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
17 deletions
+15
-17
Makefile.am
benchmarks/Makefile.am
+1
-11
generate_datasets.cc
benchmarks/generate_datasets.cc
+13
-5
tests.sh
tests.sh
+1
-1
No files found.
benchmarks/Makefile.am
View file @
49a8918e
...
...
@@ -22,30 +22,20 @@ generate_datasets_LDADD = $(top_srcdir)/src/libprotobuf.la
generate_datasets_SOURCES
=
generate_datasets.cc
generate_datasets_CPPFLAGS
=
-I
$(top_srcdir)
/src
-I
$(srcdir)
nodist_generate_datasets_SOURCES
=
\
google_message1.h
\
google_message2.h
\
$(benchmarks_protoc_outputs)
\
$(benchmarks_protoc_outputs_proto2)
# Explicit deps because BUILT_SOURCES are only done before a "make all/check"
# 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
generate_datasets-generate_datasets.$(OBJEXT)
:
benchmarks.pb.h
google_message1.h google_message2.h
generate_datasets-generate_datasets.$(OBJEXT)
:
benchmarks.pb.h
$(benchmarks_protoc_outputs)
:
protoc_middleman
$(benchmarks_protoc_outputs_proto2)
:
protoc_middleman2
google_message1.h
:
google_message1.dat
xxd
-i
$<
$@
google_message2.h
:
google_message2.dat
xxd
-i
$<
$@
CLEANFILES
=
\
$(benchmarks_protoc_outputs)
\
$(benchmarks_protoc_outputs_proto2)
\
google_message1.h
\
google_message2.h
\
protoc_middleman
\
protoc_middleman2
\
dataset.
*
...
...
benchmarks/generate_datasets.cc
View file @
49a8918e
...
...
@@ -34,8 +34,6 @@ const char *file_suffix = ".pb";
#include <fstream>
#include <iostream>
#include "benchmarks.pb.h"
#include "google_message1.h"
#include "google_message2.h"
using
benchmarks
::
BenchmarkDataset
;
using
google
::
protobuf
::
Descriptor
;
...
...
@@ -102,13 +100,23 @@ void WriteFile(const std::string& name, const std::string& message_name,
WriteFileWithPayloads
(
name
,
message_name
,
payloads
);
}
std
::
string
ReadFile
(
const
std
::
string
&
name
)
{
std
::
ifstream
file
(
name
);
GOOGLE_CHECK
(
file
.
is_open
())
<<
"Couldn't find file '"
<<
name
<<
"', please make sure you are running "
"this command from the benchmarks/ "
"directory.
\n
"
;
return
std
::
string
((
std
::
istreambuf_iterator
<
char
>
(
file
)),
std
::
istreambuf_iterator
<
char
>
());
}
int
main
()
{
WriteFile
(
"google_message1_proto3"
,
"benchmarks.p3.GoogleMessage1"
,
ARRAY_TO_STRING
(
google_message1_dat
));
ReadFile
(
"google_message1.dat"
));
WriteFile
(
"google_message1_proto2"
,
"benchmarks.p2.GoogleMessage1"
,
ARRAY_TO_STRING
(
google_message1_dat
));
ReadFile
(
"google_message1.dat"
));
// Not in proto3 because it has a group, which is not supported.
WriteFile
(
"google_message2"
,
"benchmarks.p2.GoogleMessage2"
,
ARRAY_TO_STRING
(
google_message2_dat
));
ReadFile
(
"google_message2.dat"
));
}
tests.sh
View file @
49a8918e
...
...
@@ -38,7 +38,7 @@ build_cpp() {
cd
conformance
&&
make test_cpp
&&
cd
..
# Verify benchmarking code can build successfully.
cd
benchmarks
&&
make
&&
cd
..
cd
benchmarks
&&
make
&&
./generate-datasets
&&
cd
..
}
build_cpp_distcheck
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment