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

Side by Side Diff: tools/traceline/traceline/scripts/split.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 # Splits a single json file (read from stdin) into separate files of 40k 6 """Splits a single json file (read from stdin) into separate files of 40k
6 # records, named split.X. 7 records, named split.X.
8 """
7 9
8 import sys 10 import sys
9 11
10 filecount = 0;
11 count = 0;
12 12
13 f = open('split.0', 'wb'); 13 def main():
14 filecount = 0
15 count = 0
16 f = open('split.0', 'wb')
17 for l in sys.stdin:
18 if l == "},\r\n":
19 count += 1
20 if count == 40000:
21 f.write("}]);\r\n")
22 count = 0
23 filecount += 1
24 f = open('split.%d' % filecount, 'wb')
25 f.write("parseEvents([\r\n")
26 continue
27 f.write(l)
14 28
15 for l in sys.stdin: 29
16 if l == "},\r\n": 30 if __name__ == '__main__':
17 count += 1 31 main()
18 if count == 40000:
19 f.write("}]);\r\n")
20 count = 0;
21 filecount += 1
22 f = open('split.%d' % filecount, 'wb');
23 f.write("parseEvents([\r\n")
24 continue
25 f.write(l)
OLDNEW
« no previous file with comments | « tools/traceline/traceline/scripts/scstats.py ('k') | tools/traceline/traceline/scripts/syscalls.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698