summaryrefslogtreecommitdiffstats
path: root/tools/traceline/traceline/scripts/filter_short.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/traceline/traceline/scripts/filter_short.py')
-rwxr-xr-xtools/traceline/traceline/scripts/filter_short.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/tools/traceline/traceline/scripts/filter_short.py b/tools/traceline/traceline/scripts/filter_short.py
index 9d8466e..1b73bf9 100755
--- a/tools/traceline/traceline/scripts/filter_short.py
+++ b/tools/traceline/traceline/scripts/filter_short.py
@@ -1,14 +1,19 @@
-# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+#!/usr/bin/env python
+# Copyright (c) 2011 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.
-# This script takes an input JSON, and filters out all system call events that
-# took less than 0.2ms. This helps trim down the JSON data to only the most
-# interesting / time critical events.
+"""Takes an input JSON, and filters out all system call events that
+took less than 0.2ms.
+
+This helps trim down the JSON data to only the most interesting / time critical
+events.
+"""
import sys
import re
+
def parseEvents(z):
print 'parseEvents(['
for e in z:
@@ -20,4 +25,10 @@ def parseEvents(z):
print '%s,' % re.sub('([0-9])L\\b', '\\1', str(e))
print '])'
-execfile(sys.argv[1])
+
+def main():
+ execfile(sys.argv[1])
+
+
+if __name__ == '__main__':
+ main()