aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--benchmarks/benchmark_messages_proto2.proto2
-rw-r--r--benchmarks/benchmark_messages_proto3.proto2
-rw-r--r--benchmarks/benchmarks.proto41
-rw-r--r--benchmarks/generate_datasets.cc19
4 files changed, 9 insertions, 55 deletions
diff --git a/benchmarks/benchmark_messages_proto2.proto b/benchmarks/benchmark_messages_proto2.proto
index c7103be5..01f67a1a 100644
--- a/benchmarks/benchmark_messages_proto2.proto
+++ b/benchmarks/benchmark_messages_proto2.proto
@@ -2,7 +2,7 @@
syntax = "proto2";
-package benchmarks.p2;
+package benchmarks.proto2;
option java_package = "com.google.protobuf.benchmarks";
// This is the default, but we specify it here explicitly.
diff --git a/benchmarks/benchmark_messages_proto3.proto b/benchmarks/benchmark_messages_proto3.proto
index 4ea39c22..32f58698 100644
--- a/benchmarks/benchmark_messages_proto3.proto
+++ b/benchmarks/benchmark_messages_proto3.proto
@@ -2,7 +2,7 @@
syntax = "proto3";
-package benchmarks.p3;
+package benchmarks.proto3;
option java_package = "com.google.protobuf.benchmarks";
// This is the default, but we specify it here explicitly.
diff --git a/benchmarks/benchmarks.proto b/benchmarks/benchmarks.proto
index 0ac3bf33..51c0b548 100644
--- a/benchmarks/benchmarks.proto
+++ b/benchmarks/benchmarks.proto
@@ -61,44 +61,3 @@ message BenchmarkDataset {
// good branch prediction performance.
repeated bytes payload = 3;
}
-
-// A benchmark can write out metrics that we will then upload to our metrics
-// database for tracking over time.
-message Metric {
- // A unique ID for these results. Used for de-duping.
- string guid = 1;
-
- // The labels specify exactly what benchmark was run against the dataset.
- // The specific benchmark suite can decide what these mean, but here are
- // some common labels that have a predefined meaning:
- //
- // - "dataset": for tests that pertain to a specific dataset.
- //
- // For example:
- //
- // # Tests parsing from binary proto string using arenas.
- // labels={
- // dataset: "testalltypes",
- // op: "parse",
- // format: "binaryproto",
- // input: "string"
- // arena: "true"
- // }
- //
- // # Tests serializing to JSON string.
- // labels={
- // dataset: "testalltypes",
- // op: "serialize",
- // format: "json",
- // input: "string"
- // }
- map<string, string> labels = 2;
-
- // Unit of measurement for the metric:
- // - a speed test might be "mb_per_second" or "ops_per_second"
- // - a size test might be "kb".
- string unit = 3;
-
- // Metric value.
- double value = 4;
-}
diff --git a/benchmarks/generate_datasets.cc b/benchmarks/generate_datasets.cc
index dab635e7..61e7adf1 100644
--- a/benchmarks/generate_datasets.cc
+++ b/benchmarks/generate_datasets.cc
@@ -28,9 +28,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-const char *file_prefix = "dataset.";
-const char *file_suffix = ".pb";
-
#include <fstream>
#include <iostream>
#include "benchmarks.pb.h"
@@ -41,10 +38,11 @@ using google::protobuf::DescriptorPool;
using google::protobuf::Message;
using google::protobuf::MessageFactory;
-#define ARRAY_TO_STRING(arr) std::string(arr, arr + sizeof(arr))
-
std::set<std::string> names;
+const char *file_prefix = "dataset.";
+const char *file_suffix = ".pb";
+
void WriteFileWithPayloads(const std::string& name,
const std::string& message_name,
const std::vector<std::string>& payload) {
@@ -81,13 +79,10 @@ void WriteFileWithPayloads(const std::string& name,
dataset.add_payload()->assign(payload[i]);
}
- std::string serialized;
- dataset.SerializeToString(&serialized);
-
std::ofstream writer;
std::string fname = file_prefix + name + file_suffix;
writer.open(fname.c_str());
- writer << serialized;
+ dataset.SerializeToOstream(&writer);
writer.close();
std::cerr << "Wrote dataset: " << fname << "\n";
@@ -111,12 +106,12 @@ std::string ReadFile(const std::string& name) {
}
int main() {
- WriteFile("google_message1_proto3", "benchmarks.p3.GoogleMessage1",
+ WriteFile("google_message1_proto3", "benchmarks.proto3.GoogleMessage1",
ReadFile("google_message1.dat"));
- WriteFile("google_message1_proto2", "benchmarks.p2.GoogleMessage1",
+ WriteFile("google_message1_proto2", "benchmarks.proto2.GoogleMessage1",
ReadFile("google_message1.dat"));
// Not in proto3 because it has a group, which is not supported.
- WriteFile("google_message2", "benchmarks.p2.GoogleMessage2",
+ WriteFile("google_message2", "benchmarks.proto2.GoogleMessage2",
ReadFile("google_message2.dat"));
}