Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: tools/telemetry/telemetry/results/page_test_results.py

Issue 731233003: Format profiler/trace files cloud url (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do not format profiler value Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import collections 5 import collections
6 import copy 6 import copy
7 import datetime 7 import datetime
8 import itertools 8 import itertools
9 import logging 9 import logging
10 import random 10 import random
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 values.append(value) 182 values.append(value)
183 return values 183 return values
184 184
185 def FindAllPageSpecificValuesNamed(self, value_name): 185 def FindAllPageSpecificValuesNamed(self, value_name):
186 values = [] 186 values = []
187 for value in self.all_page_specific_values: 187 for value in self.all_page_specific_values:
188 if value.name == value_name: 188 if value.name == value_name:
189 values.append(value) 189 values.append(value)
190 return values 190 return values
191 191
192 def FindAllTraceValues(self):
193 values = []
194 for value in self.all_page_specific_values:
195 if isinstance(value, trace.TraceValue):
196 values.append(value)
197 return values
198
192 def UploadTraceFilesToCloud(self, bucket): 199 def UploadTraceFilesToCloud(self, bucket):
193 for value in self.all_page_specific_values: 200 for value in self.FindAllTraceValues():
194 if isinstance(value, trace.TraceValue): 201 value.UploadToCloud(bucket)
195 value.UploadToCloud(bucket)
196 202
197 def UploadProfilingFilesToCloud(self, bucket): 203 def UploadProfilingFilesToCloud(self, bucket):
198 for page, file_handle_list in self._pages_to_profiling_files.iteritems(): 204 for page, file_handle_list in self._pages_to_profiling_files.iteritems():
199 for file_handle in file_handle_list: 205 for file_handle in file_handle_list:
200 remote_path = ('profiler-file-id_%s-%s%-d%s' % ( 206 remote_path = ('profiler-file-id_%s-%s%-d%s' % (
201 file_handle.id, 207 file_handle.id,
202 datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S'), 208 datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S'),
203 random.randint(1, 100000), 209 random.randint(1, 100000),
204 file_handle.extension)) 210 file_handle.extension))
205 try: 211 try:
206 cloud_url = cloud_storage.Insert( 212 cloud_url = cloud_storage.Insert(
207 bucket, remote_path, file_handle.GetAbsPath()) 213 bucket, remote_path, file_handle.GetAbsPath())
208 sys.stderr.write( 214 sys.stderr.write(
209 'View generated profiler files online at %s for page %s\n' % 215 'View generated profiler files online at %s for page %s\n' %
210 (cloud_url, page.display_name)) 216 (cloud_url, page.display_name))
211 self._pages_to_profiling_files_cloud_url[page].append(cloud_url) 217 self._pages_to_profiling_files_cloud_url[page].append(cloud_url)
212 except cloud_storage.PermissionError as e: 218 except cloud_storage.PermissionError as e:
213 logging.error('Cannot upload profiling files to cloud storage due to ' 219 logging.error('Cannot upload profiling files to cloud storage due to '
214 ' permission error: %s' % e.message) 220 ' permission error: %s' % e.message)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698