Mercurial > repos > public > sbplib
changeset 42:f121bf58c1b9
Added a function for easily benchmarking a Discretization.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 05 Nov 2015 16:08:57 -0800 |
parents | 910a05dcdfdf |
children | a2b95af82f68 |
files | +noname/benchmark.m |
diffstat | 1 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
diff -r 910a05dcdfdf -r f121bf58c1b9 +noname/benchmark.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/+noname/benchmark.m Thu Nov 05 16:08:57 2015 -0800 @@ -0,0 +1,28 @@ +% animate(discretization, N, time_method) +% +% Example: +% benchmark(discr,100) +% benchmark(discr,1000,'rk4') + +function hand = benchmark(discretization,N ,time_method,do_profile) + default_arg('N',100); + default_arg('time_method',[]); + + fprintf('Creating time discretization'); + tic + ts = discretization.getTimestepper(time_method); + fprintf(' - done %fs\n', toc()); + + if do_profile + profile on + end + + fprintf('Taking %d steps',N); + tic; + ts.stepN(N,true); + fprintf(' - done %fs\n', toc()); + + if do_profile + profile viewer + end +end