blob: 91063349b73cd7e19010c4c18ab94d1828d66405 [file] [log] [blame]
Dennis Kempin1a8a5be2013-06-18 11:00:02 -07001#! /usr/bin/env python
2# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6from mtreplay import MTReplay
7from mtlib import Log
8from optparse import OptionParser
9import sys
10
11
12usage = """Multitouch Replay Usage Examples:
13
14Replaying logs and print activity_log:
15$ %prog filename.log (from file)
16$ %prog 172.22.75.0 (from device ip address)
17$ %prog http://feedback.google.com/... (from feedback report url)
18
19Print which platform this log is replayed on:
20$ %prog log -p
21
22View gestures log
23$ %prog log -v gestures-log
24$ %prog log -vgl
25
26View evdev log
27$ %prog log -v evdev-log
28$ %prog log -vel
29
30View activity in MTEdit:
31$ %prog log -v activity
32$ %prog log -va"""
33
34
35def main(argv):
36 parser = OptionParser(usage=usage)
37 parser.add_option('-p', '--platform',
38 dest='platform', action='store_true', default=False,
39 help='print platform this log is replayed on')
40 parser.add_option('-v', '--view',
41 dest='view', default=None,
42 help='select output of relay to view')
Dennis Kempin41b3ddd2013-07-01 15:08:32 -070043 parser.add_option('--gdb',
44 dest='gdb', action='store_true', default=False,
45 help='setup gdb session to run replay')
Dennis Kempin1a8a5be2013-06-18 11:00:02 -070046 (options, args) = parser.parse_args()
47
48 replay = MTReplay()
Dennis Kempin41b3ddd2013-07-01 15:08:32 -070049 replay.Recompile()
Dennis Kempin1a8a5be2013-06-18 11:00:02 -070050
51 if len(args) != 1:
52 parser.print_help()
53 exit(-1)
54
55 log = Log(args[0])
56
57 if options.platform:
Dennis Kempin55af9cc2013-06-20 15:07:21 -070058 platform = replay.PlatformOf(log, True)
59 if platform:
60 print platform.name
Dennis Kempin1a8a5be2013-06-18 11:00:02 -070061 return
62
Dennis Kempin41b3ddd2013-07-01 15:08:32 -070063 results = replay.Replay(log, gdb=options.gdb)
Dennis Kempin55af9cc2013-06-20 15:07:21 -070064 if results:
65 results.View(options.view)
Dennis Kempin1a8a5be2013-06-18 11:00:02 -070066
67
68if __name__ == '__main__':
69 main(sys.argv)