[TriLUG] a python question
Francois Dion
francois.dion at gmail.com
Mon Jan 20 20:59:19 EST 2014
Oh, thanks for the question, I'll post that as my next python tip.
So the first thing to know is that instrumenting a script will impact its
runtime. The best instrumentation is dtrace, and that would be the right
way to do this. But no dtrace enabled python (nor dtrace) on the raspberry
pi.
So what is the pythonic way to do this?
python -m cProfile myscript.py
And you'll get:
ncalls tottime percall cumtime percall filename:lineno(function)
Francois
On Mon, Jan 20, 2014 at 8:20 PM, Greg Brown <gwbrown1 at gmail.com> wrote:
> Hey all. The system in question is a Raspberry Pi model B running
> Raspbian. When running commands in Python I would very much like to track
> the time it takes each command to complete.
>
> Right now the commands are all separate files executed by via launched
> shells but once all the command complete I will have one big python script
> with all the commands contained within.
>
> I don't want to know how long it takes *ALL* the commands to run, I want to
> know how long it takes *EACH* command to run once they are all in one
> script. I want to capture that data and stuff it in a database for later
> use. I can't use epoch time because frequently commands complete in under
> one second.
>
> Is there a straight-forward way to accomplish this?
>
> Greg
> --
> This message was sent to: Francois Dion <francois.dion at gmail.com>
> To unsubscribe, send a blank message to trilug-leave at trilug.org from that
> address.
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> Unsubscribe or edit options on the web :
> http://www.trilug.org/mailman/options/trilug/francois.dion%40gmail.com
> Welcome to TriLUG: http://trilug.org/welcome
>
More information about the TriLUG
mailing list