コード例 #1
0
def _CreateOptionParser():
    parser = optparse.OptionParser(
        description='Record about://tracing profiles '
        'from Android browsers. See http://dev.'
        'chromium.org/developers/how-tos/trace-event-'
        'profiling-tool for detailed instructions for '
        'profiling.',
        conflict_handler='resolve')

    parser = util.get_main_options(parser)

    timed_options = optparse.OptionGroup(parser, 'Timed tracing')
    timed_options.add_option('-t',
                             '--time',
                             help='Profile for N seconds and '
                             'download the resulting trace.',
                             metavar='N',
                             type='float',
                             dest='trace_time')
    parser.add_option_group(timed_options)

    cont_options = optparse.OptionGroup(parser, 'Continuous tracing')
    cont_options.add_option('--continuous',
                            help='Profile continuously until '
                            'stopped.',
                            action='store_true')
    cont_options.add_option('--ring-buffer',
                            help='Use the trace buffer as a '
                            'ring buffer and save its contents when stopping '
                            'instead of appending events into one long trace.',
                            action='store_true')
    parser.add_option_group(cont_options)

    parser.add_option_group(flags.OutputOptions(parser))

    browsers = sorted(util.get_supported_browsers().keys())
    parser.add_option('-b',
                      '--browser',
                      help='Select among installed browsers. '
                      'One of ' + ', '.join(browsers) +
                      ', "stable" is used by '
                      'default.',
                      type='choice',
                      choices=browsers,
                      default='stable')
    parser.add_option('-v',
                      '--verbose',
                      help='Verbose logging.',
                      action='store_true')
    parser.add_option('-z',
                      '--compress',
                      help='Compress the resulting trace '
                      'with gzip. ',
                      action='store_true')

    # Add options from profile_chrome agents.
    for module in _PROFILE_CHROME_AGENT_MODULES:
        parser.add_option_group(module.add_options(parser))

    return parser
コード例 #2
0
def _CreateOptionParser():
    parser = optparse.OptionParser(
        description='Record about://tracing profiles '
        'from Android browsers startup, combined with '
        'Android systrace. See http://dev.chromium.org'
        '/developers/how-tos/trace-event-profiling-'
        'tool for detailed instructions for '
        'profiling.')
    parser.add_option(
        '--url',
        help='URL to visit on startup. Default: '
        'https://www.google.com. An empty URL launches Chrome with'
        ' a MAIN action instead of VIEW.',
        default='https://www.google.com',
        metavar='URL')
    parser.add_option('--cold',
                      help='Flush the OS page cache before starting the'
                      ' browser. Note that this require a device with root '
                      'access.',
                      default=False,
                      action='store_true')
    parser.add_option_group(flags.SystraceOptions(parser))
    parser.add_option_group(flags.OutputOptions(parser))

    browsers = sorted(profiler.GetSupportedBrowsers().keys())
    parser.add_option('-b',
                      '--browser',
                      help='Select among installed browsers. '
                      'One of ' + ', '.join(browsers) +
                      ', "stable" is used by '
                      'default.',
                      type='choice',
                      choices=browsers,
                      default='stable')
    parser.add_option('-v',
                      '--verbose',
                      help='Verbose logging.',
                      action='store_true')
    parser.add_option('-z',
                      '--compress',
                      help='Compress the resulting trace '
                      'with gzip. ',
                      action='store_true')
    parser.add_option('-t',
                      '--time',
                      help='Stops tracing after N seconds, 0 to '
                      'manually stop (startup trace ends after at most 5s).',
                      default=5,
                      metavar='N',
                      type='int')
    return parser
コード例 #3
0
ファイル: main.py プロジェクト: bopopescu/webrtc-2
def _CreateOptionParser():
    parser = optparse.OptionParser(
        description='Record about://tracing profiles '
        'from Android browsers. See http://dev.'
        'chromium.org/developers/how-tos/trace-event-'
        'profiling-tool for detailed instructions for '
        'profiling.')

    timed_options = optparse.OptionGroup(parser, 'Timed tracing')
    timed_options.add_option('-t',
                             '--time',
                             help='Profile for N seconds and '
                             'download the resulting trace.',
                             metavar='N',
                             type='float')
    parser.add_option_group(timed_options)

    cont_options = optparse.OptionGroup(parser, 'Continuous tracing')
    cont_options.add_option('--continuous',
                            help='Profile continuously until '
                            'stopped.',
                            action='store_true')
    cont_options.add_option('--ring-buffer',
                            help='Use the trace buffer as a '
                            'ring buffer and save its contents when stopping '
                            'instead of appending events into one long trace.',
                            action='store_true')
    parser.add_option_group(cont_options)

    chrome_opts = optparse.OptionGroup(parser, 'Chrome tracing options')
    chrome_opts.add_option(
        '-c',
        '--categories',
        help='Select Chrome tracing '
        'categories with comma-delimited wildcards, '
        'e.g., "*", "cat1*,-cat1a". Omit this option to trace '
        'Chrome\'s default categories. Chrome tracing can be '
        'disabled with "--categories=\'\'". Use "list" to '
        'see the available categories.',
        metavar='CHROME_CATEGORIES',
        dest='chrome_categories',
        default=_DEFAULT_CHROME_CATEGORIES)
    chrome_opts.add_option('--trace-cc',
                           help='Deprecated, use --trace-frame-viewer.',
                           action='store_true')
    chrome_opts.add_option('--trace-frame-viewer',
                           help='Enable enough trace categories for '
                           'compositor frame viewing.',
                           action='store_true')
    chrome_opts.add_option('--trace-ubercompositor',
                           help='Enable enough trace categories for '
                           'ubercompositor frame data.',
                           action='store_true')
    chrome_opts.add_option('--trace-gpu',
                           help='Enable extra trace categories '
                           'for GPU data.',
                           action='store_true')
    chrome_opts.add_option('--trace-flow',
                           help='Enable extra trace categories '
                           'for IPC message flows.',
                           action='store_true')
    chrome_opts.add_option('--trace-memory',
                           help='Enable extra trace categories '
                           'for memory profile. (tcmalloc required)',
                           action='store_true')
    chrome_opts.add_option('--trace-scheduler',
                           help='Enable extra trace '
                           'categories for scheduler state',
                           action='store_true')
    parser.add_option_group(chrome_opts)

    parser.add_option_group(flags.SystraceOptions(parser))

    if perf_controller.PerfProfilerController.IsSupported():
        perf_opts = optparse.OptionGroup(parser, 'Perf profiling options')
        perf_opts.add_option(
            '-p',
            '--perf',
            help='Capture a perf profile with '
            'the chosen comma-delimited event categories. '
            'Samples CPU cycles by default. Use "list" to see '
            'the available sample types.',
            action='callback',
            default='',
            callback=_OptionalValueCallback('cycles'),
            metavar='PERF_CATEGORIES',
            dest='perf_categories')
        parser.add_option_group(perf_opts)

    ddms_options = optparse.OptionGroup(parser, 'Java tracing')
    ddms_options.add_option('--ddms',
                            help='Trace Java execution using DDMS '
                            'sampling.',
                            action='store_true')
    parser.add_option_group(ddms_options)

    parser.add_option_group(flags.OutputOptions(parser))

    browsers = sorted(profiler.GetSupportedBrowsers().keys())
    parser.add_option('-b',
                      '--browser',
                      help='Select among installed browsers. '
                      'One of ' + ', '.join(browsers) +
                      ', "stable" is used by '
                      'default.',
                      type='choice',
                      choices=browsers,
                      default='stable')
    parser.add_option('-v',
                      '--verbose',
                      help='Verbose logging.',
                      action='store_true')
    parser.add_option('-z',
                      '--compress',
                      help='Compress the resulting trace '
                      'with gzip. ',
                      action='store_true')
    parser.add_option('-d',
                      '--device',
                      help='The Android device ID to use.'
                      'If not specified, only 0 or 1 connected devices are '
                      'supported.',
                      default=None)
    return parser