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

Side by Side Diff: tools/traceline/traceline/scripts/filter_short.py

Issue 8678023: Fix python scripts in src/tools/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 4 # found in the LICENSE file.
4 5
5 # This script takes an input JSON, and filters out all system call events that 6 """Takes an input JSON, and filters out all system call events that
6 # took less than 0.2ms. This helps trim down the JSON data to only the most 7 took less than 0.2ms.
7 # interesting / time critical events. 8
9 This helps trim down the JSON data to only the most interesting / time critical
10 events.
11 """
8 12
9 import sys 13 import sys
10 import re 14 import re
11 15
16
12 def parseEvents(z): 17 def parseEvents(z):
13 print 'parseEvents([' 18 print 'parseEvents(['
14 for e in z: 19 for e in z:
15 if e.has_key('ms') and e.has_key('done'): 20 if e.has_key('ms') and e.has_key('done'):
16 dur = e['done'] - e['ms'] 21 dur = e['done'] - e['ms']
17 if dur < 0.2: 22 if dur < 0.2:
18 continue 23 continue
19 # Ugly regex to remove the L suffix on large python numbers. 24 # Ugly regex to remove the L suffix on large python numbers.
20 print '%s,' % re.sub('([0-9])L\\b', '\\1', str(e)) 25 print '%s,' % re.sub('([0-9])L\\b', '\\1', str(e))
21 print '])' 26 print '])'
22 27
23 execfile(sys.argv[1]) 28
29 def main():
30 execfile(sys.argv[1])
31
32
33 if __name__ == '__main__':
34 main()
OLDNEW
« no previous file with comments | « tools/traceline/traceline/scripts/crit_sec.py ('k') | tools/traceline/traceline/scripts/filter_split.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698