Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
fstats.h
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2.1 of the GNU Lesser General Public License 
00007   as published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU Lesser General Public 
00021   License along with this program; if not, write the Free Software 
00022   Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 
00023   USA.
00024 
00025   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00026   Mountain View, CA 94043, or:
00027 
00028   http://www.sgi.com
00029 
00030   For further information regarding this notice, see:
00031 
00032   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00033 
00034 */
00035 
00036 
00037 /* USMID @(#) libf/include/fstats.h     92.0    10/08/98 14:30:10 */
00038 
00039 
00040 #ifndef __FSTATS_H_
00041 #define __FSTATS_H_
00042   
00043 /*
00044  *      fstats.h        definitions used for Fortran I/O statistics 
00045  *                      gathering.
00046  */
00047 
00048 #if     defined(_CRAYMPP) || !defined(_UNICOS)
00049 
00050 #define FORTSTATS       0
00051 #define FSTATS_POST(_U,_IO,_FIOSP) ;
00052 
00053 #else   
00054 
00055 #define FORTSTATS       (_PSFLAGS(_PS_F_MASK))
00056                                         /* Indicate whether Fortran I/O 
00057                                          * statistics are to be gathered.  If 
00058                                          * this flag definition is altered, 
00059                                          * S@PSFORT in asdef (YMP only) must be
00060                                          * altered as well. */
00061 
00062 /*
00063  *      FSTATS_POST
00064  *
00065  *              Record statistics which have been gathered during
00066  *              a particular Fortran I/O statement.  
00067  *
00068  *              _U      - pointer to unit. 
00069  *              _IO     - I/O statement code orTF_WRITE or TF_READ
00070  *              _FIOSP  - FIOSPTR for 
00071  *
00072  */
00073 
00074 #define FSTATS_POST(_U,_IO,_FIOSP){\
00075         union stat_ntry *ft;\
00076 \
00077         if (FORTSTATS && (_U) != NULL && (ft = ((unit *)_U)->ftstat) != NULL){\
00078                 /*\
00079                  * Gather statistics if unit is open and is associated with\
00080                  * a disk file.\
00081                  */\
00082                 long  init_rt;  /* real time clock value at start of I/O */\
00083                 long  rt;\
00084                 init_rt = _FIOSP->f_rtbgn;\
00085                 rt      = _rtc() - init_rt;\
00086 \
00087                 if ((_IO) & TF_WRITE) \
00088                         POST_IT(write)\
00089                 else if ((_IO) & TF_READ)\
00090                         POST_IT(read)\
00091                 else {\
00092                         switch (_IO) {\
00093 \
00094                         case T_BUFOUT:          POST_IT(bufout)         break;\
00095                         case T_BUFIN:           POST_IT(bufin)          break;\
00096                         case T_REWIND:          POST_IT(rewind)         break;\
00097                         case T_BACKSPACE:       POST_IT(backspace)      break;\
00098                         case T_ENDFILE:         POST_IT(endfile)        break;\
00099                         case T_LENGTH:          POST_IT(length)         break;\
00100                         case T_UNIT:            POST_IT(unit)           break;\
00101                         case T_FLUSH:           POST_IT(flush)          break;\
00102                         case T_GETPOS:          POST_IT(getpos)         break;\
00103                         case T_SETPOS:          POST_IT(setpos)         break;\
00104                         case T_CLOSE:           POST_IT(close)          break;\
00105                         default:\
00106                                 break;  /* no stats gathered for other types */\
00107                         }\
00108                 }\
00109         }\
00110 }
00111 
00112 #define POST_IT(STMT) { \
00113         ft->fcls_pkt.STMT.num    += 1;\
00114         ft->fcls_pkt.STMT.rtc_tm += rt;\
00115 }
00116 #endif  /* defined(_CRAYMPP) || !defined(_UNICOS) */
00117 #endif  /* _FSTATS_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines