File: print_server_data.F

package info (click to toggle)
aces3 3.0.6-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 82,460 kB
  • sloc: fortran: 225,647; ansic: 20,413; cpp: 4,349; makefile: 953; sh: 137
file content (119 lines) | stat: -rw-r--r-- 4,287 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
C  Copyright (c) 2003-2010 University of Florida
C
C  This program is free software; you can redistribute it and/or modify
C  it under the terms of the GNU General Public License as published by
C  the Free Software Foundation; either version 2 of the License, or
C  (at your option) any later version.

C  This program is distributed in the hope that it will be useful,
C  but WITHOUT ANY WARRANTY; without even the implied warranty of
C  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
C  GNU General Public License for more details.

C  The GNU General Public License is included in this distribution
C  in the file COPYRIGHT.
      subroutine print_server_data(io_company_id)
c---------------------------------------------------------------------------
c   Executed only on the master process at end of a SIAL run.  If the 
c   do_timer flag is set, we receive the accumulated server statistical
c   data from each processor in the I/O company, and print a report.
c----------------------------------------------------------------------------
      implicit none
      include 'mpif.h'
      include 'server_stat.h'
      include 'timerz.h'
      include 'machine_types.h'
      include 'parallel_info.h'
      include 'interpreter.h'

      integer io_company_id
      integer lendata, niocompany
      integer ierr
      integer status(MPI_STATUS_SIZE)
      integer i, nw
      integer next

      integer pst_get_company

c---------------------------------------------------------------------------
c   Determine the number of IOCOMPANY servers.
c---------------------------------------------------------------------------

      niocompany = 0
      do i = 1, nprocs
         if (pst_get_company(i-1) .eq. io_company_id)
     *       niocompany = niocompany + 1
      enddo

      if (niocompany .eq. 0) return
      if (.not. do_timer) return

c---------------------------------------------------------------------------
c   RECV the data into the master's common block.
c--------------------------------------------------------------------------

      lendata = 12*mx_stat_keys
      call mpi_recv(sstat_tprep, lendata, MPI_DOUBLE_PRECISION, 
     *               MPI_ANY_SOURCE,
     *               sip_server_stat_data_tag, mpi_comm_world,
     *               status, ierr) 
      lendata = 6*mx_stat_keys
      call mpi_recv(sstat_nprep, lendata, MPI_INTEGER, MPI_ANY_SOURCE,
     *               sip_server_stat_data_tag, mpi_comm_world,
     *               status, ierr)

c-----------------------------------------------------------------------------
c   Print the server report.
c-----------------------------------------------------------------------------

      print *,'              SERVER PERFORMANCE STATISTICS'
      print *,'              ------ ----------- ----------' 

      print *,'Pardo      Prepares   Preparesums   Requests  Prequests'
      do i = 1, mx_stat_keys
         if (sstat_nprep(i) .gt. 0 .or. 
     *       sstat_nprepsum(i) .gt. 0 .or.
     *       sstat_nreq(i) .gt. 0 .or.
     *       sstat_npreq(i) .gt. 0) then
            print 9000,lineno(i), sstat_nprep(i),sstat_nprepsum(i),
     *                            sstat_nreq(i), sstat_npreq(i) 
         endif
      enddo

      call c_flush_stdout()

 9000 format(1x,i6,4(4x,i8)) 
      return
      end

      subroutine get_server_stats(myline, nprep, nprepsum, nreq,
     *                            npreq)
c---------------------------------------------------------------------------
c   Return server stats for a given line number.
c---------------------------------------------------------------------------
      implicit none
      include 'server_stat.h'
      integer myline, nprep, nprepsum, nreq, npreq

      integer i

      do i = 1, mx_stat_keys
         if (lineno(i) .eq. myline) then
            nprep    = sstat_nprep(i)
            nprepsum = sstat_nprepsum(i)
            nreq     = sstat_nreq(i)
            npreq    = sstat_npreq(i)
            return
         endif
      enddo

c--------------------------------------------------------------------------
c   No data for this lineno.
c--------------------------------------------------------------------------

      nprep    = 0
      nprepsum = 0
      nreq     = 0

      return
      end