Ask Your Question
0

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

asked 14 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 14 years ago

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
0.13

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
0.0099999999999997868

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

Preview: (hide)
link

Comments

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

ccanonc gravatar imageccanonc ( 14 years ago )

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

Stats

Asked: 14 years ago

Seen: 428 times

Last updated: Aug 29 '10