3 Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
8 <link rel="import" href="/tracing/analysis/analysis_sub_view.html">
9 <link rel="import" href="/tracing/analysis/util.html">
10 <link rel="import" href="/tracing/side_panel/sampling_summary.html">
11 <link rel="import" href="/base.html">
12 <link rel="import" href="/base/ui.html">
13 <link rel="import" href="/base/ui/sortable_table.html">
15 <polymer-element name="single-sample-analysis-sub-view"
16 extends="tracing-analysis-sub-view"
17 constructor="SingleSampleAnalysisSubView">
20 tv.onPolymerReady(function() {
21 tracing.registerAnalysisSubViewType(
24 if (selection.length != 1)
26 return selection[0] instanceof tracing.trace_model.Sample;
28 SingleSampleAnalysisSubView);
29 tracing.registerAnalysisSubViewType(
32 if (selection.length == 1)
34 return selection[0] instanceof tracing.trace_model.Sample;
36 MultipleSamplesAnalysisSubView);
41 this.currentSelection_ = undefined;
44 set selection(selection) {
45 this.currentSelection_ = selection;
46 this.textContent = '';
48 if (selection.length === 0)
51 var results = new tracing.analysis.AnalysisResults();
52 this.appendChild(results);
54 this.analyzeSingleSampleEvent_(
55 results, selection[0], 'Sample Event');
59 return this.currentSelection_;
62 analyzeSingleSampleEvent_: function(results, sample, type) {
63 results.appendHeader('Selected ' + type + ':');
64 var table = results.appendTable('analysis-slice-table', 2);
66 results.appendInfoRow(table, 'Title', sample.title);
67 results.appendInfoRowTime(table, 'Sample Time', sample.start);
68 results.appendInfoRow(table,
70 sample.getUserFriendlyStackTrace());
76 <polymer-element name="multiple-samples-analysis-sub-view"
77 extends="tracing-analysis-sub-view"
78 constructor="MultipleSamplesAnalysisSubView">
83 this.currentSelection_ = undefined;
86 set selection(selection) {
87 this.currentSelection_ = selection;
88 this.textContent = '';
90 if (selection.length === 0)
93 var results = new tracing.analysis.AnalysisResults();
94 this.appendChild(results);
96 this.analyzeMultipleSampleEvents_(results, selection);
100 return this.currentSelection_;
103 analyzeMultipleSampleEvents_: function(results, slices) {
104 var panel = new tracing.SamplingSummaryPanel();
105 results.appendChild(panel);
106 panel.selection = slices;