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

Unified Diff: tools/traceline/traceline/scripts/split.py

Issue 118377: Some improvements and bug fixes to traceline. (Closed)
Patch Set: for in file Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/traceline/traceline/scripts/filter_split.sh ('k') | tools/traceline/traceline/sym_resolver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/traceline/traceline/scripts/split.py
diff --git a/tools/traceline/traceline/scripts/split.py b/tools/traceline/traceline/scripts/split.py
new file mode 100755
index 0000000000000000000000000000000000000000..3e36bdfd5a438e31944e9363ab20e4ec6ff738d4
--- /dev/null
+++ b/tools/traceline/traceline/scripts/split.py
@@ -0,0 +1,25 @@
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Splits a single json file (read from stdin) into separate files of 40k
+# records, named split.X.
+
+import sys
+
+filecount = 0;
+count = 0;
+
+f = open('split.0', 'wb');
+
+for l in sys.stdin:
+ if l == "},\r\n":
+ count += 1
+ if count == 40000:
+ f.write("}]);\r\n")
+ count = 0;
+ filecount += 1
+ f = open('split.%d' % filecount, 'wb');
+ f.write("parseEvents([\r\n")
+ continue
+ f.write(l)
« no previous file with comments | « tools/traceline/traceline/scripts/filter_split.sh ('k') | tools/traceline/traceline/sym_resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698