time-profile

from ase.build import molecule
from gpaw import GPAW
atoms = molecule('H2O')
atoms.center(vacuum=3.0)
atoms.calc = GPAW(mode=dict(name='pw',
                            ecut=400),
                  xc='PBE')
energy = atoms.get_potential_energy()
$ python -m cProfile -s time h2o.py > prof.txt
$ less prof.txt
...
 ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   6622    0.441    0.000    0.441    0.000 {method 'calculate' of 'XCFunctional' objects}
   1299    0.295    0.000    0.295    0.000 {built-in method _gpaw.FFTWExecute}
      6    0.289    0.048    0.289    0.048 {built-in method _gpaw.FFTWPlan}
      1    0.280    0.280    0.280    0.280 broadcast_imports.py:1(<module>)
    665    0.208    0.000    0.208    0.000 {built-in method _gpaw.pwlfc_expand}
   1484    0.150    0.000    0.150    0.000 {built-in method _gpaw.mmm}
     84    0.124    0.001    0.124    0.001 {built-in method _gpaw.symmetrize}
29k/26k    0.094    0.000    0.148    0.000 {built-in method numpy.core._multiarray_umath.implement_array_function}
 449300    0.084    0.000    0.084    0.000 spline.py:46(__call__)
    132    0.081    0.001    0.311    0.002 lda.py:14(__call__)
     47    0.062    0.001    0.159    0.003 function_base.py:2184(_vectorize_call)
    588    0.051    0.000    0.051    0.000 {built-in method marshal.loads}
     88    0.049    0.001    0.278    0.003 pw.py:824(apply_pseudo_hamiltonian)
...

LibXC, FFTW, BLAS, NumPy, …, Python, …