1      Subroutine PStat_Print_Detail(handles,n_handles)
2c $Id$
3      Implicit NONE
4#include "errquit.fh"
5C
6#include "pstatP.fh"
7#include "global.fh"
8#include "msgids.fh"
9#include "mafdecls.fh"
10#include "stdio.fh"
11C
12      integer n_handles
13      integer handles(n_handles)
14      integer current_handle
15c
16C
17      Integer I, Off, N, H_Collect, I_Collect
18C
19      Call GA_Sync()
20C
21      If ( GA_NodeID() .eq. 0) then
22         Call Banner(luout, 'Detailed Performance Information', '-',
23     $   .TRUE., .TRUE., .FALSE.)
24         Write (luout, 9000)
25      EndIf
26 9000 Format(1X, 'Name', 18X, 'Node', 6X, 'Calls', 1X,
27     $     'CPU Time (s)', 2X, 'Wall Time (s)')
28C
29C     Create a local array to collect the info into
30C
31      If (.NOT. MA_Push_Get( MT_Dbl, 3*N_Handles*GA_NNodes(),
32     $     'pstat temporary', H_Collect, I_Collect) ) Call ErrQuit(
33     $     'Pstat_Print_Detail: Unable to allocate local memory', 0,
34     &       MA_ERR)
35C
36      Call DFill(3*N_Handles*GA_NNodes(), 0.0d0, Dbl_MB(I_Collect), 1)
37C
38C     Fill with our local data
39C
40      Off = 3 * GA_NodeID()
41C
42      Do I = 1, n_handles
43         current_handle = handles(i)
44         if (pstat_active(current_handle)) then
45C
46            Dbl_MB( I_Collect+Off)  =
47     $           Dble( PStat_Nr_Calls( current_handle ) )
48            Dbl_MB( I_Collect+Off+1) = PStat_Times( current_handle , 1)
49            Dbl_MB( I_Collect+Off+2) = PStat_Times( current_handle , 2)
50C
51            Off = Off + 3 * GA_NNodes()
52          endif
53      EndDo
54C
55      Call ga_DGOp(Msg_PStat_Avg, Dbl_MB(I_Collect),
56     $     3*N_Handles*GA_NNodes(), '+')
57C
58      If ( GA_NodeID() .eq. 0) then
59         Off = 0
60         Do I = 1, n_handles
61            current_handle = handles(i)
62            if (pstat_active(current_handle)) then
63C
64               Do N = 0, GA_NNodes()-1
65                  Write (luout, 9010)
66     &                 PStat_Name(current_handle), N,
67     $                 Int( Dbl_MB( I_Collect + Off )),
68     $                 Dbl_MB( I_Collect + Off + 1 ),
69     $                 Dbl_MB( I_Collect + Off + 2 )
70                  Off = Off + 3
71               EndDo
72            EndIF
73         EndDo
74         call util_flush(luout)
75      EndIf
76C
77      If ( .NOT. MA_Pop_Stack( H_Collect) ) Call ErrQuit(
78     $   'PStat_Print_Detail: unable to free memory', 0, MA_ERR)
79C
80 9010 Format(1X, A20, 1X, I5, 1X, I10, 1X, F13.3, 1X, F13.3)
81C
82      Return
83      End
84