Dennis Kempin | 19e972b | 2013-06-20 13:21:38 -0700 | [diff] [blame^] | 1 | #! /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 | |
| 6 | from optparse import OptionParser |
| 7 | from mtstat import MTStat |
| 8 | |
| 9 | usage = """Multitouch Statistic Collector |
| 10 | |
| 11 | Download latest N feedback reports |
| 12 | $ %prog -d N |
| 13 | """ |
| 14 | |
| 15 | def main(): |
| 16 | parser = OptionParser(usage=usage) |
| 17 | parser.add_option('-d', |
| 18 | dest='download', default=None, |
| 19 | help='download more log files') |
| 20 | parser.add_option('-o', |
| 21 | dest='offset', default=0, |
| 22 | help='offset for downloading log files') |
| 23 | parser.add_option('-n', |
| 24 | dest='number', default=None, |
| 25 | help='number of log files to gather stats on') |
| 26 | (options, args) = parser.parse_args() |
| 27 | |
| 28 | stat = MTStat() |
| 29 | if options.download: |
| 30 | stat.Download(options.download, options.offset) |
| 31 | return |
| 32 | |
| 33 | number = None if options.number is None else int(options.number) |
| 34 | results = stat.GatherStats(number) |
| 35 | for key, value in results.items(): |
| 36 | print key, '=', value |
| 37 | |
| 38 | if __name__ == '__main__': |
| 39 | main() |