LCOV - code coverage report
Current view: top level - src/ftimings - ftimings_value.F90 (source / functions) Hit Total Coverage
Test: coverage_50ab7a7628bba174fc62cee3ab72b26e81f87fe5.info Lines: 12 19 63.2 %
Date: 2018-01-10 09:29:53 Functions: 2 4 50.0 %

          Line data    Source code
       1             : ! Copyright 2014 Lorenz Hüdepohl
       2             : !
       3             : ! This file is part of ftimings.
       4             : !
       5             : ! ftimings is free software: you can redistribute it and/or modify
       6             : ! it under the terms of the GNU Lesser General Public License as published by
       7             : ! the Free Software Foundation, either version 3 of the License, or
       8             : ! (at your option) any later version.
       9             : !
      10             : ! ftimings is distributed in the hope that it will be useful,
      11             : ! but WITHOUT ANY WARRANTY; without even the implied warranty of
      12             : ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13             : ! GNU Lesser General Public License for more details.
      14             : !
      15             : ! You should have received a copy of the GNU Lesser General Public License
      16             : ! along with ftimings.  If not, see <http://www.gnu.org/licenses/>.
      17             : 
      18             : #ifdef HAVE_CONFIG_H
      19             : #include "config-f90.h"
      20             : #endif
      21             : 
      22             : module ftimings_value
      23             :   use ftimings_type
      24             :   implicit none
      25             :   public
      26             : 
      27             :   type value_t
      28             :     integer(kind=C_INT64_T) :: micros = 0         ! microseconds spent in this node
      29             :     integer(kind=C_LONG) :: virtualmem = 0        ! newly created virtual memory
      30             :     integer(kind=C_LONG) :: maxrsssize = 0            ! newly used max. resident mem ("high water mark")
      31             : 
      32             :     integer(kind=C_LONG) :: rsssize = 0           ! newly used resident memory
      33             : 
      34             :     integer(kind=C_LONG_LONG) :: flop_count = 0   ! floating point operations done in this node
      35             :     integer(kind=C_LONG_LONG) :: ldst = 0         ! number of loads and stores
      36             :   end type
      37             : 
      38             :   interface operator(+)
      39             :     module procedure value_add
      40             :   end interface
      41             : 
      42             :   interface operator(-)
      43             :     module procedure value_minus
      44             :     module procedure value_inverse
      45             :   end interface
      46             : 
      47             :   type(value_t), parameter :: null_value = value_t(micros = 0, &
      48             :                                                    rsssize = 0, &
      49             :                                                    virtualmem = 0, &
      50             :                                                    maxrsssize = 0, &
      51             :                                                    flop_count = 0)
      52             : 
      53             :   contains
      54             : 
      55   471334824 :   pure elemental function value_add(a,b) result(c)
      56             :     class(value_t), intent(in) :: a, b
      57             :     type(value_t) :: c
      58   471334824 :     c%micros = a%micros + b%micros
      59   471334824 :     c%rsssize = a%rsssize + b%rsssize
      60   471334824 :     c%virtualmem = a%virtualmem + b%virtualmem
      61   471334824 :     c%maxrsssize = a%maxrsssize + b%maxrsssize
      62             : #ifdef HAVE_LIBPAPI
      63             :     c%flop_count = a%flop_count + b%flop_count
      64             :     c%ldst = a%ldst + b%ldst
      65             : #endif
      66   942669648 :   end function
      67             : 
      68   471435288 :   pure elemental function value_minus(a,b) result(c)
      69             :     class(value_t), intent(in) :: a, b
      70             :     type(value_t) :: c
      71   471435288 :     c%micros = a%micros - b%micros
      72   471435288 :     c%rsssize = a%rsssize - b%rsssize
      73   471435288 :     c%virtualmem = a%virtualmem - b%virtualmem
      74   471435288 :     c%maxrsssize = a%maxrsssize - b%maxrsssize
      75             : #ifdef HAVE_LIBPAPI
      76             :     c%flop_count = a%flop_count - b%flop_count
      77             :     c%ldst = a%ldst - b%ldst
      78             : #endif
      79   942870576 :   end function
      80             : 
      81           0 :   pure elemental function value_inverse(a) result(neg_a)
      82             :     class(value_t), intent(in) :: a
      83             :     type(value_t) :: neg_a
      84           0 :     neg_a%micros = - a%micros
      85           0 :     neg_a%rsssize = - a%rsssize
      86           0 :     neg_a%virtualmem = - a%virtualmem
      87           0 :     neg_a%maxrsssize = - a%maxrsssize
      88             : #ifdef HAVE_LIBPAPI
      89             :     neg_a%flop_count = - a%flop_count
      90             :     neg_a%ldst = - a%ldst
      91             : #endif
      92           0 :   end function
      93           0 : end module

Generated by: LCOV version 1.12