Ask Your Question

What's a good way to track spawned time on a shared server?

asked 2010-08-29 05:02:21 +0200

ccanonc gravatar image

Sometimes I'm running more than one notebook at a time; and since %time sometimes puts almost everything into Wall Time when I'm mostly using subprocesses, the Wall Time doesn't give me a good picture of the time spent since multiple notebooks are running. How can I work around this measurement problem?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2010-08-29 15:46:25 +0200

Mike Hansen gravatar image

I think the best way to track time across subprocesses is to use the cputime command in Sage. It takes a keyword arguments subprocesses=True which will try to track the time spent in subprocesses.

sage: t = cputime(subprocesses=True);
sage: integrate(sin(log(x))^2, x)
-1/5*x*sin(2*log(x)) - 1/10*x*cos(2*log(x)) + 1/2*x
sage: cputime(subprocesses=True) - t

Compare this with the non- subprocesses=True version:

sage: t = cputime();
sage: integrate(sin(log(x))^2, x)
-1/5*x*sin(2*log(x)) - 1/10*x*cos(2*log(x)) + 1/2*x
sage: cputime() - t

This currently works by using thing cputime method on expect interface objects.

edit flag offensive delete link more


Thanks Mike! Great answer as usual. I am finding the multiprocessing and itertools python modules very useful.

ccanonc gravatar imageccanonc ( 2010-08-29 15:58:44 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2010-08-29 05:02:21 +0200

Seen: 343 times

Last updated: Aug 29 '10