[TriLUG] a python question

R Radford rradford at mindspring.com
Mon Jan 20 20:59:48 EST 2014


You can get that much better resolution with the datetime function, like
this:

import datetime

start = datetime.datetime.now()
# Put your code to time in here
stop  = datetime.datetime.now()

delta = stop - start

print delta
print (delta.total_seconds(), delta.seconds, delta.microseconds)




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: Rodney Radford <rradford at mindspring.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/rradford%40mindspring.com
> Welcome to TriLUG: http://trilug.org/welcome
>


More information about the TriLUG mailing list