From dc75cfda0363acfafbd2d3b000ff5158c8661f86 Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Sun, 13 Aug 2017 14:16:20 +0300 Subject: [PATCH] use TimerOutsputs to measure performance --- src/JuliaFEM.jl | 3 ++- src/solvers_modal.jl | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/JuliaFEM.jl b/src/JuliaFEM.jl index 354e986..e424d04 100644 --- a/src/JuliaFEM.jl +++ b/src/JuliaFEM.jl @@ -13,7 +13,8 @@ const to = TimerOutput() function print_statistics() println(to) end -export print_statistics + +export print_statistics, @timeit, to import Base: getindex, setindex!, convert, length, size, isapprox, similar, start, first, next, done, last, endof, vec, ==, +, -, *, /, haskey, copy, diff --git a/src/solvers_modal.jl b/src/solvers_modal.jl index 18c4b88..a4ca9f8 100644 --- a/src/solvers_modal.jl +++ b/src/solvers_modal.jl @@ -217,7 +217,9 @@ function (solver::Solver{Modal})(; bc_invertible=false, P=nothing, symmetric=tru info("Increment time t=$(round(solver.time, 3))") info(repeat("-", 80)) initialize!(solver) - assemble!(solver; with_mass_matrix=true) + @timeit to "assemble matrices" begin + assemble!(solver; with_mass_matrix=true) + end M, K, Kg, f = get_field_assembly(solver) if solver.properties.geometric_stiffness K += Kg @@ -297,7 +299,9 @@ function (solver::Solver{Modal})(; bc_invertible=false, P=nothing, symmetric=tru passed = false try - om2, X = eigs(K_red + sigma*I, M_red; nev=props.nev, which=props.which) + @timeit to "solve eigenvalue problem using `eigs`" begin + om2, X = eigs(K_red + sigma*I, M_red; nev=props.nev, which=props.which) + end passed = true catch info("failed to calculate eigenvalues for problem. Maybe stiffness matrix is not positive definite, checking...") @@ -350,7 +354,9 @@ function (solver::Solver{Modal})(; bc_invertible=false, P=nothing, symmetric=tru end end - update_xdmf!(solver) + @timeit to "save results to Xdmf" begin + update_xdmf!(solver) + end return true