Commit cbd95975 authored by Felipe Salazar's avatar Felipe Salazar Committed by Commit Bot

Bring metrics protos in sync with google3

Bug: 851163
Change-Id: I6a6aa135f9e1cab496ad6b7fe007bdc8e1ac94f0
Reviewed-on: https://chromium-review.googlesource.com/1178632Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarMike Wittman <wittman@chromium.org>
Commit-Queue: Felipe Salazar <felipesalazar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583876}
parent 59c3fa3e
...@@ -79,7 +79,7 @@ void CopySampleToProto(const CallStackProfileBuilder::Sample& sample, ...@@ -79,7 +79,7 @@ void CopySampleToProto(const CallStackProfileBuilder::Sample& sample,
const std::vector<base::ModuleCache::Module>& modules, const std::vector<base::ModuleCache::Module>& modules,
CallStackProfile::Sample* proto_sample) { CallStackProfile::Sample* proto_sample) {
for (const auto& frame : sample.frames) { for (const auto& frame : sample.frames) {
CallStackProfile::Entry* entry = proto_sample->add_entry(); CallStackProfile::Location* location = proto_sample->add_frame();
// A frame may not have a valid module. If so, we can't compute the // A frame may not have a valid module. If so, we can't compute the
// instruction pointer offset, and we don't want to send bare pointers, // instruction pointer offset, and we don't want to send bare pointers,
// so leave call_stack_entry empty. // so leave call_stack_entry empty.
...@@ -89,8 +89,8 @@ void CopySampleToProto(const CallStackProfileBuilder::Sample& sample, ...@@ -89,8 +89,8 @@ void CopySampleToProto(const CallStackProfileBuilder::Sample& sample,
reinterpret_cast<const char*>(frame.instruction_pointer) - reinterpret_cast<const char*>(frame.instruction_pointer) -
reinterpret_cast<const char*>(modules[frame.module_index].base_address); reinterpret_cast<const char*>(modules[frame.module_index].base_address);
DCHECK_GE(module_offset, 0); DCHECK_GE(module_offset, 0);
entry->set_address(static_cast<uint64_t>(module_offset)); location->set_address(static_cast<uint64_t>(module_offset));
entry->set_module_id_index(frame.module_index); location->set_module_id_index(frame.module_index);
} }
} }
......
...@@ -113,14 +113,14 @@ TEST(CallStackProfileBuilderTest, ProfilingCompleted) { ...@@ -113,14 +113,14 @@ TEST(CallStackProfileBuilderTest, ProfilingCompleted) {
const CallStackProfile& profile = proto.call_stack_profile(); const CallStackProfile& profile = proto.call_stack_profile();
ASSERT_EQ(2, profile.sample_size()); ASSERT_EQ(2, profile.sample_size());
ASSERT_EQ(2, profile.sample(0).entry_size()); ASSERT_EQ(2, profile.sample(0).frame_size());
ASSERT_TRUE(profile.sample(0).entry(0).has_module_id_index()); ASSERT_TRUE(profile.sample(0).frame(0).has_module_id_index());
EXPECT_EQ(0, profile.sample(0).entry(0).module_id_index()); EXPECT_EQ(0, profile.sample(0).frame(0).module_id_index());
ASSERT_TRUE(profile.sample(0).entry(1).has_module_id_index()); ASSERT_TRUE(profile.sample(0).frame(1).has_module_id_index());
EXPECT_EQ(1, profile.sample(0).entry(1).module_id_index()); EXPECT_EQ(1, profile.sample(0).frame(1).module_id_index());
ASSERT_EQ(1, profile.sample(1).entry_size()); ASSERT_EQ(1, profile.sample(1).frame_size());
ASSERT_TRUE(profile.sample(1).entry(0).has_module_id_index()); ASSERT_TRUE(profile.sample(1).frame(0).has_module_id_index());
EXPECT_EQ(2, profile.sample(1).entry(0).module_id_index()); EXPECT_EQ(2, profile.sample(1).frame(0).module_id_index());
ASSERT_EQ(3, profile.module_id().size()); ASSERT_EQ(3, profile.module_id().size());
ASSERT_TRUE(profile.module_id(0).has_build_id()); ASSERT_TRUE(profile.module_id(0).has_build_id());
...@@ -268,15 +268,15 @@ TEST(CallStackProfileBuilderTest, Modules) { ...@@ -268,15 +268,15 @@ TEST(CallStackProfileBuilderTest, Modules) {
const CallStackProfile& profile = proto.call_stack_profile(); const CallStackProfile& profile = proto.call_stack_profile();
ASSERT_EQ(1, profile.sample_size()); ASSERT_EQ(1, profile.sample_size());
ASSERT_EQ(2, profile.sample(0).entry_size()); ASSERT_EQ(2, profile.sample(0).frame_size());
ASSERT_FALSE(profile.sample(0).entry(0).has_module_id_index()); ASSERT_FALSE(profile.sample(0).frame(0).has_module_id_index());
ASSERT_FALSE(profile.sample(0).entry(0).has_address()); ASSERT_FALSE(profile.sample(0).frame(0).has_address());
ASSERT_TRUE(profile.sample(0).entry(1).has_module_id_index()); ASSERT_TRUE(profile.sample(0).frame(1).has_module_id_index());
EXPECT_EQ(0, profile.sample(0).entry(1).module_id_index()); EXPECT_EQ(0, profile.sample(0).frame(1).module_id_index());
ASSERT_TRUE(profile.sample(0).entry(1).has_address()); ASSERT_TRUE(profile.sample(0).frame(1).has_address());
EXPECT_EQ(0x10ULL, profile.sample(0).entry(1).address()); EXPECT_EQ(0x10ULL, profile.sample(0).frame(1).address());
ASSERT_EQ(1, profile.module_id().size()); ASSERT_EQ(1, profile.module_id().size());
ASSERT_TRUE(profile.module_id(0).has_build_id()); ASSERT_TRUE(profile.module_id(0).has_build_id());
...@@ -318,19 +318,19 @@ TEST(CallStackProfileBuilderTest, DedupModules) { ...@@ -318,19 +318,19 @@ TEST(CallStackProfileBuilderTest, DedupModules) {
const CallStackProfile& profile = proto.call_stack_profile(); const CallStackProfile& profile = proto.call_stack_profile();
ASSERT_EQ(1, profile.sample_size()); ASSERT_EQ(1, profile.sample_size());
ASSERT_EQ(2, profile.sample(0).entry_size()); ASSERT_EQ(2, profile.sample(0).frame_size());
// Since module1 and module2 have the same base address, they are considered // Since module1 and module2 have the same base address, they are considered
// the same module and therefore deduped. // the same module and therefore deduped.
ASSERT_TRUE(profile.sample(0).entry(0).has_module_id_index()); ASSERT_TRUE(profile.sample(0).frame(0).has_module_id_index());
EXPECT_EQ(0, profile.sample(0).entry(0).module_id_index()); EXPECT_EQ(0, profile.sample(0).frame(0).module_id_index());
ASSERT_TRUE(profile.sample(0).entry(0).has_address()); ASSERT_TRUE(profile.sample(0).frame(0).has_address());
EXPECT_EQ(0x10ULL, profile.sample(0).entry(0).address()); EXPECT_EQ(0x10ULL, profile.sample(0).frame(0).address());
ASSERT_TRUE(profile.sample(0).entry(1).has_module_id_index()); ASSERT_TRUE(profile.sample(0).frame(1).has_module_id_index());
EXPECT_EQ(0, profile.sample(0).entry(1).module_id_index()); EXPECT_EQ(0, profile.sample(0).frame(1).module_id_index());
ASSERT_TRUE(profile.sample(0).entry(1).has_address()); ASSERT_TRUE(profile.sample(0).frame(1).has_address());
EXPECT_EQ(0x20ULL, profile.sample(0).entry(1).address()); EXPECT_EQ(0x20ULL, profile.sample(0).frame(1).address());
ASSERT_EQ(1, profile.module_id().size()); ASSERT_EQ(1, profile.module_id().size());
ASSERT_TRUE(profile.module_id(0).has_build_id()); ASSERT_TRUE(profile.module_id(0).has_build_id());
......
...@@ -54,9 +54,9 @@ TEST_F(CallStackProfileStructTraitsTest, SampledProfile) { ...@@ -54,9 +54,9 @@ TEST_F(CallStackProfileStructTraitsTest, SampledProfile) {
CallStackProfile::Sample* proto_sample = proto_profile->add_sample(); CallStackProfile::Sample* proto_sample = proto_profile->add_sample();
proto_sample->set_count(1); proto_sample->set_count(1);
CallStackProfile::Entry* entry = proto_sample->add_entry(); CallStackProfile::Location* location = proto_sample->add_frame();
entry->set_address(0x10ULL); location->set_address(0x10ULL);
entry->set_module_id_index(0); location->set_module_id_index(0);
CallStackProfile::ModuleIdentifier* module_id = CallStackProfile::ModuleIdentifier* module_id =
proto_profile->add_module_id(); proto_profile->add_module_id();
...@@ -74,13 +74,13 @@ TEST_F(CallStackProfileStructTraitsTest, SampledProfile) { ...@@ -74,13 +74,13 @@ TEST_F(CallStackProfileStructTraitsTest, SampledProfile) {
const CallStackProfile& out_profile = output_proto.call_stack_profile(); const CallStackProfile& out_profile = output_proto.call_stack_profile();
ASSERT_EQ(1, out_profile.sample_size()); ASSERT_EQ(1, out_profile.sample_size());
ASSERT_EQ(1, out_profile.sample(0).entry_size()); ASSERT_EQ(1, out_profile.sample(0).frame_size());
ASSERT_TRUE(out_profile.sample(0).entry(0).has_address()); ASSERT_TRUE(out_profile.sample(0).frame(0).has_address());
EXPECT_EQ(0x10ULL, out_profile.sample(0).entry(0).address()); EXPECT_EQ(0x10ULL, out_profile.sample(0).frame(0).address());
ASSERT_TRUE(out_profile.sample(0).entry(0).has_module_id_index()); ASSERT_TRUE(out_profile.sample(0).frame(0).has_module_id_index());
EXPECT_EQ(0, out_profile.sample(0).entry(0).module_id_index()); EXPECT_EQ(0, out_profile.sample(0).frame(0).module_id_index());
ASSERT_EQ(1, out_profile.module_id().size()); ASSERT_EQ(1, out_profile.module_id().size());
......
Name: Metrics Protos Name: Metrics Protos
Short Name: metrics_proto Short Name: metrics_proto
URL: This is the canonical public repository URL: This is the canonical public repository
Version: 205000821 Version: 209012138
Date: 2018/07/18 UTC Date: 2018/08/16 UTC
License: BSD License: BSD
Security Critical: Yes Security Critical: Yes
......
...@@ -16,8 +16,23 @@ import "execution_context.proto"; ...@@ -16,8 +16,23 @@ import "execution_context.proto";
// Call stack sample data for a given profiling session. // Call stack sample data for a given profiling session.
// Next tag: 5 // Next tag: 5
message CallStackProfile { message CallStackProfile {
// Describes an entry in the callstack. // Uniquely identifies a module.
message Entry { message ModuleIdentifier {
// A hash that uniquely identifies a particular program version with high
// probability. This is parsed from headers of the loaded module.
// For binaries generated by GNU tools:
// Contents of the .note.gnu.build-id field.
// On Windows:
// GUID + AGE in the debug image headers of a module.
optional string build_id = 1;
// MD5Sum Prefix of the module name. This is the same hashing scheme as used
// to hash UMA histogram names.
optional fixed64 name_md5_prefix = 2;
}
// Describes a location within executable code.
message Location {
// Instruction pointer subtracted by module base. // Instruction pointer subtracted by module base.
optional uint64 address = 1; optional uint64 address = 1;
...@@ -28,9 +43,9 @@ message CallStackProfile { ...@@ -28,9 +43,9 @@ message CallStackProfile {
// A sample consisting of one or more callstacks with the same stack frames // A sample consisting of one or more callstacks with the same stack frames
// and instruction pointers. // and instruction pointers.
message Sample { message Sample {
// The callstack. Sample.entries[0] represents the call on the top of the // The callstack. Sample.frame[0] represents the call on the top of the
// stack. // stack.
repeated Entry entry = 1; repeated Location frame = 1;
// Number of times this stack signature occurs. // Number of times this stack signature occurs.
optional int64 count = 2; optional int64 count = 2;
...@@ -43,21 +58,6 @@ message CallStackProfile { ...@@ -43,21 +58,6 @@ message CallStackProfile {
repeated ProcessPhase process_phase = 3; repeated ProcessPhase process_phase = 3;
} }
// Uniquely identifies a module.
message ModuleIdentifier {
// A hash that uniquely identifies a particular program version with high
// probability. This is parsed from headers of the loaded module.
// For binaries generated by GNU tools:
// Contents of the .note.gnu.build-id field.
// On Windows:
// GUID + AGE in the debug image headers of a module.
optional string build_id = 1;
// MD5Sum Prefix of the module name. This is the same hashing scheme as used
// to hash UMA histogram names.
optional fixed64 name_md5_prefix = 2;
}
// The callstack and counts. // The callstack and counts.
repeated Sample sample = 1; repeated Sample sample = 1;
......
...@@ -145,7 +145,7 @@ message CastLogsProto { ...@@ -145,7 +145,7 @@ message CastLogsProto {
repeated CastConnectionInfo cast_connection_info = 2; repeated CastConnectionInfo cast_connection_info = 2;
// Stores Cast-enabled device specific events with a various context data. // Stores Cast-enabled device specific events with a various context data.
// Next tag: 17 // Next tag: 18
message CastEventProto { message CastEventProto {
// The name of the action, hashed by same logic used to hash user action // The name of the action, hashed by same logic used to hash user action
// event and histogram. // event and histogram.
...@@ -198,6 +198,9 @@ message CastLogsProto { ...@@ -198,6 +198,9 @@ message CastLogsProto {
// Optional values associated with the event. // Optional values associated with the event.
repeated float feature_vector = 15; repeated float feature_vector = 15;
// Optional value associated with timezone update event.
optional string timezone_id = 17;
} }
repeated CastEventProto cast_event = 3; repeated CastEventProto cast_event = 3;
...@@ -206,7 +209,7 @@ message CastLogsProto { ...@@ -206,7 +209,7 @@ message CastLogsProto {
optional fixed32 virtual_release_track = 4; optional fixed32 virtual_release_track = 4;
// Cast specific device information which is expected to change over time. // Cast specific device information which is expected to change over time.
// Next tag: 7 // Next tag: 8
message CastDeviceMutableInfo { message CastDeviceMutableInfo {
// This is the last type of reboot the device encountered // This is the last type of reboot the device encountered
// Next tag: 9 // Next tag: 9
...@@ -246,6 +249,9 @@ message CastLogsProto { ...@@ -246,6 +249,9 @@ message CastLogsProto {
// True if the system which cast_shell is running on, supports ip dual stack // True if the system which cast_shell is running on, supports ip dual stack
// sockets. // sockets.
optional bool ip_dual_stack_supported = 6; optional bool ip_dual_stack_supported = 6;
// Current timezone which the device is using.
optional string timezone_id = 7;
} }
// The device sends this information at least once per day. // The device sends this information at least once per day.
optional CastDeviceMutableInfo cast_device_mutable_info = 5; optional CastDeviceMutableInfo cast_device_mutable_info = 5;
......
...@@ -20,6 +20,7 @@ message Source { ...@@ -20,6 +20,7 @@ message Source {
ABOUT = 4; ABOUT = 4;
CHROME = 5; CHROME = 5;
CHROME_EXTENSION = 6; CHROME_EXTENSION = 6;
APP = 7;
}; };
// An identifier for the source. This should be unique within a session. // An identifier for the source. This should be unique within a session.
......
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