How could I know the analysis time?

Forum for OpenSees users to post questions, comments, etc. on the use of the OpenSees interpreter, OpenSees.exe

Moderators: silvia, selimgunay, Moderators

Post Reply
linguan118
Posts: 140
Joined: Sun Oct 03, 2010 11:36 pm
Location: Hong Kong

How could I know the analysis time?

Post by linguan118 »

Is there a command in OpenSees to capture the analysis time?
For instance, in Matlab, I can use
tic
...
toc

Thank you very much!
Research Assistant Professor, The Hong Kong Polytechnic University
guanlin@polyu.edu.hk
linguan118
Posts: 140
Joined: Sun Oct 03, 2010 11:36 pm
Location: Hong Kong

Re: How could I know the analysis time?

Post by linguan118 »

No body knows?
Research Assistant Professor, The Hong Kong Polytechnic University
guanlin@polyu.edu.hk
evxjr
Posts: 20
Joined: Mon Nov 01, 2010 4:13 am
Location: University of Nottingham

Re: How could I know the analysis time?

Post by evxjr »

If you want to know the time taken to evaluate a section of code you can use the time command

time {
# Enter code here
} $count; If you specify a number here it will run the above code that many times and average result. Default is 1.

Alternatively a better method for bigger projects is to compare the clock times before and after. So could do it like:

set time1 [clock clicks -milliseconds]

# Enter all code here

set time2 [clock clicks -milliseconds]

puts "Elapsed time is [expr $time2-$time1] milliseconds or [expr ($time2-$time1)/1000] seconds"

Hope that helpful
linguan118
Posts: 140
Joined: Sun Oct 03, 2010 11:36 pm
Location: Hong Kong

Re: How could I know the analysis time?

Post by linguan118 »

evxjr wrote:
> If you want to know the time taken to evaluate a section of code you can
> use the time command
>
> time {
> # Enter code here
> } $count; If you specify a number here it will run the above code
> that many times and average result. Default is 1.
>
> Alternatively a better method for bigger projects is to compare the clock
> times before and after. So could do it like:
>
> set time1 [clock clicks -milliseconds]
>
> # Enter all code here
>
> set time2 [clock clicks -milliseconds]
>
> puts "Elapsed time is [expr $time2-$time1] milliseconds or [expr
> ($time2-$time1)/1000] seconds"
>
> Hope that helpful

Thank you so much!
Research Assistant Professor, The Hong Kong Polytechnic University
guanlin@polyu.edu.hk
Post Reply