Skip to content

Commit

Permalink
Merge pull request #1689 from scrapy/remove-lsprof
Browse files Browse the repository at this point in the history
[MRG+1] Remove --lsprof command-line option.
  • Loading branch information
dangra committed Jan 20, 2016
2 parents 8fb9a6f + ff235fa commit 56b69d2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 130 deletions.
9 changes: 1 addition & 8 deletions scrapy/cmdline.py
Expand Up @@ -7,7 +7,6 @@

import scrapy
from scrapy.crawler import CrawlerProcess
from scrapy.xlib import lsprofcalltree
from scrapy.commands import ScrapyCommand
from scrapy.exceptions import UsageError
from scrapy.utils.misc import walk_modules
Expand Down Expand Up @@ -144,25 +143,19 @@ def execute(argv=None, settings=None):
sys.exit(cmd.exitcode)

def _run_command(cmd, args, opts):
if opts.profile or opts.lsprof:
if opts.profile:
_run_command_profiled(cmd, args, opts)
else:
cmd.run(args, opts)

def _run_command_profiled(cmd, args, opts):
if opts.profile:
sys.stderr.write("scrapy: writing cProfile stats to %r\n" % opts.profile)
if opts.lsprof:
sys.stderr.write("scrapy: writing lsprof stats to %r\n" % opts.lsprof)
loc = locals()
p = cProfile.Profile()
p.runctx('cmd.run(args, opts)', globals(), loc)
if opts.profile:
p.dump_stats(opts.profile)
k = lsprofcalltree.KCacheGrind(p)
if opts.lsprof:
with open(opts.lsprof, 'w') as f:
k.output(f)

if __name__ == '__main__':
execute()
2 changes: 0 additions & 2 deletions scrapy/commands/__init__.py
Expand Up @@ -65,8 +65,6 @@ def add_options(self, parser):
help="disable logging completely")
group.add_option("--profile", metavar="FILE", default=None,
help="write python cProfile stats to FILE")
group.add_option("--lsprof", metavar="FILE", default=None,
help="write lsprof profiling stats to FILE")
group.add_option("--pidfile", metavar="FILE",
help="write process ID to FILE")
group.add_option("-s", "--set", action="append", default=[], metavar="NAME=VALUE",
Expand Down
120 changes: 0 additions & 120 deletions scrapy/xlib/lsprofcalltree.py

This file was deleted.

0 comments on commit 56b69d2

Please sign in to comment.