user2273009
user2273009

Reputation: 21

cProfile on a function that uses Argument Parser

I am trying to run cProfile on a Python script that uses an ArgumentParser to parse arguments given from the Command Line. Amongst the arguments, there are two file names that are used by the script for data input.

I was wondering whether I am able to provide the arguments somehow via the cProfile in order to be able to profile my functions using actual data.

Thank you very much in advance.

Upvotes: 1

Views: 5960

Answers (1)

Christian Witts
Christian Witts

Reputation: 11585

You can just pass them through on the command line like you normally would.

python -m cProfile -s time my_app.py <args>

Upvotes: 3

Related Questions