-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-subtree-dir: third_party/metrics_proto git-subtree-split: a281dd4e907563c062bf0c96c22fbc0382835cf1
- Loading branch information
0 parents
commit 571cb6b
Showing
27 changed files
with
3,573 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright 2014 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
import("//third_party/protobuf/proto_library.gni") | ||
|
||
proto_library("metrics_proto") { | ||
sources = [ | ||
"call_stack_profile.proto", | ||
"cast_logs.proto", | ||
"chrome_user_metrics_extension.proto", | ||
"execution_context.proto", | ||
"extension_install.proto", | ||
"histogram_event.proto", | ||
"memory_leak_report.proto", | ||
"omnibox_event.proto", | ||
"omnibox_input_type.proto", | ||
"perf_data.proto", | ||
"perf_stat.proto", | ||
"printer_event.proto", | ||
"reporting_info.proto", | ||
"sampled_profile.proto", | ||
"system_profile.proto", | ||
"translate_event.proto", | ||
"ukm/aggregate.proto", | ||
"ukm/entry.proto", | ||
"ukm/report.proto", | ||
"ukm/source.proto", | ||
"user_action_event.proto", | ||
] | ||
proto_in_dir = "." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// * Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// * Redistributions in binary form must reproduce the above | ||
// copyright notice, this list of conditions and the following disclaimer | ||
// in the documentation and/or other materials provided with the | ||
// distribution. | ||
// * Neither the name of Google Inc. nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
file://base/metrics/OWNERS | ||
|
||
per-file [email protected] | ||
per-file [email protected] | ||
per-file [email protected] | ||
|
||
# COMPONENT: Internals>Metrics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2018 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
"""Presubmit script for metrics_proto. | ||
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | ||
for more details on the presubmit API built into gcl. | ||
""" | ||
|
||
README = 'README.chromium' | ||
|
||
|
||
def IsMetricsProtoPath(input_api, path): | ||
return input_api.os_path.dirname(path) == input_api.PresubmitLocalPath() | ||
|
||
|
||
def IsReadmeFile(input_api, path): | ||
return (input_api.basename(path) == README and | ||
IsMetricsProtoPath(input_api, path)) | ||
|
||
|
||
def CheckChange(input_api, output_api): | ||
"""Checks that all changes include a README update.""" | ||
paths = [af.AbsoluteLocalPath() for af in input_api.AffectedFiles()] | ||
if (any((IsMetricsProtoPath(input_api, p) for p in paths)) and | ||
not any((IsReadmeFile(input_api, p) for p in paths))): | ||
return [output_api.PresubmitError( | ||
'Modifies %s without updating %s. ' | ||
'Changes to these files should originate upstream.' % | ||
(input_api.PresubmitLocalPath(), README))] | ||
return [] | ||
|
||
|
||
def CheckChangeOnUpload(input_api, output_api): | ||
return CheckChange(input_api, output_api) | ||
|
||
|
||
def CheckChangeOnCommit(input_api, output_api): | ||
return CheckChange(input_api, output_api) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python | ||
# Copyright 2018 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
import os | ||
import sys | ||
import unittest | ||
|
||
import PRESUBMIT | ||
|
||
sys.path.append( | ||
os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) | ||
|
||
from PRESUBMIT_test_mocks import (MockInputApi, MockOutputApi, MockAffectedFile) | ||
|
||
class MetricsProtoCheckerTest(unittest.TestCase): | ||
|
||
def testModifiedWithoutReadme(self): | ||
input_api = MockInputApi() | ||
input_api.files = [MockAffectedFile('somefile.proto', 'some diff')] | ||
self.assertEqual(1, len(PRESUBMIT.CheckChange(input_api, MockOutputApi()))) | ||
|
||
|
||
def testModifiedWithoutReadme(self): | ||
input_api = MockInputApi() | ||
input_api.files = [ | ||
MockAffectedFile('somefile.proto', 'some diff'), | ||
MockAffectedFile(PRESUBMIT.README, 'some diff'), | ||
] | ||
self.assertEqual(0, len(PRESUBMIT.CheckChange(input_api, MockOutputApi()))) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Name: Metrics Protos | ||
Short Name: metrics_proto | ||
URL: This is the canonical public repository | ||
Version: 210962504 | ||
Date: 2018/08/30 UTC | ||
License: BSD | ||
Security Critical: Yes | ||
|
||
Description: | ||
This package contains the protos that are used to upload metrics data to Google. | ||
Updates to this code should be made by changing the internal copies, and then | ||
running the export script. | ||
|
||
blaze run //analysis/uma/proto_export:proto_export -- \ | ||
--from_piper \ | ||
--output=$CHROMIUM_SRC/third_party/metrics_proto | ||
|
||
Local Modifications: | ||
Unchanged from the output of the export script. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
syntax = "proto2"; | ||
|
||
option optimize_for = LITE_RUNTIME; | ||
|
||
option java_outer_classname = "CallStackProfileProtos"; | ||
option java_package = "org.chromium.components.metrics"; | ||
|
||
package metrics; | ||
|
||
import "execution_context.proto"; | ||
|
||
// Call stack sample data for a given profiling session. | ||
// Next tag: 11 | ||
message CallStackProfile { | ||
// 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; | ||
} | ||
|
||
// Describes a location within executable code. | ||
message Location { | ||
// Instruction pointer subtracted by module base. | ||
optional uint64 address = 1; | ||
|
||
// Index to the module identifier in |module_ids| of CallStackProfile. | ||
optional int32 module_id_index = 2; | ||
} | ||
|
||
// 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. | ||
repeated Location frame = 1; | ||
|
||
// Number of times this stack signature occurs. | ||
optional int64 count = 2; | ||
|
||
// This repeating field indicates the current phase of the system such as | ||
// whether it is in startup, general operation, or shutdown. The first | ||
// Sample of a CallStackProfile will list all phases that have been reached; | ||
// later samples will list only the new phases that occurred since the | ||
// previous one. | ||
repeated ProcessPhase process_phase = 3; | ||
} | ||
|
||
// 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; | ||
|
||
// Time between samples. | ||
optional int32 sampling_period_ms = 4; | ||
} |
Oops, something went wrong.