def profiler_main():
    'Manage a profiler daemon.'
    parser = _common_args()
    parser.add_argument('--action', required=True, choices=('start', 'stop', 'restart'))
    (args, _) = parser.parse_known_args()
    cfg = confpy.api.parse_options(files=(args.config,), env_prefix='PYPERF')
    proc = cfg.daemon.process(source_transport=cfg.transport.source, error_transport=cfg.transport.error, results_transport=cfg.transport.result, profiler=cfg.daemon.profiler, pidfile=cfg.daemon.pidfile)
    if (args.action == 'stop'):
        proc.stop()
    if (args.action == 'start'):
        proc.start()
    if (args.action == 'restart'):
        proc.restart()
Manage a profiler daemon.
def profiler_main():
    
    parser = _common_args()
    parser.add_argument('--action', required=True, choices=('start', 'stop', 'restart'))
    (args, _) = parser.parse_known_args()
    cfg = confpy.api.parse_options(files=(args.config,), env_prefix='PYPERF')
    proc = cfg.daemon.process(source_transport=cfg.transport.source, error_transport=cfg.transport.error, results_transport=cfg.transport.result, profiler=cfg.daemon.profiler, pidfile=cfg.daemon.pidfile)
    if (args.action == 'stop'):
        proc.stop()
    if (args.action == 'start'):
        proc.start()
    if (args.action == 'restart'):
        proc.restart()