Merge changes from topic "revert-protobuf3.5.2"

* changes:
  Revert "Adapt to google::protobuf::uint64 type change"
  Revert "Convert statsd_test and statsd_benchmark to proto lite"
This commit is contained in:
Colin Cross
2018-11-06 18:42:03 +00:00
committed by Gerrit Code Review
6 changed files with 9 additions and 49 deletions

View File

@@ -196,10 +196,6 @@ cc_test {
], ],
srcs: [ srcs: [
// atom_field_options.proto needs field_options.proto, but that is
// not included in libprotobuf-cpp-lite, so compile it here.
":libprotobuf-internal-protos",
"src/atom_field_options.proto", "src/atom_field_options.proto",
"src/atoms.proto", "src/atoms.proto",
"src/stats_log.proto", "src/stats_log.proto",
@@ -249,11 +245,11 @@ cc_test {
static_libs: ["libgmock"], static_libs: ["libgmock"],
proto: { proto: {
type: "lite", type: "full",
include_dirs: ["external/protobuf/src"], include_dirs: ["external/protobuf/src"],
}, },
shared_libs: ["libprotobuf-cpp-lite"], shared_libs: ["libprotobuf-cpp-full"],
} }
@@ -266,10 +262,6 @@ cc_benchmark {
defaults: ["statsd_defaults"], defaults: ["statsd_defaults"],
srcs: [ srcs: [
// atom_field_options.proto needs field_options.proto, but that is
// not included in libprotobuf-cpp-lite, so compile it here.
":libprotobuf-internal-protos",
"src/atom_field_options.proto", "src/atom_field_options.proto",
"src/atoms.proto", "src/atoms.proto",
"src/stats_log.proto", "src/stats_log.proto",
@@ -284,7 +276,7 @@ cc_benchmark {
], ],
proto: { proto: {
type: "lite", type: "full",
include_dirs: ["external/protobuf/src"], include_dirs: ["external/protobuf/src"],
}, },
@@ -302,7 +294,7 @@ cc_benchmark {
shared_libs: [ shared_libs: [
"libgtest_prod", "libgtest_prod",
"libstatslog", "libstatslog",
"libprotobuf-cpp-lite", "libprotobuf-cpp-full",
], ],
} }

View File

@@ -24,7 +24,6 @@
#include "subscriber/IncidentdReporter.h" #include "subscriber/IncidentdReporter.h"
#include "subscriber/SubscriberReporter.h" #include "subscriber/SubscriberReporter.h"
#include <inttypes.h>
#include <statslog.h> #include <statslog.h>
#include <time.h> #include <time.h>
@@ -222,7 +221,7 @@ void AnomalyTracker::declareAnomaly(const int64_t& timestampNs, const MetricDime
} }
if (!mSubscriptions.empty()) { if (!mSubscriptions.empty()) {
ALOGI("An anomaly (%" PRId64 ") %s has occurred! Informing subscribers.", ALOGI("An anomaly (%lld) %s has occurred! Informing subscribers.",
mAlert.id(), key.toString().c_str()); mAlert.id(), key.toString().c_str());
informSubscribers(key); informSubscribers(key);
} else { } else {

View File

@@ -34,8 +34,6 @@
#include "stats_util.h" #include "stats_util.h"
#include "statslog.h" #include "statslog.h"
#include <inttypes.h>
using std::set; using std::set;
using std::string; using std::string;
using std::unordered_map; using std::unordered_map;
@@ -534,7 +532,7 @@ bool initMetrics(const ConfigKey& key, const StatsdConfig& config,
for (int i = 0; i < config.no_report_metric_size(); ++i) { for (int i = 0; i < config.no_report_metric_size(); ++i) {
const auto no_report_metric = config.no_report_metric(i); const auto no_report_metric = config.no_report_metric(i);
if (metricMap.find(no_report_metric) == metricMap.end()) { if (metricMap.find(no_report_metric) == metricMap.end()) {
ALOGW("no_report_metric %" PRId64 " not exist", no_report_metric); ALOGW("no_report_metric %lld not exist", no_report_metric);
return false; return false;
} }
noReportMetricIds.insert(no_report_metric); noReportMetricIds.insert(no_report_metric);

View File

@@ -232,9 +232,9 @@ void dumpAsTextToFd(protos::GraphicsStatsProto* proto, int fd) {
return; return;
} }
dprintf(fd, "\nPackage: %s", proto->package_name().c_str()); dprintf(fd, "\nPackage: %s", proto->package_name().c_str());
dprintf(fd, "\nVersion: %" PRId64, proto->version_code()); dprintf(fd, "\nVersion: %lld", proto->version_code());
dprintf(fd, "\nStats since: %" PRId64 "ns", proto->stats_start()); dprintf(fd, "\nStats since: %lldns", proto->stats_start());
dprintf(fd, "\nStats end: %" PRId64 "ns", proto->stats_end()); dprintf(fd, "\nStats end: %lldns", proto->stats_end());
auto summary = proto->summary(); auto summary = proto->summary();
dprintf(fd, "\nTotal frames rendered: %d", summary.total_frames()); dprintf(fd, "\nTotal frames rendered: %d", summary.total_frames());
dprintf(fd, "\nJanky frames: %d (%.2f%%)", summary.janky_frames(), dprintf(fd, "\nJanky frames: %d (%.2f%%)", summary.janky_frames(),

View File

@@ -96,7 +96,6 @@ public:
bool write(uint64_t fieldId, double val); bool write(uint64_t fieldId, double val);
bool write(uint64_t fieldId, float val); bool write(uint64_t fieldId, float val);
bool write(uint64_t fieldId, int val); bool write(uint64_t fieldId, int val);
bool write(uint64_t fieldId, long val);
bool write(uint64_t fieldId, long long val); bool write(uint64_t fieldId, long long val);
bool write(uint64_t fieldId, bool val); bool write(uint64_t fieldId, bool val);
bool write(uint64_t fieldId, std::string val); bool write(uint64_t fieldId, std::string val);

View File

@@ -130,34 +130,6 @@ ProtoOutputStream::write(uint64_t fieldId, int val)
return true; return true;
} }
bool
ProtoOutputStream::write(uint64_t fieldId, long val)
{
if (mCompact) return false;
const uint32_t id = (uint32_t)fieldId;
switch (fieldId & FIELD_TYPE_MASK) {
case FIELD_TYPE_DOUBLE: writeDoubleImpl(id, (double)val); break;
case FIELD_TYPE_FLOAT: writeFloatImpl(id, (float)val); break;
case FIELD_TYPE_INT64: writeInt64Impl(id, (long long)val); break;
case FIELD_TYPE_UINT64: writeUint64Impl(id, (uint64_t)val); break;
case FIELD_TYPE_INT32: writeInt32Impl(id, (int)val); break;
case FIELD_TYPE_FIXED64: writeFixed64Impl(id, (uint64_t)val); break;
case FIELD_TYPE_FIXED32: writeFixed32Impl(id, (uint32_t)val); break;
case FIELD_TYPE_UINT32: writeUint32Impl(id, (uint32_t)val); break;
case FIELD_TYPE_SFIXED32: writeSFixed32Impl(id, (int)val); break;
case FIELD_TYPE_SFIXED64: writeSFixed64Impl(id, (long long)val); break;
case FIELD_TYPE_SINT32: writeZigzagInt32Impl(id, (int)val); break;
case FIELD_TYPE_SINT64: writeZigzagInt64Impl(id, (long long)val); break;
case FIELD_TYPE_ENUM: writeEnumImpl(id, (int)val); break;
case FIELD_TYPE_BOOL: writeBoolImpl(id, val != 0); break;
default:
ALOGW("Field type %d is not supported when writing long val.",
(int)((fieldId & FIELD_TYPE_MASK) >> FIELD_TYPE_SHIFT));
return false;
}
return true;
}
bool bool
ProtoOutputStream::write(uint64_t fieldId, long long val) ProtoOutputStream::write(uint64_t fieldId, long long val)
{ {