Commit 20589626 authored by Mike Wittman's avatar Mike Wittman Committed by Commit Bot

Sync metrics protos with google3

Bug: 851163
Change-Id: I70938c74d799ca1377d2d368ed0be28090f1ad1f
Reviewed-on: https://chromium-review.googlesource.com/1180527
Commit-Queue: Mike Wittman <wittman@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584591}
parent 94a26969
......@@ -188,12 +188,13 @@ void CallStackProfileBuilder::OnSampleCompleted(
if (existing_sample_index != -1) {
CallStackProfile::Sample* sample_proto =
proto_profile_.mutable_sample(existing_sample_index);
proto_profile_.mutable_deprecated_sample(existing_sample_index);
sample_proto->set_count(sample_proto->count() + 1);
return;
}
CallStackProfile::Sample* sample_proto = proto_profile_.add_sample();
CallStackProfile::Sample* sample_proto =
proto_profile_.add_deprecated_sample();
CopySampleToProto(sample_, modules_, sample_proto);
sample_proto->set_count(1);
CopyAnnotationsToProto(sample_.process_milestones & ~milestones_,
......@@ -201,7 +202,7 @@ void CallStackProfileBuilder::OnSampleCompleted(
milestones_ = sample_.process_milestones;
sample_index_.insert(std::make_pair(
sample_, static_cast<int>(proto_profile_.sample_size()) - 1));
sample_, static_cast<int>(proto_profile_.deprecated_sample_size()) - 1));
sample_ = Sample();
}
......
......@@ -53,16 +53,18 @@ TEST(CallStackProfileBuilderTest, SetProcessMilestone) {
ASSERT_TRUE(proto.has_call_stack_profile());
const CallStackProfile& profile = proto.call_stack_profile();
ASSERT_EQ(2, profile.sample_size());
ASSERT_EQ(2, profile.deprecated_sample_size());
uint32_t process_milestones = 0;
for (int i = 0; i < profile.sample(0).process_phase().size(); ++i)
process_milestones |= 1U << profile.sample(0).process_phase().Get(i);
for (int i = 0; i < profile.deprecated_sample(0).process_phase().size(); ++i)
process_milestones |=
1U << profile.deprecated_sample(0).process_phase().Get(i);
EXPECT_EQ(0U, process_milestones);
process_milestones = 0;
for (int i = 0; i < profile.sample(1).process_phase().size(); ++i)
process_milestones |= 1U << profile.sample(1).process_phase().Get(i);
for (int i = 0; i < profile.deprecated_sample(1).process_phase().size(); ++i)
process_milestones |=
1U << profile.deprecated_sample(1).process_phase().Get(i);
EXPECT_EQ(1U << 1, process_milestones);
}
......@@ -112,15 +114,15 @@ TEST(CallStackProfileBuilderTest, ProfilingCompleted) {
ASSERT_TRUE(proto.has_call_stack_profile());
const CallStackProfile& profile = proto.call_stack_profile();
ASSERT_EQ(2, profile.sample_size());
ASSERT_EQ(2, profile.sample(0).frame_size());
ASSERT_TRUE(profile.sample(0).frame(0).has_module_id_index());
EXPECT_EQ(0, profile.sample(0).frame(0).module_id_index());
ASSERT_TRUE(profile.sample(0).frame(1).has_module_id_index());
EXPECT_EQ(1, profile.sample(0).frame(1).module_id_index());
ASSERT_EQ(1, profile.sample(1).frame_size());
ASSERT_TRUE(profile.sample(1).frame(0).has_module_id_index());
EXPECT_EQ(2, profile.sample(1).frame(0).module_id_index());
ASSERT_EQ(2, profile.deprecated_sample_size());
ASSERT_EQ(2, profile.deprecated_sample(0).frame_size());
ASSERT_TRUE(profile.deprecated_sample(0).frame(0).has_module_id_index());
EXPECT_EQ(0, profile.deprecated_sample(0).frame(0).module_id_index());
ASSERT_TRUE(profile.deprecated_sample(0).frame(1).has_module_id_index());
EXPECT_EQ(1, profile.deprecated_sample(0).frame(1).module_id_index());
ASSERT_EQ(1, profile.deprecated_sample(1).frame_size());
ASSERT_TRUE(profile.deprecated_sample(1).frame(0).has_module_id_index());
EXPECT_EQ(2, profile.deprecated_sample(1).frame(0).module_id_index());
ASSERT_EQ(3, profile.module_id().size());
ASSERT_TRUE(profile.module_id(0).has_build_id());
......@@ -186,7 +188,7 @@ TEST(CallStackProfileBuilderTest, SamplesDeduped) {
ASSERT_EQ(SampledProfile::PROCESS_STARTUP, proto.trigger_event());
ASSERT_TRUE(proto.has_call_stack_profile());
ASSERT_EQ(1, proto.call_stack_profile().sample_size());
ASSERT_EQ(1, proto.call_stack_profile().deprecated_sample_size());
}
TEST(CallStackProfileBuilderTest, SamplesNotDeduped) {
......@@ -233,7 +235,7 @@ TEST(CallStackProfileBuilderTest, SamplesNotDeduped) {
ASSERT_EQ(SampledProfile::PROCESS_STARTUP, proto.trigger_event());
ASSERT_TRUE(proto.has_call_stack_profile());
ASSERT_EQ(2, proto.call_stack_profile().sample_size());
ASSERT_EQ(2, proto.call_stack_profile().deprecated_sample_size());
}
TEST(CallStackProfileBuilderTest, Modules) {
......@@ -267,16 +269,16 @@ TEST(CallStackProfileBuilderTest, Modules) {
ASSERT_TRUE(proto.has_call_stack_profile());
const CallStackProfile& profile = proto.call_stack_profile();
ASSERT_EQ(1, profile.sample_size());
ASSERT_EQ(2, profile.sample(0).frame_size());
ASSERT_EQ(1, profile.deprecated_sample_size());
ASSERT_EQ(2, profile.deprecated_sample(0).frame_size());
ASSERT_FALSE(profile.sample(0).frame(0).has_module_id_index());
ASSERT_FALSE(profile.sample(0).frame(0).has_address());
ASSERT_FALSE(profile.deprecated_sample(0).frame(0).has_module_id_index());
ASSERT_FALSE(profile.deprecated_sample(0).frame(0).has_address());
ASSERT_TRUE(profile.sample(0).frame(1).has_module_id_index());
EXPECT_EQ(0, profile.sample(0).frame(1).module_id_index());
ASSERT_TRUE(profile.sample(0).frame(1).has_address());
EXPECT_EQ(0x10ULL, profile.sample(0).frame(1).address());
ASSERT_TRUE(profile.deprecated_sample(0).frame(1).has_module_id_index());
EXPECT_EQ(0, profile.deprecated_sample(0).frame(1).module_id_index());
ASSERT_TRUE(profile.deprecated_sample(0).frame(1).has_address());
EXPECT_EQ(0x10ULL, profile.deprecated_sample(0).frame(1).address());
ASSERT_EQ(1, profile.module_id().size());
ASSERT_TRUE(profile.module_id(0).has_build_id());
......@@ -317,20 +319,20 @@ TEST(CallStackProfileBuilderTest, DedupModules) {
ASSERT_TRUE(proto.has_call_stack_profile());
const CallStackProfile& profile = proto.call_stack_profile();
ASSERT_EQ(1, profile.sample_size());
ASSERT_EQ(2, profile.sample(0).frame_size());
ASSERT_EQ(1, profile.deprecated_sample_size());
ASSERT_EQ(2, profile.deprecated_sample(0).frame_size());
// Since module1 and module2 have the same base address, they are considered
// the same module and therefore deduped.
ASSERT_TRUE(profile.sample(0).frame(0).has_module_id_index());
EXPECT_EQ(0, profile.sample(0).frame(0).module_id_index());
ASSERT_TRUE(profile.sample(0).frame(0).has_address());
EXPECT_EQ(0x10ULL, profile.sample(0).frame(0).address());
ASSERT_TRUE(profile.deprecated_sample(0).frame(0).has_module_id_index());
EXPECT_EQ(0, profile.deprecated_sample(0).frame(0).module_id_index());
ASSERT_TRUE(profile.deprecated_sample(0).frame(0).has_address());
EXPECT_EQ(0x10ULL, profile.deprecated_sample(0).frame(0).address());
ASSERT_TRUE(profile.sample(0).frame(1).has_module_id_index());
EXPECT_EQ(0, profile.sample(0).frame(1).module_id_index());
ASSERT_TRUE(profile.sample(0).frame(1).has_address());
EXPECT_EQ(0x20ULL, profile.sample(0).frame(1).address());
ASSERT_TRUE(profile.deprecated_sample(0).frame(1).has_module_id_index());
EXPECT_EQ(0, profile.deprecated_sample(0).frame(1).module_id_index());
ASSERT_TRUE(profile.deprecated_sample(0).frame(1).has_address());
EXPECT_EQ(0x20ULL, profile.deprecated_sample(0).frame(1).address());
ASSERT_EQ(1, profile.module_id().size());
ASSERT_TRUE(profile.module_id(0).has_build_id());
......@@ -339,4 +341,4 @@ TEST(CallStackProfileBuilderTest, DedupModules) {
ASSERT_EQ(module_md5, profile.module_id(0).name_md5_prefix());
}
} // namespace metrics
\ No newline at end of file
} // namespace metrics
......@@ -52,7 +52,8 @@ TEST_F(CallStackProfileStructTraitsTest, SampledProfile) {
CallStackProfile* proto_profile = input_proto.mutable_call_stack_profile();
CallStackProfile::Sample* proto_sample = proto_profile->add_sample();
CallStackProfile::Sample* proto_sample =
proto_profile->add_deprecated_sample();
proto_sample->set_count(1);
CallStackProfile::Location* location = proto_sample->add_frame();
location->set_address(0x10ULL);
......@@ -73,14 +74,14 @@ TEST_F(CallStackProfileStructTraitsTest, SampledProfile) {
const CallStackProfile& out_profile = output_proto.call_stack_profile();
ASSERT_EQ(1, out_profile.sample_size());
ASSERT_EQ(1, out_profile.sample(0).frame_size());
ASSERT_EQ(1, out_profile.deprecated_sample_size());
ASSERT_EQ(1, out_profile.deprecated_sample(0).frame_size());
ASSERT_TRUE(out_profile.sample(0).frame(0).has_address());
EXPECT_EQ(0x10ULL, out_profile.sample(0).frame(0).address());
ASSERT_TRUE(out_profile.deprecated_sample(0).frame(0).has_address());
EXPECT_EQ(0x10ULL, out_profile.deprecated_sample(0).frame(0).address());
ASSERT_TRUE(out_profile.sample(0).frame(0).has_module_id_index());
EXPECT_EQ(0, out_profile.sample(0).frame(0).module_id_index());
ASSERT_TRUE(out_profile.deprecated_sample(0).frame(0).has_module_id_index());
EXPECT_EQ(0, out_profile.deprecated_sample(0).frame(0).module_id_index());
ASSERT_EQ(1, out_profile.module_id().size());
......
Name: Metrics Protos
Short Name: metrics_proto
URL: This is the canonical public repository
Version: 209012138
Date: 2018/08/16 UTC
Version: 209238432
Date: 2018/08/18 UTC
License: BSD
Security Critical: Yes
......
......@@ -14,7 +14,7 @@ package metrics;
import "execution_context.proto";
// Call stack sample data for a given profiling session.
// Next tag: 5
// Next tag: 11
message CallStackProfile {
// Uniquely identifies a module.
message ModuleIdentifier {
......@@ -40,8 +40,38 @@ message CallStackProfile {
optional int32 module_id_index = 2;
}
// A sample consisting of one or more callstacks with the same stack frames
// and instruction pointers.
// The sampled call stack.
message Stack {
// The frames in the callstack. The frame[0] entry represents the call on
// the top of the stack.
repeated Location frame = 1;
}
// An item of metadata associated with either the entire profile or a single
// sample.
message MetadataItem {
// Index of the hash of the metadata name.
optional int32 name_hash_index = 1;
// Value for the item. An absent value indicates the metadata has become
// unset since the previous StackSample.
optional sint64 value = 2;
}
// Backtrace of locations of async execution requests (e.g. task postings, IPC
// message sending, requests over mojo) that led to the current task
// execution. Note that these are saved in a fixed length buffer on the client
// which as of 2018/08/14 includes only the most recent four entries.
message AsyncBacktrace {
// The locations saved in the backtrace, with the most recent in
// location[0]. Empty if the work was not tied to an async execution request
// -- for example, handling a mouse event.
repeated Location location = 1;
}
// Deprecated version of a sample consisting of one or more callstacks with
// the same stack frames and instruction pointers. Deprecated as of
// 2018/08/14.
message Sample {
// The callstack. Sample.frame[0] represents the call on the top of the
// stack.
......@@ -58,12 +88,58 @@ message CallStackProfile {
repeated ProcessPhase process_phase = 3;
}
// The callstack and counts.
repeated Sample sample = 1;
// A sampled stack, along with associated metadata.
message StackSample {
// Index into the profile's repeated |stack| field for the stack
// corresponding to this sample.
optional int32 stack_index = 1;
// Sample time relative to the first sample.
optional int32 sample_time_offset_ms = 2;
// True if this sample is executing the same item of work (task, event) as
// the last sample.
optional bool continued_work = 3;
// Index of the backtrace in the profile of posted task locations that led
// to this task execution.
optional int32 async_backtrace_index = 4;
// Metadata items associated with the sample. To minimize memory usage,
// metadata items are specified only when their values change from the
// previous sample. Items are not guaranteed to be in a particular order.
repeated MetadataItem metadata = 5;
}
// The previous sample encoding. Deprecated 2018/08/04 in favor of
// stack_sample.
repeated Sample DEPRECATED_sample = 1 [deprecated = true];
// List of module ids found in this sample.
repeated ModuleIdentifier module_id = 2;
// Metadata name hashes used in this profile. Recorded global to the profile
// to minimize per-sample memory usage.
repeated fixed64 metadata_name_hash = 5;
// Metadata global to the profile.
repeated MetadataItem profile_metadata = 6;
// The distinct async backtraces for the samples.
repeated AsyncBacktrace async_backtrace = 7;
// The distinct stacks for the samples.
repeated Stack stack = 8;
// The stack samples collected for this profile.
repeated StackSample stack_sample = 9;
// Time of the first sample relative to Chrome start. This value may be
// imprecise or wrong for Windows clients without high-resolution
// TimeTicks. TODO(wittman): Clarify the actual properties of this value for
// clients without high-resolution TimeTicks once we understand what they are.
optional int64 profile_start_time_offset_ms = 10;
// Duration of this profile.
optional int32 profile_duration_ms = 3;
......
......@@ -47,9 +47,24 @@ message CastLogsProto {
// Hardware information stored in factory partition.
message HardwareInfo {
optional string color = 1;
optional string mic = 2;
optional string memory = 3;
optional string nand = 4;
optional string mfg_date = 5;
optional string build_name = 6;
optional string config = 7;
optional string emmc = 8;
optional string display = 9;
optional string amp = 10;
}
optional HardwareInfo hardware_info = 6;
}
......
......@@ -150,6 +150,10 @@ message OmniboxEventProto {
// This omnibox interaction started with the user tapping the search button.
SEARCH_BUTTON_AS_STARTING_FOCUS = 13;
// This interaction started with the user focusing or typing in the search
// box of the ChromeOS app list (a.k.a., launcher).
CHROMEOS_APP_LIST = 14;
// When adding new classifications, please consider adding them in
// chromium's chrome/browser/resources/omnibox/omnibox.html
// so that these new options are displayed on about:omnibox.
......
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