OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- |
| 3 Copyright 2017 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. |
| 6 --> |
| 7 |
| 8 <link rel="import" href="/components/paper-button/paper-button.html"> |
| 9 <link rel="import" href="/components/paper-checkbox/paper-checkbox.html"> |
| 10 <link rel="import" href="/components/paper-dialog/paper-dialog.html"> |
| 11 <link rel="import" href="/components/paper-input/paper-input.html"> |
| 12 <link rel="import" href="/components/paper-spinner/paper-spinner.html"> |
| 13 |
| 14 <link rel="import" href="/dashboard/static/simple_xhr.html"> |
| 15 |
| 16 <dom-module is="pinpoint-perf-job-dialog"> |
| 17 <template> |
| 18 |
| 19 <paper-dialog id="container" autoCloseDisabled="true"> |
| 20 <!-- Styling for paper-dialog's children. --> |
| 21 <style> |
| 22 paper-button[dialog-confirm] { |
| 23 background: #4285f4; |
| 24 color: #fff; |
| 25 margin-bottom: 5px; |
| 26 } |
| 27 |
| 28 paper-input { |
| 29 width: 400px; |
| 30 } |
| 31 </style> |
| 32 |
| 33 <form on-submit="onSendToTrybot"> |
| 34 <table> |
| 35 <tr> |
| 36 <td>Record a before/after trace profile.</td> |
| 37 </tr> |
| 38 <tr> |
| 39 <td>Perf try bot:</td> |
| 40 <td> |
| 41 <paper-input type="text" value="[[bot]]" disabled></paper-input> |
| 42 </td> |
| 43 </tr> |
| 44 <tr> |
| 45 <td><paper-checkbox checked="{{useTrace::input}}"></paper-checkbox>C
hrome trace <a href="https://cs.chromium.org/chromium/src/base/trace_event/trace
_config.h?rcl=c8db6c6371ca047c24d41f3972d5819bc83d83ae&l=125" target="_blank">fi
lter string</a>:</td> |
| 46 <td> |
| 47 <paper-input value="{{traceCategories::input}}"></paper-input> |
| 48 </td> |
| 49 </tr> |
| 50 <template is="dom-if" if="[[computeIsAndroidBot(bot)]]"> |
| 51 <tr> |
| 52 <td><paper-checkbox checked="{{useAtrace::input}}"></paper-checkbox>
Additional atrace categories (comma-separated):</td> |
| 53 <td> |
| 54 <paper-input value="{{atraceCategories::input}}"></paper-input> |
| 55 </td> |
| 56 </tr> |
| 57 </template> |
| 58 <tr> |
| 59 <td>Start Commit:</td> |
| 60 <td><paper-input id="start_commit" type="text" value="{{startCommit:
:input}}"></paper-input></td> |
| 61 </tr> |
| 62 <tr> |
| 63 <td>End Commit:</td> |
| 64 <td><paper-input id="end_cmmit" type="text" value="{{endCommit::inpu
t}}"></paper-input></td> |
| 65 </tr> |
| 66 </table> |
| 67 </form> |
| 68 |
| 69 <p class="error">{{error}}</p> |
| 70 |
| 71 <paper-button dialog-confirm raised autofocus disabled$="[[computeHasError
(error)]]" |
| 72 on-click="onSendToTrybot">Send to Pinpoint</paper-button> |
| 73 <paper-button dialog-dismiss raised>Close</paper-button> |
| 74 |
| 75 <div id="toasts" hidden> |
| 76 <div id="jobsubmitted"> |
| 77 <b>Pinpoint Job submitted!</b> |
| 78 <a href="[[lastSubmittedJobUrl]]" |
| 79 target="_blank">View job [[lastSubmittedJobId]].</a> |
| 80 </div> |
| 81 </div> |
| 82 </paper-dialog> |
| 83 |
| 84 </template> |
| 85 <script> |
| 86 'use strict'; |
| 87 (function() { |
| 88 Polymer({ |
| 89 is: 'pinpoint-perf-job-dialog', |
| 90 properties: { |
| 91 error: { |
| 92 type: String, |
| 93 value: '', |
| 94 }, |
| 95 startCommit: { |
| 96 type: String, |
| 97 value: '', |
| 98 }, |
| 99 endCommit: { |
| 100 type: String, |
| 101 value: '', |
| 102 }, |
| 103 startRepository: { |
| 104 type: String, |
| 105 value: '', |
| 106 }, |
| 107 endRepository: { |
| 108 type: String, |
| 109 value: '', |
| 110 }, |
| 111 useTrace: { |
| 112 type: Boolean, |
| 113 }, |
| 114 useAtrace: { |
| 115 type: Boolean, |
| 116 }, |
| 117 atraceCategories: { |
| 118 type: String, |
| 119 }, |
| 120 traceCategories: { |
| 121 type: String, |
| 122 }, |
| 123 testPath: { |
| 124 type: String, |
| 125 value: '', |
| 126 }, |
| 127 xsrfToken: { |
| 128 } |
| 129 }, |
| 130 |
| 131 computeHasError: errorMessage => !!errorMessage, |
| 132 computeIsAndroidBot(bot) { |
| 133 return bot.indexOf('android') != -1; |
| 134 }, |
| 135 |
| 136 /** |
| 137 * Initializes and shows the trace form. |
| 138 */ |
| 139 show() { |
| 140 this.open(); |
| 141 |
| 142 this.atraceCategories = |
| 143 'sched,freq,gfx,view,dalvik,webview,input,disk,am,' + |
| 144 'wm,rs,binder_driver'; |
| 145 this.useAtrace = false; |
| 146 this.traceCategories = |
| 147 'toplevel,disabled-by-default-toplevel.flow'; |
| 148 this.useTrace = true; |
| 149 this.bot = this.testPath.split('/')[1]; |
| 150 }, |
| 151 |
| 152 /** |
| 153 * Makes a request to Pinpoint to perform a perf try job. |
| 154 */ |
| 155 async onSendToTrybot(event) { |
| 156 const args = []; |
| 157 if (this.useTrace) { |
| 158 args.push(['--extra-chrome-categories', this.traceCategories]); |
| 159 } |
| 160 if (this.useAtrace) { |
| 161 args.push(['--extra-atrace-categories', this.atraceCategories]); |
| 162 } |
| 163 |
| 164 const params = { |
| 165 test_path: this.testPath, |
| 166 start_commit: this.startCommit, |
| 167 end_commit: this.endCommit, |
| 168 start_repository: this.startRepository, |
| 169 end_repository: this.endRepository, |
| 170 extra_telemetry_args: args |
| 171 }; |
| 172 |
| 173 try { |
| 174 this.error = ''; |
| 175 this.create_disabled = true; |
| 176 const results = await simple_xhr.asPromise( |
| 177 '/pinpoint/new/perf_try', params); |
| 178 this.lastSubmittedJobId = results.jobId; |
| 179 this.lastSubmittedJobUrl = results.jobUrl; |
| 180 this.fire('display-toast', {'content': this.$.jobsubmitted}); |
| 181 this.close(); |
| 182 } catch (e) { |
| 183 this.error = e; |
| 184 } |
| 185 this.create_disabled = false; |
| 186 }, |
| 187 |
| 188 open() { |
| 189 this.$.container.open(); |
| 190 }, |
| 191 |
| 192 close() { |
| 193 this.$.container.close(); |
| 194 } |
| 195 }); |
| 196 })(); |
| 197 </script> |
| 198 </dom-module> |
OLD | NEW |