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

Side by Side Diff: tools/perf/profile_creators/profile_safe_url_list.py

Issue 1070053004: Telemetry: Add WPR data for large profiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update profile safe url list. Created 5 years, 8 months 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
« no previous file with comments | « tools/perf/profile_creators/profile_safe_url_list.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 import json 4 import json
5 import os 5 import os
6 import random 6 import random
7 7
8 8
9 def GetShuffledSafeUrls(): 9 def GetShuffledSafeUrls():
10 """Returns a deterministic shuffling of safe urls. The profile generators 10 """Returns a deterministic shuffling of safe urls.
11 access the urls in order, and the urls are grouped by domain. The shuffling 11
12 reduces the load on external servers.""" 12 The profile generators access the urls in order, and the urls are grouped by
13 domain. The shuffling reduces the load on external servers.
14 """
13 random.seed(0) 15 random.seed(0)
14 url_list_copy = list(_GetSafeUrls()) 16 url_list_copy = list(GetSafeUrls())
15 random.shuffle(url_list_copy) 17 random.shuffle(url_list_copy)
16 return url_list_copy 18 return url_list_copy
17 19
18 20
19 def _GetSafeUrls(): 21 def GetSafeUrls():
20 """Returns a list of safe urls by loading them from a pre-generated file.""" 22 """Returns a list of safe urls by loading them from a pre-generated file."""
21 safe_url_dir = os.path.dirname(os.path.realpath(__file__)) 23 safe_url_dir = os.path.dirname(os.path.realpath(__file__))
22 safe_url_path = os.path.join(safe_url_dir, "profile_safe_url_list.json") 24 safe_url_path = os.path.join(safe_url_dir, "profile_safe_url_list.json")
23 with open(safe_url_path, 'r') as safe_url_file: 25 with open(safe_url_path, 'r') as safe_url_file:
24 return json.load(safe_url_file) 26 return json.load(safe_url_file)
OLDNEW
« no previous file with comments | « tools/perf/profile_creators/profile_safe_url_list.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698