From cd06c38d65b5fd07b680f73951bbf9c6d2c47ce1 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Tue, 9 Mar 1999 16:00:07 -0500 Subject: [svn-r1123] Updates for bug fixes and new entry points in files from src directory. --- pablo/HDF5record_RT.h | 78 --- pablo/HDFentries.txt | 520 +++++--------- pablo/Makefile.in | 46 +- pablo/PabloHDF.c | 1585 ------------------------------------------- pablo/PabloHDF5.c | 1807 +++++++++++++++++++++++++++++++++++++++++++++++++ pablo/PabloHDF_RT.c | 66 +- pablo/PabloHDF_SDDF.c | 127 ++-- pablo/ProcIDs.h | 118 ++-- pablo/ProcTrace.h | 198 ++++++ 9 files changed, 2396 insertions(+), 2149 deletions(-) delete mode 100644 pablo/PabloHDF.c create mode 100644 pablo/PabloHDF5.c create mode 100644 pablo/ProcTrace.h diff --git a/pablo/HDF5record_RT.h b/pablo/HDF5record_RT.h index d86871e..f3bbe4e 100644 --- a/pablo/HDF5record_RT.h +++ b/pablo/HDF5record_RT.h @@ -167,84 +167,6 @@ typedef struct fileRec { int getHDFFieldIndex( int eventID ); int getHDFByteFieldIndex( int eventID ); -#define IOerrorID 700000 - -#define openBeginID 700001 -#define openEndID 700002 - -#define fopenBeginID 700003 -#define fopenEndID 700004 - -#define closeBeginID 700005 -#define closeEndID 700006 - -#define fcloseBeginID 700007 -#define fcloseEndID 700008 - -#define readBeginID 700009 -#define readEndID 700010 - -#define freadBeginID 700011 -#define freadEndID 700012 - -#define lseekBeginID 700013 -#define lseekEndID 700014 - -#define fseekBeginID 700015 -#define fseekEndID 700016 - -#define writeBeginID 700017 -#define writeEndID 700018 - -#define fwriteBeginID 700019 -#define fwriteEndID 700020 - -#define fflushBeginID 700021 -#define fflushEndID 700022 - -#define flushBeginID 700023 -#define flushEndID 700024 - -#define rewindBeginID 700025 -#define rewindEndID 700026 - -#define fsetposBeginID 700027 -#define fsetposEndID 700028 - -#define lifetimeID 700040 -#define timeSummaryID 700041 -#define regionSummaryID 700042 - -#define IOinitTraceID 700100 -#define IOendTraceID 700101 -#define IOenableTraceID 700102 -#define IOdisableTraceID 700103 -#define IOenableDetailID 700104 -#define IOdisableDetailID 700105 -#define IOenableLifeSummID 700106 -#define IOdisableLifeSummID 700107 -#define IOenableTimeSummID 700108 -#define IOdisableTimeSummID 700109 -#define IOchangeTimeWindowID 700110 -#define IOenableRegionSummID 700111 -#define IOdisableRegionSummID 700112 -#define IOchangeFileRegionID 700113 - -/* - * Define the masks for the I/O event families, - */ -#define FAMILY_OPEN 0500 -#define FAMILY_FLUSH 0510 -#define FAMILY_CLOSE 0520 -#define FAMILY_READ 0530 -#define FAMILY_SEEK 0540 -#define FAMILY_WRITE 0550 -#define FAMILY_LIFETIME 0560 -#define FAMILY_TIME_SUMMARY 0570 -#define FAMILY_REGION_SUMMARY 0600 -#define FAMILY_IOTRACE_STATE 0610 -#define FAMILY_IO_MISC 0620 - /* * Define flags to distinguish misc i/o begin from misc i/o end */ diff --git a/pablo/HDFentries.txt b/pablo/HDFentries.txt index adca079..9892628 100644 --- a/pablo/HDFentries.txt +++ b/pablo/HDFentries.txt @@ -1,138 +1,137 @@ -ANannlen -ANannlist -ANcreate -ANcreatef -ANend -ANendaccess -ANfileinfo -ANnumann -ANreadann -ANselect -ANstart -ANwriteann -DAcreate_array -DAdel_elem -DAdestroy_array -DAget_elem -DAset_elem -DAsize_array -DF24addimage -DF24getdims -DF24getimage -DF24lastref -DF24nimages -DF24putimage -DF24readref -DF24reqil -DF24restart -DF24setcompress -DF24setdims -DF24setil -DFANaddfds -DFANaddfid -DFANclear -DFANgetdesc -DFANgetdesclen -DFANgetfds -DFANgetfdslen -DFANgetfid -DFANgetfidlen -DFANgetlabel -DFANgetlablen -DFANlablist -DFANlastref -DFANputdesc -DFANputlabel -DFPaddpal -DFPgetpal -DFPlastref -DFPnpals -DFPputpal -DFPreadref -DFPrestart -DFPwriteref -DFR8Istart -DFR8addimage -DFR8getdims -DFR8getimage -DFR8lastref -DFR8nimages -DFR8putimage -DFR8readref -DFR8restart -DFR8setcompress -DFR8setpalette -DFR8writeref -DFSDadddata -DFSDclear -DFSDendslab -DFSDendslice -DFSDgetNT -DFSDgetcal -DFSDgetdata -DFSDgetdatalen -DFSDgetdatastrs -DFSDgetdimlen -DFSDgetdims -DFSDgetdimscale -DFSDgetdimstrs -DFSDgetfillvalue -DFSDgetrange -DFSDgetslice -DFSDlastref -DFSDndatasets -DFSDpre32sdg -DFSDputdata -DFSDputslice -DFSDreadref -DFSDreadslab -DFSDrestart -DFSDsetNT -DFSDsetcal -DFSDsetdatastrs -DFSDsetdims -DFSDsetdimscale -DFSDsetdimstrs -DFSDsetfillvalue -DFSDsetlengths -DFSDsetrange -DFSDstartslab -DFSDstartslice -DFSDwriteref -DFSDwriteslab -GRattrinfo -GRcreate -GRdiminfo -GRend -GRendaccess -GRfileinfo -GRfindattr -GRgetattr -GRgetchunkinfo -GRgetdimid -GRgetiminfo -GRgetlutid -GRgetlutinfo -GRidtoref -GRluttoref -GRnametoindex -GRreadimage -GRreadlut -GRreftoindex -GRreqimageil -GRreqlutil -GRselect -GRsetaccesstype -GRsetattr -GRsetchunk -GRsetchunkcache -GRsetcompress -GRsetdimname -GRsetexternalfile -GRstart -GRwriteimage -GRwritelut -H5AC_create +H5I_debug +H5F_flush_all +H5F_close_all +H5S_none_select_serialize +H5S_none_select_deserialize +H5T_conv_enum_init +H5T_conv_enum +H5T_conv_schar_uchar +H5T_conv_uchar_schar +H5T_conv_schar_short +H5T_conv_schar_ushort +H5T_conv_uchar_short +H5T_conv_uchar_ushort +H5T_conv_schar_int +H5T_conv_schar_uint +H5T_conv_uchar_int +H5T_conv_uchar_uint +H5T_conv_schar_long +H5T_conv_schar_ulong +H5T_conv_uchar_long +H5T_conv_uchar_ulong +H5T_conv_schar_llong +H5T_conv_schar_ullong +H5T_conv_uchar_llong +H5T_conv_uchar_ullong +H5T_conv_short_schar +H5T_conv_short_uchar +H5T_conv_ushort_schar +H5T_conv_ushort_uchar +H5T_conv_short_ushort +H5T_conv_ushort_short +H5T_conv_short_int +H5T_conv_short_uint +H5T_conv_ushort_int +H5T_conv_ushort_uint +H5T_conv_short_long +H5T_conv_short_ulong +H5T_conv_ushort_long +H5T_conv_ushort_ulong +H5T_conv_short_llong +H5T_conv_short_ullong +H5T_conv_ushort_llong +H5T_conv_ushort_ullong +H5T_conv_int_schar +H5T_conv_int_uchar +H5T_conv_uint_schar +H5T_conv_uint_uchar +H5T_conv_int_short +H5T_conv_int_ushort +H5T_conv_uint_short +H5T_conv_uint_ushort +H5T_conv_int_uint +H5T_conv_uint_int +H5T_conv_int_long +H5T_conv_int_ulong +H5T_conv_uint_long +H5T_conv_uint_ulong +H5T_conv_int_llong +H5T_conv_int_ullong +H5T_conv_uint_llong +H5T_conv_uint_ullong +H5T_conv_long_schar +H5T_conv_long_uchar +H5T_conv_ulong_schar +H5T_conv_ulong_uchar +H5T_conv_long_short +H5T_conv_long_ushort +H5T_conv_ulong_short +H5T_conv_ulong_ushort +H5T_conv_long_int +H5T_conv_long_uint +H5T_conv_ulong_int +H5T_conv_ulong_uint +H5T_conv_long_ulong +H5T_conv_ulong_long +H5T_conv_long_llong +H5T_conv_long_ullong +H5T_conv_ulong_llong +H5T_conv_ulong_ullong +H5T_conv_llong_schar +H5T_conv_llong_uchar +H5T_conv_ullong_schar +H5T_conv_ullong_uchar +H5T_conv_llong_short +H5T_conv_llong_ushort +H5T_conv_ullong_short +H5T_conv_ullong_ushort +H5T_conv_llong_int +H5T_conv_llong_uint +H5T_conv_ullong_int +H5T_conv_ullong_uint +H5T_conv_llong_long +H5T_conv_llong_ulong +H5T_conv_ullong_long +H5T_conv_ullong_ulong +H5T_conv_llong_ullong +H5T_conv_ullong_llong +H5Tset_precision +H5Tenum_create +H5Tenum_insert +H5Tget_super +H5Tget_member_value +H5Tenum_nameof +H5Tenum_valueof +H5Tregister +H5T_isa +H5T_set_size +H5T_set_precision +H5T_set_offset +H5T_struct_insert +H5T_sort_value +H5T_sort_name +H5T_enum_insert +H5T_enum_nameof +H5T_enum_valueof +H5T_convert +H5T_print_stats +H5S_select_elements +H5S_select_all +H5S_select_none +H5S_select_serial_size +H5S_select_serialize +H5S_select_deserialize +H5S_point_select_serial_size +H5S_point_select_serialize +H5S_point_select_deserialize +H5S_hyper_node_release +H5S_hyper_select_serial_size +H5S_hyper_select_serialize +H5S_hyper_select_deserialize +H5S_all_select_deserialize +H5S_all_select_serialize +H5RA_isa +H5Pset_gc_references H5AC_debug H5AC_dest H5AC_find @@ -140,6 +139,7 @@ H5AC_flush H5AC_protect H5AC_rename H5AC_set +H5AC_create H5AC_unprotect H5A_close H5A_copy @@ -185,8 +185,7 @@ H5D_get_file H5D_get_space H5D_init_interface H5D_init_storage -H5D_isa -H5D_new +H5D_new H5D_open H5D_open_oid H5D_read @@ -318,12 +317,10 @@ H5G_ent_modified H5G_find H5G_get_comment H5G_get_objinfo -H5G_get_type H5G_getcwg H5G_init_interface H5G_insert H5G_insertion_file -H5G_isa H5G_link H5G_linkval H5G_loc @@ -345,7 +342,6 @@ H5G_node_remove H5G_open H5G_pop H5G_push -H5G_register_type H5G_reopen H5G_rootof H5G_set @@ -445,15 +441,14 @@ H5O_efl_reset H5O_efl_size H5O_efl_total_size H5O_efl_write -H5O_exists -H5O_fill_convert -H5O_fill_copy -H5O_fill_debug +H5O_find_in_ohdr H5O_fill_decode H5O_fill_encode -H5O_fill_reset +H5O_fill_copy H5O_fill_size -H5O_find_in_ohdr +H5O_fill_reset +H5O_fill_debug +H5O_fill_convert H5O_flush H5O_free H5O_init_interface @@ -510,6 +505,9 @@ H5P_copy H5P_create H5P_get_class H5P_init_interface +H5PC_Signal_right_neighbor +H5PC_Wait_for_left_neighbor +H5PC_Wait_for_right_neighbor H5Pclose H5Pcopy H5Pcreate @@ -561,19 +559,6 @@ H5Pset_stdio H5Pset_sym_k H5Pset_userblock H5Pset_xfer -H5RA_close -H5RA_create -H5RA_fix_overflow -H5RA_init_interface -H5RA_isa -H5RA_open -H5RA_read -H5RA_write -H5RAclose -H5RAcreate -H5RAopen -H5RAread -H5RAwrite H5R_close H5R_create H5R_dereference @@ -590,6 +575,18 @@ H5Rget_region H5Ropen H5Rread H5Rwrite +H5RAcreate +H5RA_create +H5RAopen +H5RA_open +H5RAclose +H5RA_close +H5RA_init_interface +H5RAwrite +H5RA_write +H5RA_fix_overflow +H5RAread +H5RA_read H5S_all_favail H5S_all_fgath H5S_all_fscat @@ -716,7 +713,6 @@ H5T_init H5T_init_interface H5T_insert H5T_is_atomic -H5T_isa H5T_lock H5T_open H5T_pack @@ -794,201 +790,9 @@ H5_init_thread H5dont_atexit H5get_libversion H5open -HAatom_group -HAatom_object -HAdestroy_group -HAinit_group -HAregister_atom -HAremove_atom -HAsearch_atom -HDFnewentry -HDdont_atexit -HDreuse_tagref -HEclear -HEprint -HEpush -HEreport -HEstring -HIbitstart -HIstart -HLconvert -HLcreate -HMCPchunkread -HMCPchunkwrite -HMCPendaccess -HMCPinfo -HMCPinquire -HMCPread -HMCPseek -HMCPstread -HMCPstwrite -HMCPwrite -HMCcreate -HMCreadChunk -HMCsetMaxcache -HMCwriteChunk -HPregister_term_func -HULadd_node -HULcreate_list -HULdestroy_list -HULfirst_node -HULnext_node -HULremove_node -HULsearch_node -HXcreate -HXsetcreatedir -HXsetdir -Happendable -Hcache -Hclose -Hdeldd -Hdupdd -Hendaccess -Hexist -Hfidinquire -Hfind -Hgetelement -Hgetfileversion -Hgetlibversion -Hinquire -Hisappendable -Hishdf -Hlength -Hnewref -Hnextread -Hnumber -Hoffset -Hopen -Hputelement -Hread -Hseek -Hsetaccesstype -Hsetlength -Hstartaccess -Hstartread -Hstartwrite -Hsync -Htagnewref -Htell -Htrunc -Hwrite -SDattrinfo -SDcheckempty -SDcreate -SDdiminfo -SDend -SDendaccess -SDfileinfo -SDfindattr -SDgetcal -SDgetchunkinfo -SDgetdatastrs -SDgetdimid -SDgetdimscale -SDgetdimstrs -SDgetfillvalue -SDgetinfo -SDgetrange -SDidtoref -SDiscoordvar -SDisdimval_bwcomp -SDisrecord -SDnametoindex -SDreadattr -SDreadchunk -SDreaddata -SDreftoindex -SDselect -SDsetaccesstype -SDsetattr -SDsetblocksize -SDsetcal -SDsetchunk -SDsetchunkcache -SDsetcompress -SDsetdatastrs -SDsetdimname -SDsetdimscale -SDsetdimstrs -SDsetdimval_comp -SDsetexternalfile -SDsetfillmode -SDsetfillvalue -SDsetnbitdataset -SDsetrag -SDsetrange -SDstart -SDwritechunk -SDwritedata -VFfieldesize -VFfieldisize -VFfieldname -VFfieldorder -VFfieldtype -VFnfields -VHmakegroup -VHstoredata -VHstoredatam -VSappendable -VSattach -VSattrinfo -VSdelete -VSdetach -VSelts -VSfdefine -VSfexist -VSfind -VSfindattr -VSfindclass -VSfindex -VSfnattrs -VSfpack -VSgetattr -VSgetclass -VSgetfields -VSgetid -VSgetinterlace -VSgetname -VSinquire -VSisattr -VSlone -VSnattrs -VSread -VSseek -VSsetattr -VSsetclass -VSsetfields -VSsetinterlace -VSsetname -VSsizeof -VSwrite -Vaddtagref -Vattach -Vattrinfo -Vdeletetagref -Vdetach -Vfind -Vfindattr -Vfindclass -Vfinish -Vgetattr -Vgetclass -Vgetid -Vgetname -Vgettagref -Vgettagrefs -Vgetversion -Vinitialize -Vinqtagref -Vinquire -Vinsert -Vlone -Vnattrs -Vntagrefs -Vsetattr -Vsetclass -Vsetname -vpackvg -vpackvs -vunpackvg -vunpackvs +H5D_isa +H5F_init +H5G_register_type +H5G_isa +H5G_get_type +H5O_exists diff --git a/pablo/Makefile.in b/pablo/Makefile.in index 8091ae4..9a2a458 100644 --- a/pablo/Makefile.in +++ b/pablo/Makefile.in @@ -29,9 +29,9 @@ LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5D.c H5E.c H5F.c H5Farray.c H5Fcore.c \ H5Fstdio.c H5G.c H5Gent.c H5Gnode.c H5Gstab.c H5HG.c H5HL.c H5I.c H5MF.c \ H5MM.c H5O.c H5Oattr.c H5Ocomp.c H5Ocont.c H5Odtype.c H5Oefl.c H5Ofill.c \ H5Olayout.c H5Omtime.c H5Oname.c H5Onull.c H5Osdspace.c H5Oshared.c \ - H5Ostab.c H5P.c H5R.c H5RA.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Spoint.c \ - H5Sselect.c H5T.c H5Tbit.c H5Tconv.c H5Tinit.c H5TB.c H5V.c H5Z.c \ - PabloHDF.c PabloHDF_RT.c PabloHDF_SDDF.c + H5Ostab.c H5P.c H5R.c H5RA.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c \ + H5Snone.c H5Spoint.c H5Sselect.c H5T.c H5Tbit.c H5Tconv.c H5Tinit.c \ + H5TB.c H5V.c H5Z.c PabloHDF5.c PabloHDF_RT.c PabloHDF_SDDF.c LIB_OBJ=$(LIB_SRC:.c=.o) @@ -53,8 +53,8 @@ PRIVATE_HDR=H5private.h H5Aprivate.h H5Apkg.h H5ACprivate.h H5Bprivate.h \ H5Tprivate.h H5TBprivate.h H5Tpkg.h H5Vprivate.h H5Zprivate.h # Number format detection -H5Tinit.c: ../src/H5detect - $(RUNTEST) ../src/H5detect >H5Tinit.c +H5Tinit.c: ../src/H5Tinit.c + cp ../src/H5Tinit.c . #------------------------------------------------------------- -*- makefile -*- # The following section of this makefile comes from the @@ -138,9 +138,10 @@ maintainer-clean: distclean .c.o: $(CC) $(CFLAGS) $(CPPFLAGS) -c ../src/$*.c -PABLO_INCLUDES = HDFentryNames.h HDFidList.h HDF5record_RT.h ProcIDs.h +PABLO_INCLUDES = HDFentryNames.h HDFidList.h HDF5record_RT.h ProcIDs.h \ + ProcTrace.h -PabloHDF.o: PabloHDF.c $(PABLO_INCLUDES) +PabloHDF5.o: PabloHDF5.c $(PABLO_INCLUDES) $(CC) $(CFLAGS) $(CPPFLAGS) -c $< PabloHDF_RT.o: PabloHDF_RT.c $(PABLO_INCLUDES) @@ -150,10 +151,10 @@ PabloHDF_SDDF.o: PabloHDF_SDDF.c $(PABLO_INCLUDES) $(CC) $(CFLAGS) $(CPPFLAGS) -c $< HDFentryNames.h: HDFentries.txt - sed "s/.*/\"&\",/" $? > $@ + sort $? | sed "s/.*/\"&\",/" > $@ HDFidList.h: HDFentries.txt - sed "s/.*/ID_&,/" $? > $@ + sort $? | sed "s/.*/ID_&,/" > $@ #------------------------------------------------------------------------------ # The following section of this makefile contains dependencies between the @@ -1250,6 +1251,33 @@ HDFidList.h \ ../src/H5HGpublic.h \ ../src/H5Tprivate.h \ ../src/H5Tpublic.h +H5Snone.c: ../src/H5Snone.c +H5Snone.o: \ +H5Snone.c \ +ProcIDs.h \ +HDFidList.h \ +../src/H5private.h \ +../src/H5public.h \ +../src/H5config.h \ +../src/H5api_adpt.h \ +../src/H5Eprivate.h \ +../src/H5Epublic.h \ +../src/H5Ipublic.h \ +../src/H5Sprivate.h \ +../src/H5Spublic.h \ +../src/H5Fprivate.h \ +../src/H5Fpublic.h \ +../src/H5Dpublic.h \ +../src/H5Gprivate.h \ +../src/H5Gpublic.h \ +../src/H5Bprivate.h \ +../src/H5Bpublic.h \ +../src/H5Oprivate.h \ +../src/H5Opublic.h \ +../src/H5HGprivate.h \ +../src/H5HGpublic.h \ +../src/H5Tprivate.h \ +../src/H5Tpublic.h H5Spoint.c: ../src/H5Spoint.c H5Spoint.o: \ H5Spoint.c \ diff --git a/pablo/PabloHDF.c b/pablo/PabloHDF.c deleted file mode 100644 index cba0c87..0000000 --- a/pablo/PabloHDF.c +++ /dev/null @@ -1,1585 +0,0 @@ -/* This file is part of the Pablo Performance Analysis Environment -// -// (R) -// The Pablo Performance Analysis Environment software is NOT in -// the public domain. However, it is freely available without fee for -// education, research, and non-profit purposes. By obtaining copies -// of this and other files that comprise the Pablo Performance Analysis -// Environment, you, the Licensee, agree to abide by the following -// conditions and understandings with respect to the copyrighted software: -// -// 1. The software is copyrighted in the name of the Board of Trustees -// of the University of Illinois (UI), and ownership of the software -// remains with the UI. -// -// 2. Permission to use, copy, and modify this software and its documentation -// for education, research, and non-profit purposes is hereby granted -// to Licensee, provided that the copyright notice, the original author's -// names and unit identification, and this permission notice appear on -// all such copies, and that no charge be made for such copies. Any -// entity desiring permission to incorporate this software into commercial -// products should contact: -// -// Professor Daniel A. Reed reed@cs.uiuc.edu -// University of Illinois -// Department of Computer Science -// 2413 Digital Computer Laboratory -// 1304 West Springfield Avenue -// Urbana, Illinois 61801 -// USA -// -// 3. Licensee may not use the name, logo, or any other symbol of the UI -// nor the names of any of its employees nor any adaptation thereof in -// advertizing or publicity pertaining to the software without specific -// prior written approval of the UI. -// -// 4. THE UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE -// SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS -// OR IMPLIED WARRANTY. -// -// 5. The UI shall not be liable for any damages suffered by Licensee from -// the use of this software. -// -// 6. The software was developed under agreements between the UI and the -// Federal Government which entitle the Government to certain rights. -// -// ************************************************************************* -// -// Developed by: The Pablo Research Group -// University of Illinois at Urbana-Champaign -// Department of Computer Science -// 1304 W. Springfield Avenue -// Urbana, IL 61801 -// -// http://www-pablo.cs.uiuc.edu -// -// Send comments to: pablo-feedback@guitar.cs.uiuc.edu -// -// Copyright (c) 1987-1998 -// The University of Illinois Board of Trustees. -// All Rights Reserved. -// -// PABLO is a registered trademark of -// The Board of Trustees of the University of Illinois -// registered in the U.S. Patent and Trademark Office. -// -// Project Manager and Principal Investigator: -// Daniel A. Reed (reed@cs.uiuc.edu) -// -// Funded in part by the Defense Advanced Research Projects Agency under -// DARPA contracts DABT63-94-C0049 (SIO Initiative), F30602-96-C-0161, -// and DABT63-96-C-0027 by the National Science Foundation under the PACI -// program and grants NSF CDA 94-01124 and ASC 97-20202, and by the -// Department of Energy under contracts DOE B-341494, W-7405-ENG-48, and -// 1-B-333164. -//========================================================================*/ - -#include -#include -#include -#ifndef fileno -int fileno ( FILE * ); -#endif -/* on ipsc/860 don't include this or you'll get multiply defined SEEK_* */ -#ifndef __NX -#include -#endif - - -#define HDFtrace3OPEN__ -int HDFtrace3OPEN( const char *, int, mode_t ); - -#include "SDDFparam.h" -#include "TraceParam.h" - -#include "SystemDepend.h" -#include "Trace.h" - -#include "IO_TraceParams.h" -#include "HDFIOTrace.h" - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -/* mode_t is not defined on the ipsc/860 so we define it here */ -#ifdef __NX -typedef unsigned int mode_t; -#endif - -int OUTPUT_SWITCH; -extern void preInitIOTrace( void ); - -#include "ProcIDs.h" -#include "HDF5Trace.h" -#include "IOTrace.h" - -#ifdef HAVE_PARALLEL -#include "mpio.h" -#include "MPIO_Init.h" -#include "MPIO_EventArgs.h" -#include "MPIO_TraceParams.h" -#include "HDFmpioProtos.h" -#endif /* HAVE_PARALLEL*/ - -#define NO_OUTPUT 0 -#define SDDF_OUTPUT 1 -#define RT_OUTPUT 2 -void HDFinitTrace_RT ( const char *, unsigned int ); -void HDFinitTrace_SDDF ( const char *, unsigned int ); -void hinittracex_ ( int [], int *, unsigned *, int * ); -void hdfendtrace_ ( void ) ; -void HDFendTrace (void); -void HDFendTrace_RT (void); -void HDFendTrace_SDDF(void); -void HDFfinalTimeStamp( void ); -void startHDFtraceEvent (int ); -int computeProcMask (int eventID); -int computePacketTag(int eventID); -void endHDFtraceEvent (int , int , char *, int ); -void traceEvent ( int , char *, unsigned ); -void HDFtraceEvent_RT ( int , HDFsetInfo *, unsigned ); -void HDFtraceIOEvent( int , void *, unsigned ); -uint procTrace; -extern int IOtracingEnabled; -char *hdfRecordPointer; -/*======================================================================* -// NAME * -// HDFinitTrace -- initialize HDF tracing * -// USAGE * -// VOID HDFinitTrace( traceFileName, procTraceMask, out_sw ) * -// char *traceFileName; IN: name of the generated trace output * -// file * -// uint32 procTraceMask; IN: families of procedures to trace * -// int out_sw IN: indicates whether to produce SDDF * -// file or Final Summary * -// RETURNS * -// None. * -//======================================================================*/ -/*======================================================================* -// fortran to C interface. To insure portability, the character array * -// passed in Fortran is converted to an integer array using the ICHAR * -// function. This program converts it from integer to char, then * -// passes it to the C initialization routine. * -//======================================================================*/ -void hinittracex_( int *file, int *len, unsigned *procMask, int *out_sw ) -{ - char *fileName; - int i; - fileName = (char *)malloc(*len+1); - for ( i = 0; i < *len; ++i ) { - fileName[i] = file[i]; - } - fileName[*len+1] = 0; - HDFinitTrace ( fileName, *procMask, *out_sw ); -} -void HDFinitTrace( const char *traceFileName, unsigned procTraceMask, - unsigned out_sw ) -{ - OUTPUT_SWITCH = out_sw; - if ( out_sw == SDDF_OUTPUT ) { - HDFinitTrace_SDDF( traceFileName, procTraceMask ); - IOtracingEnabled = 1; - } else if ( out_sw == RT_OUTPUT ) { - HDFinitTrace_RT( traceFileName, procTraceMask ); - IOtracingEnabled = 1; - } else if ( out_sw == NO_OUTPUT ) { - procTrace = 0; - IOtracingEnabled = 0; - } else { - fprintf(stderr,">> Error in HDFinitTrace: the third argument "); - fprintf(stderr,"must have the value 0, 1, <<<\n"); - fprintf(stderr,">> or 2. The value received was %u.", out_sw); - fprintf(stderr," Exiting program. <<<\n"); - exit (-1); - } -} -/*======================================================================* -// NAME * -// HDFendTrace -- end HDF tracing * -// USAGE * -// VOID HDFendTrace(VOID) * -// RETURNS * -// None. * -//======================================================================*/ -void hdfendtrace_( void ) -{ - HDFendTrace (); -} -void HDFendTrace(void) -{ - if ( OUTPUT_SWITCH == SDDF_OUTPUT ) { - HDFendTrace_SDDF( ); - } else if ( OUTPUT_SWITCH == RT_OUTPUT ) { - HDFendTrace_RT( ); - } - procTrace = 0; -} -void startHDFtraceEvent(int eventID) -{ - if ( OUTPUT_SWITCH == SDDF_OUTPUT ) { - traceEvent( eventID, NULL, 0 ) ; - } else { - HDFtraceEvent_RT( eventID, NULL, 0 ) ; - } -} -void endHDFtraceEvent(int eventID, int setID, char *setName, int IDtype ) -{ - HDFsetInfo info; - info.setID = setID; - info.setName = setName; - if ( OUTPUT_SWITCH == SDDF_OUTPUT ) { - traceEvent( eventID, (char *)&info, 0 ) ; - } else if (OUTPUT_SWITCH == RT_OUTPUT ) { - HDFtraceEvent_RT( eventID, &info, 0 ) ; - } else if ( OUTPUT_SWITCH < 0 ) { - fprintf(stderr,"endHDFtraceEvent: "); - fprintf(stderr,"invalid OUTPUT_SWITCH %d, IDtype = %d\n", - OUTPUT_SWITCH, IDtype ) ; - } -} -/******************************************************************************/ - -/*+ Open routines +*/ -/*+ ------------- +*/ -/*+ +*/ -/*+ Routine: FILE *HDFtraceFOPEN( const char *filename, const char *type ) +*/ -/*+ substitute for fopen() +*/ -/*+ generates fopenBeginID, fopenEndID +*/ -/*+ record Open (fopenBegin) +*/ -/*+ Mode = -1 +*/ -/*+ +*/ -FILE *HDFtraceFOPEN( const char *filename, const char *type ) -{ - FILE *fp; - int fd, id; - int flags = 0; - struct open_args openArgs; - size_t typeLen; - - if ( IOtracingEnabled ) { - strcpy( openArgs.filename, filename ); - - /* check for 'b' - usually if 2 chars, second is '+' */ - typeLen = strlen( type ); - if ( ( typeLen == 2 ) && ( type [1] == 'b' ) ) { - typeLen = 1; - } - - if ( typeLen == 1 ) { - switch( type[0] ) { - case 'r': - flags = flags | O_RDONLY; - break; - case 'w': - flags = O_TRUNC | O_CREAT | O_WRONLY; - break; - case 'a': - flags = flags | O_APPEND | O_CREAT | O_WRONLY; - break; - } - } else { - switch( type[0] ) { - case 'r': - flags = O_RDWR; - break; - case 'w': - flags = O_TRUNC | O_CREAT | O_RDWR; - break; - case 'a': - flags = O_APPEND | O_CREAT | O_RDWR; - break; - } - } - openArgs.flags = flags; - openArgs.mode= -1; - - HDFtraceIOEvent( fopenBeginID, (void *)&openArgs, sizeof(openArgs) ); - } - - fp = fopen( filename, type ); - if ( fp != NULL ) { - fd = fileno( fp ); - id = set_c_mappedID( fd ); - } else { - id = -1; - } - - if ( IOtracingEnabled ) { - HDFtraceIOEvent( fopenEndID, (void *) &id, int_SIZE ); - } - - return( fp ); -} - -/*+ Routine: int HDFtraceCREAT( const char *path, mode_t mode ) +*/ -/*+ substitute for creat() +*/ -/*+ generates openBeginID, openEndID +*/ -/*+ record Open (openBeginID) +*/ -/*+ +*/ -int HDFtraceCREAT( const char *path, mode_t mode ) -{ - struct open_args openArgs; - int fd; - int id; - - if ( IOtracingEnabled ) { - strcpy( openArgs.filename, path ); - openArgs.flags = O_WRONLY | O_CREAT | O_TRUNC; - openArgs.mode = (int) mode; - - HDFtraceIOEvent( openBeginID, (void *)&openArgs, sizeof(openArgs) ); - } - - fd = creat( path, mode ); - id = set_c_mappedID( fd ); - - if ( IOtracingEnabled ) { - HDFtraceIOEvent( openEndID, (void *) &id, int_SIZE ); - } - - return( fd ); -} - -/******************************************************************************/ - -/*+ Flush routines +*/ -/*+ -------------- +*/ -/*+ +*/ -/*+ Routine: int HDFtraceFFLUSH( FILE *stream ) +*/ -/*+ substitute for fflush() +*/ -/*+ generates fflushBeginID, fflushEndID +*/ -/*+ record Flush (fflushBeginID) +*/ -/*+ +*/ -int HDFtraceFFLUSH( FILE *stream ) -{ - int ret; - int id; - int fd; - - if ( IOtracingEnabled ) { - /* - * If stream is NULL, all files open for write are flushed. - * We show this with a -2 in the trace record as too much overhead - * to try and tell what files those are and generate individual - * trace records. - */ - if ( stream == NULL ) { - id = -2; - } else { - fd = fileno( stream ); - id = c_mappedID( fd ); - HDFtraceIOEvent( fflushBeginID, (void *) 0, int_SIZE ); - } - } - - ret = fflush( stream ); - - if ( IOtracingEnabled ) { - HDFtraceIOEvent( fflushEndID, (void *) &id, 0 ); - } - - /* - * Note that if fflush called on stream open for reading, the file pointer - * is moved to EOF if it isn't there already. We don't account for that - * in our file positioning information. - */ - - return( ret ); -} - -/******************************************************************************/ -/*+ Close routines +*/ -/*+ -------------- +*/ -/*+ +*/ -/*+ Routine: int HDFtraceFCLOSE( FILE *stream ) +*/ -/*+ substitute for fclose() +*/ -/*+ generates fcloseBeginID, fcloseEndID +*/ -/*+ record Close (fcloseBeginID) +*/ -/*+ +*/ -int HDFtraceFCLOSE( FILE *stream ) -{ - int ret; - int id; - int fd = fileno( stream ); - - if ( IOtracingEnabled ) { - id = c_mappedID( fd ); - HDFtraceIOEvent( fcloseBeginID, (void *) &id, int_SIZE ); - } - - ret = fclose( stream ); - - if ( IOtracingEnabled ) { - HDFtraceIOEvent( fcloseEndID, (void *) 0, 0 ); - } - - return( ret ); -} - -/*+ Routine: int HDFtrace3OPEN( char *path, int flags, mode_t mode ) +*/ -/*+ substitute for open() when called with 3 arguments +*/ -/*+ generates openBeginID, openEndID +*/ -/*+ record Open (openBeginID) +*/ -/*+ +*/ -int HDFtrace3OPEN( const char *path, int flags, mode_t mode ) -{ - struct open_args openArgs; - int fd; - int id; - - if ( IOtracingEnabled ) { - strcpy( openArgs.filename, path ); - openArgs.flags = flags; - openArgs.mode = (int) mode; - - HDFtraceIOEvent( openBeginID, (char *)&openArgs, sizeof(openArgs) ); - } - - fd = open( path, flags, mode ); - id = set_c_mappedID( fd ); - - if ( IOtracingEnabled ) { - HDFtraceIOEvent( openEndID, (char *) &id, int_SIZE ); - } - - return( fd ); -} - -/*+ Routine: int HDFtraceCLOSE( int fd ) +*/ -/*+ substitute for close() +*/ -/*+ generates closeBeginID, closeEndID +*/ -/*+ record Close (closeBeginID) +*/ -/*+ +*/ -int HDFtraceCLOSE( int fd ) -{ - int ret; - int id; - - if ( IOtracingEnabled ) { - id = c_mappedID( fd ); - HDFtraceIOEvent( closeBeginID, (void *) &id, int_SIZE ); - } - - ret = close( fd ); - - if ( IOtracingEnabled ) { - HDFtraceIOEvent( closeEndID, (void *) 0, 0 ); - } - - return( ret ); -} - -/******************************************************************************/ -/*+ Read routines +*/ -/*+ ------------- +*/ -/*+ +*/ -/*+ Routine: int HDFtraceREAD( int fd, char *buf, int nbyte ) +*/ -/*+ substitute for read() +*/ -/*+ generates readBeginID, readEndID +*/ -/*+ record Read (readBeginID) +*/ -/*+ Number Variables = 1 +*/ -/*+ Cause = -1 +*/ -/*+ +*/ -size_t HDFtraceREAD( int fd, char *buf, int nbyte ) -{ - struct read_write_args readArgs; - size_t ret; - int bytes; - - if ( IOtracingEnabled ) { - readArgs.fileID = c_mappedID( fd ); - readArgs.numVariables = 1; - readArgs.cause = -1; - - HDFtraceIOEvent( readBeginID, (void *) &readArgs, sizeof(readArgs) ); - } - - ret = read( fd, buf, nbyte ); - - if ( IOtracingEnabled ) { - if ( ret > 0 ) { - bytes = (int)ret; - } else { - bytes = 0; - } - HDFtraceIOEvent( readEndID, (void *) &bytes, int_SIZE ); - } - - return( ret ); -} - -/*+ Routine: int HDFtraceFREAD( char *ptr, int size, int nitems, +*/ -/*+ FILE *stream) +*/ -/*+ substitute for fread() +*/ -/*+ generates freadBeginID, freadEndID +*/ -/*+ record Read (freadBeginID) +*/ -/*+ Number Variables = nitems +*/ -/*+ Cause = -1 +*/ -/*+ +*/ -size_t HDFtraceFREAD( void *ptr, int size, int nitems, FILE *stream ) -{ - struct read_write_args readArgs; - size_t ret; - int nbytes; - int fd = fileno( stream ); - - if ( IOtracingEnabled ) { - readArgs.fileID = c_mappedID( fd ); - readArgs.numVariables = nitems; - readArgs.cause = -1; - HDFtraceIOEvent( freadBeginID, (void *) &readArgs, sizeof(readArgs) ); - } - - ret = fread( ptr, size, nitems, stream ); - - if ( IOtracingEnabled ) { - if ( ret > 0 ) { - nbytes = (int)ret * size ; - } else { - nbytes = 0; - } - HDFtraceIOEvent( freadEndID, (void *) &nbytes, int_SIZE ); - } - - return( ret ); -} - - -/******************************************************************************/ -/*+ Seek routines +*/ -/*+ ------------- +*/ -/*+ +*/ -/*+ Routine: off_t HDFtraceLSEEK( int fd, off_t offset, int whence ) +*/ -/*+ substitute for lseek() +*/ -/*+ generates lseekBeginID, lseekEndID +*/ -/*+ record Seek (lseekBeginID) +*/ -/*+ +*/ -off_t HDFtraceLSEEK( int fd, off_t offset, int whence ) -{ - struct seek_args seekArgs; - off_t ret; - long arg; - - if ( IOtracingEnabled ) { - seekArgs.fileID = c_mappedID( fd ); - seekArgs.offset = (int) offset; - seekArgs.whence = whence; - - HDFtraceIOEvent( lseekBeginID, (void *) &seekArgs, sizeof(seekArgs) ); - } - - ret = lseek( fd, offset, whence ); - - if ( IOtracingEnabled ) { - arg = (long) ret; - HDFtraceIOEvent( lseekEndID, (void *)&arg, long_SIZE ); - } - - return( ret ); -} - -/*+ routine: int HDF traceFSEEK( FILE *stream, long offset, int whence ) +*/ -/*+ substitute for fseek() +*/ -/*+ generates fseekBeginID, fseekEndID +*/ -/*+ record Seek (fseekBeginID) +*/ -/*+ +*/ -int HDFtraceFSEEK( FILE *stream, long offset, int whence ) -{ - struct seek_args seekArgs; - int ret; - long arg; - int fd = fileno( stream ); - - if ( IOtracingEnabled ) { - seekArgs.fileID = c_mappedID( fd );; - seekArgs.offset = (int) offset; - seekArgs.whence = whence; - - HDFtraceIOEvent( fseekBeginID, (void *) &seekArgs, sizeof(seekArgs) ); - } - - ret = fseek( stream, offset, whence ); - - if ( IOtracingEnabled ) { - arg = ftell( stream ); - HDFtraceIOEvent( fseekEndID, (void *)&arg, long_SIZE ); - } - - return( ret ); -} - -#ifdef fpos_t -/*+ Routine: int HDFtraceFSETPOS( FILE *stream, const fpos_t *position ) +*/ -/*+ substitute for fsetpos() +*/ -/*+ generates fsetposBeginID, fsetposEndID +*/ -/*+ record Seek (fsetposBeginID) +*/ -/*+ +*/ -int HDFtraceFSETPOS( FILE stream, const fpos_t *position ) -{ - struct seek_args seekArgs; - int ret; - long arg; - int fd = fileno( stream ); - - if ( IOtracingEnabled ) { - seekArgs.fileID = c_mappedID( fd );; - seekArgs.offset = (int) *position; - seekArgs.whence = SEEK_SET; - - HDFtraceIOEvent( fsetposBeginID, (void *) &seekArgs, sizeof(seekArgs) ); - } - - ret = fsetpos( stream, position ); - - if ( IOtracingEnabled ) { - arg = (long) *position; - HDFtraceIOEvent( fsetposEndID, (void *)&arg, long_SIZE ); - } - - return( ret ); -} -#endif /* fpos_t */ - -/*+ Routine: void HDFtraceREWIND ( FILE *stream ) +*/ -/*+ substitute for rewind() +*/ -/*+ generates rewindBeginID, rewindEndID +*/ -/*+ record Seek (rewindBeginID) +*/ -/*+ Offset = 0 +*/ -/*+ Whence = SEEK_SET +*/ -/*+ +*/ -void HDFtraceREWIND( FILE *stream ) -{ - struct seek_args seekArgs; - long arg; - int fd = fileno( stream ); - - if ( IOtracingEnabled ) { - seekArgs.fileID = c_mappedID( fd ); - seekArgs.offset = 0; - seekArgs.whence = SEEK_SET; - - HDFtraceIOEvent( rewindBeginID, (void *) &seekArgs, sizeof(seekArgs) ); - } - - rewind( stream ); - - if ( IOtracingEnabled ) { - arg = 0; - HDFtraceIOEvent( rewindEndID, (void *)&arg, long_SIZE ); - } - - return; -} - -/******************************************************************************/ -/*+ Write routines +*/ -/*+ -------------- +*/ -/*+ +*/ -/*+ Routine: int HDFtraceWRITE( int fd, char *buf, int nbyte ) +*/ -/*+ substitute for write() +*/ -/*+ generates writeBeginID, writeEndID +*/ -/*+ record Write (writeBeginID) +*/ -/*+ Number Variables = 1 +*/ -/*+ Cause = -1 +*/ -/*+ +*/ -size_t HDFtraceWRITE( int fd, const char *buf, int nbyte ) -{ - struct read_write_args writeArgs; - size_t ret; - int bytes; - - if ( IOtracingEnabled ) { - writeArgs.fileID = c_mappedID( fd ); - writeArgs.numVariables = 1; - writeArgs.cause = -1; - - HDFtraceIOEvent( writeBeginID, (void *) &writeArgs, sizeof(writeArgs) ); - } - - ret = write( fd, buf, nbyte ); - - if ( IOtracingEnabled ) { - if ( ret > 0 ) { - bytes = (int)ret; - } else { - bytes = 0; - } - HDFtraceIOEvent( writeEndID, (void *) &bytes, int_SIZE ); - } - return( ret ); -} - -/*+ Routine: size_t HDFtraceFWRITE( const char *ptr, int size, int nitems, +*/ -/*+ FILE *stream ) +*/ -/*+ substitute for fwrite() +*/ -/*+ generates fwriteBeginID, fwriteEndID +*/ -/*+ record Write (fwriteBeginID) +*/ -/*+ Number Variables = nitems +*/ -/*+ Cause = -1 +*/ -/*+ +*/ -size_t HDFtraceFWRITE( const char *ptr, int size, int nitems, FILE *stream ) -{ - struct read_write_args writeArgs; - size_t ret; - int nbytes; - int fd = fileno( stream ); - - if ( IOtracingEnabled ) { - writeArgs.fileID = c_mappedID( fd ); - writeArgs.numVariables = nitems; - writeArgs.cause = -1; - - HDFtraceIOEvent( fwriteBeginID, (void *) &writeArgs, sizeof(writeArgs) ); - } - - ret = fwrite( ptr, size, nitems, stream ); - - if ( IOtracingEnabled ) { - if ( ret > 0 ) { - nbytes = (int)ret * size ; - } else { - nbytes = 0; - } - HDFtraceIOEvent( fwriteEndID, (void *) &nbytes, int_SIZE ); - } - - return( ret ); -} - -/*+ Routine: int HDFtracePUTS( char *s ) +*/ -/*+ substitute for puts() +*/ -/*+ generates fwriteBeginID, fwriteEndID +*/ -/*+ record Write (fwriteBeginID) +*/ -/*+ Number Variables = 1 +*/ -/*+ Cause = -1 +*/ -/*+ +*/ -int HDFtracePUTS( char *s ) -{ - struct read_write_args writeArgs; - int ret; - int fd = fileno( stdout ); - - if ( IOtracingEnabled ) { - writeArgs.fileID = c_mappedID( fd ); - writeArgs.numVariables = 1; - writeArgs.cause = -1; - - HDFtraceIOEvent( fwriteBeginID, (void *) &writeArgs, sizeof(writeArgs) ); - } - - ret = puts( s ); - - if ( IOtracingEnabled ) { - HDFtraceIOEvent( fwriteEndID, (void *) &ret, int_SIZE ); - } - - return( ret ); -} - -/*+ Routine: int HDFtraceFPUTC( int c, FILE *stream ) +*/ -/*+ substitute for fputc() +*/ -/*+ generates fwriteBeginID, fwriteEndID +*/ -/*+ record Write (fwriteBeginID) +*/ -/*+ Number Variables = 1 +*/ -/*+ Cause = -1 +*/ -/*+ +*/ -int HDFtraceFPUTC( int c, FILE *stream ) -{ - struct read_write_args writeArgs; - int ret; - int nbytes = char_SIZE; - int fd = fileno( stream ); - - if ( IOtracingEnabled ) { - writeArgs.fileID = c_mappedID( fd ); - writeArgs.numVariables = 1; - writeArgs.cause = -1; - - HDFtraceIOEvent( fwriteBeginID, (void *) &writeArgs, sizeof(writeArgs) ); - } - - ret = fputc( c, stream ); - - if ( IOtracingEnabled ) { - if ( ret == EOF ) { - nbytes = 0; - HDFtraceIOEvent( fwriteEndID, (void *) &nbytes, int_SIZE ); - } - } - - return( ret ); -} -/*+ Routine: int HDFtraceFPUTS( char *s, FILE *stream ) +*/ -/*+ substitute for fputs() +*/ -/*+ generates fwriteBeginID, fwriteEndID +*/ -/*+ record Write (fwriteBeginID) +*/ -/*+ Number Variables = 1 +*/ -/*+ Cause = -1 +*/ -/*+ +*/ -int HDFtraceFPUTS( const char *s, FILE *stream ) -{ - struct read_write_args writeArgs; - int ret; - int fd = fileno( stream ); - - if ( IOtracingEnabled ) { - writeArgs.fileID = c_mappedID( fd ); - writeArgs.numVariables = 1; - writeArgs.cause = -1; - - HDFtraceIOEvent(fwriteBeginID, (void *)&writeArgs, sizeof(writeArgs)); - } - - ret = fputs( s, stream ); - - if ( IOtracingEnabled ) { - HDFtraceIOEvent( fwriteEndID, (void *) &ret, int_SIZE ); - } - - return( ret ); -} -void *HDFtraceMALLOC(size_t bytes ) -{ - void *ptr; - int byte_req; - byte_req = (int)bytes; - if ( IOtracingEnabled ) { - HDFtraceIOEvent ( ID_malloc, NULL, 0 ); - } - - ptr = malloc( bytes ); - - if ( IOtracingEnabled ) { - HDFtraceIOEvent ( -ID_malloc, &byte_req, sizeof(int) ); - } - - return ptr ; - -} - -void HDFtraceIOEvent( int eventType, void *dataPtr, unsigned dataLen ) -{ - if ( OUTPUT_SWITCH == 1 ) { - traceEvent( eventType, dataPtr, dataLen ); - } else { - HDFtraceEvent_RT( eventType, (HDFsetInfo *)dataPtr, dataLen ); - } -} -/*======================================================================* -// record the final time stamp * -//======================================================================*/ -void HDFfinalTimeStamp( void ) -{ - TR_LOCK criticalSection; - CLOCK currentTime; - double seconds; - struct { - int packetLength, - packetType, - packetTag, - timeDim; - double Seconds; - int eventID, - node, - dataLen; - } Packet; - - criticalSection = TRlock(); - currentTime = getClock(); - seconds = clockToSeconds( currentTime ); - - Packet.packetLength = sizeof(Packet); - Packet.packetType = PKT_DATA; - Packet.packetTag = FAMILY_EXTERNAL | RECORD_TRACE; - Packet.timeDim = 0; /* use fp time stamp only */ - Packet.Seconds = seconds; /* fp time stamp */ - Packet.eventID = ID_timeStamp; - Packet.node = TRgetNode(); - Packet.dataLen = 0; - putBytes( (void *)&Packet , sizeof(Packet) ); -} -#ifdef HAVE_PARALLEL -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_open( MPI_Comm comm, char *filename, int amode, - MPI_Info info, MPI_File *fh ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_open( comm, filename, amode, info, fh ); - } else { - dataLen = sizeof( HDFsetInfo ); - dataPtr.setID = (long)fh; - dataPtr.setName = (char *)malloc( strlen(filename) + 1); - strcpy( dataPtr.setName , filename ); - HDFtraceEvent_RT( mpiOpenBeginID, &dataPtr, dataLen ); - returnVal = PMPI_File_open( comm, filename, amode, info, fh ); - HDFtraceEvent_RT( mpiOpenEndID, &dataPtr, dataLen ); - } - return returnVal; -} - - - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_close( MPI_File *fh ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_close( fh ); - } else { - dataLen = sizeof( HDFsetInfo ); - dataPtr.setID = (long)fh; - dataPtr.setName = NULL; - HDFtraceEvent_RT( mpiCloseBeginID, &dataPtr, dataLen ); - returnVal = PMPI_File_close( fh ); - HDFtraceEvent_RT( mpiCloseEndID, &dataPtr, dataLen ); - free( dataPtr.setName ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_delete( char *filename, MPI_Info info ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_delete( filename, info ); - } else { - dataLen = sizeof( HDFsetInfo ); - dataPtr.setID = 0; - dataPtr.setName = (char *)malloc( sizeof(filename) ); - strcpy( dataPtr.setName , filename ); - HDFtraceEvent_RT( mpiDeleteBeginID, &dataPtr, dataLen ); - returnVal = PMPI_File_delete( filename, info ); - HDFtraceEvent_RT( mpiDeleteEndID, &dataPtr, dataLen ); - free( dataPtr.setName ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_set_size( MPI_File fh, MPI_Offset size ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_set_size( fh, size ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiSetSizeBeginID,&dataPtr,dataLen ); - returnVal = PMPI_File_set_size( fh, size ); - HDFtraceEvent_RT( mpiSetSizeEndID, &dataPtr, dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_preallocate( MPI_File fh, MPI_Offset size) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_preallocate( fh, size); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiPreallocateBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_preallocate( fh, size); - HDFtraceEvent_RT( mpiPreallocateEndID, - &dataPtr, dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_get_size( MPI_File fh, MPI_Offset *size ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_get_size( fh, size); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiGetSizeBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_get_size( fh, size); - HDFtraceEvent_RT( mpiGetSizeEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_get_group( MPI_File fh, MPI_Group *group ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_get_group( fh, group); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiGetGroupBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_get_group( fh, group); - HDFtraceEvent_RT( mpiGetGroupEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_get_amode( MPI_File fh, int *amode ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_get_amode( fh, amode); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiGetAmodeBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_get_amode( fh, amode); - HDFtraceEvent_RT( mpiGetAmodeEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_set_view( MPI_File fh, MPI_Offset disp, MPI_Datatype etype, - MPI_Datatype filetype, char *datarep, MPI_Info info ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_set_view( fh, disp, etype, filetype, - datarep, info ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiSetViewBeginID, - &dataPtr,dataLen ); - returnVal = MPI_File_set_view( fh, disp, etype, filetype, - datarep, info ); - HDFtraceEvent_RT( mpiSetViewEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_get_view( MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype, - MPI_Datatype *filetype, char *datarep ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_get_view(fh, disp, etype, filetype, datarep); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiSetViewBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_get_view(fh, disp, etype, filetype, datarep); - HDFtraceEvent_RT( mpiSetViewEndID, - &dataPtr,dataLen ); - returnVal = PMPI_File_get_view(fh, disp, etype, filetype, datarep); - - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_read_at( MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, MPI_Status *status ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_read_at( fh, offset, buf, count, datatype, - status ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiReadAtBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_read_at( fh, offset, buf, count, datatype, - status ); - HDFtraceEvent_RT( mpiReadAtEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_read_at_all( MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, MPI_Status *status ) -{ - - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_read_at_all( fh, offset, buf, - count, datatype, status ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiReadAtAllBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_read_at_all( fh, offset, buf, - count, datatype, status ); - HDFtraceEvent_RT( mpiReadAtAllEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_write_at( MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, MPI_Status *status ) -{ - - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_write_at( fh, offset, buf, count, datatype, - status ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiWriteAtBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_write_at( fh, offset, buf, count, datatype, - status ); - HDFtraceEvent_RT( mpiWriteAtEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_write_at_all( MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, MPI_Status *status ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_write_at_all( fh, offset, buf, - count, datatype, status ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiWriteAtAllBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_write_at_all( fh, offset, buf, - count, datatype, status ); - HDFtraceEvent_RT( mpiWriteAtAllEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_iread_at( MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, MPIO_Request *request ) -{ - return MPI_File_iread_at( fh, offset, buf, count, datatype, request ); -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_iwrite_at( MPI_File fh, MPI_Offset offset, void *buf, - int count, MPI_Datatype datatype, MPIO_Request *request) -{ - return MPI_File_iwrite_at( fh, offset, buf, count, datatype, request ); -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_read( MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_read( fh, buf, count, datatype, status ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiReadBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_read( fh, buf, count, datatype, status ); - HDFtraceEvent_RT( mpiReadEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_read_all( MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Status *status) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_read_all( fh, buf, count, datatype, status ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiReadAllBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_read_all( fh, buf, count, datatype, status ); - HDFtraceEvent_RT( mpiReadAllEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_write( MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Status *status ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_write( fh, buf, count, datatype, status ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiWriteBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_write( fh, buf, count, datatype, status ); - HDFtraceEvent_RT( mpiWriteEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_write_all( MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPI_Status *status ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_write_all( fh, buf, count, datatype, status ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiWriteAllBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_write_all( fh, buf, count, datatype, status ); - HDFtraceEvent_RT( mpiWriteAllEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_iread( MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPIO_Request *request ) -{ - return MPI_File_iread( fh, buf, count, datatype, request ); -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_iwrite( MPI_File fh, void *buf, int count, - MPI_Datatype datatype, MPIO_Request *request ) -{ - return MPI_File_iwrite( fh, buf, count, datatype, request ); -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_seek( MPI_File fh, MPI_Offset offset, int whence ) -{ - - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_seek( fh, offset, whence ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiSeekBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_seek( fh, offset, whence ); - HDFtraceEvent_RT( mpiSeekEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_get_position( MPI_File fh, MPI_Offset *offset ) -{ - - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_get_position( fh, offset ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiGetPositionBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_get_position( fh, offset ); - HDFtraceEvent_RT( mpiGetPositionEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_get_byte_offset( MPI_File fh, MPI_Offset offset, - MPI_Offset *disp ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_get_byte_offset( fh, offset, disp ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiGetByteOffsetBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_get_byte_offset( fh, offset, disp ); - HDFtraceEvent_RT( mpiGetByteOffsetEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_get_type_extent( MPI_File fh, MPI_Datatype datatype, - MPI_Aint *extent ) -{ - - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_get_type_extent( fh, datatype, extent ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiGetTypeExtentBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_get_type_extent( fh, datatype, extent ); - HDFtraceEvent_RT( mpiGetTypeExtentEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_set_atomicity( MPI_File fh, int flag ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_set_atomicity( fh, flag ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiSetAtomicityBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_set_atomicity( fh, flag ); - HDFtraceEvent_RT( mpiSetAtomicityEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_get_atomicity( MPI_File fh, int *flag ) -{ - - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_get_atomicity( fh, flag ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiGetAtomicityBeginID, - &dataPtr,dataLen ); - returnVal = PMPI_File_get_atomicity( fh, flag ); - HDFtraceEvent_RT( mpiGetAtomicityEndID, - &dataPtr,dataLen ); - } - return returnVal; -} - -/*======================================================================* -// Pass call through to regular MPIO entry except in case of Real Time * -// tracing. * -// Note: The regular MPIO entry may or may not be instrumented. * -//======================================================================*/ -int HDF_MPI_File_sync( MPI_File fh ) -{ - int returnVal; - HDFsetInfo dataPtr; - int dataLen; - - if ( OUTPUT_SWITCH != RT_OUTPUT ) { - returnVal = MPI_File_sync ( fh ); - } else { - dataLen = 0; - HDFtraceEvent_RT( mpiSyncBeginID, - &dataPtr,dataLen ); - returnVal = MPI_File_sync ( fh ); - HDFtraceEvent_RT( mpiSyncEndID, - &dataPtr,dataLen ); - } - return returnVal; -} -#endif /* HAVE_PARALLEL */ diff --git a/pablo/PabloHDF5.c b/pablo/PabloHDF5.c new file mode 100644 index 0000000..c239357b --- /dev/null +++ b/pablo/PabloHDF5.c @@ -0,0 +1,1807 @@ +/* This file is part of the Pablo Performance Analysis Environment +// +// (R) +// The Pablo Performance Analysis Environment software is NOT in +// the public domain. However, it is freely available without fee for +// education, research, and non-profit purposes. By obtaining copies +// of this and other files that comprise the Pablo Performance Analysis +// Environment, you, the Licensee, agree to abide by the following +// conditions and understandings with respect to the copyrighted software: +// +// 1. The software is copyrighted in the name of the Board of Trustees +// of the University of Illinois (UI), and ownership of the software +// remains with the UI. +// +// 2. Permission to use, copy, and modify this software and its documentation +// for education, research, and non-profit purposes is hereby granted +// to Licensee, provided that the copyright notice, the original author's +// names and unit identification, and this permission notice appear on +// all such copies, and that no charge be made for such copies. Any +// entity desiring permission to incorporate this software into commercial +// products should contact: +// +// Professor Daniel A. Reed reed@cs.uiuc.edu +// University of Illinois +// Department of Computer Science +// 2413 Digital Computer Laboratory +// 1304 West Springfield Avenue +// Urbana, Illinois 61801 +// USA +// +// 3. Licensee may not use the name, logo, or any other symbol of the UI +// nor the names of any of its employees nor any adaptation thereof in +// advertizing or publicity pertaining to the software without specific +// prior written approval of the UI. +// +// 4. THE UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE +// SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS +// OR IMPLIED WARRANTY. +// +// 5. The UI shall not be liable for any damages suffered by Licensee from +// the use of this software. +// +// 6. The software was developed under agreements between the UI and the +// Federal Government which entitle the Government to certain rights. +// +// ************************************************************************* +// +// Developed by: The Pablo Research Group +// University of Illinois at Urbana-Champaign +// Department of Computer Science +// 1304 W. Springfield Avenue +// Urbana, IL 61801 +// +// http://www-pablo.cs.uiuc.edu +// +// Send comments to: pablo-feedback@guitar.cs.uiuc.edu +// +// Copyright (c) 1987-1998 +// The University of Illinois Board of Trustees. +// All Rights Reserved. +// +// PABLO is a registered trademark of +// The Board of Trustees of the University of Illinois +// registered in the U.S. Patent and Trademark Office. +// +// Project Manager and Principal Investigator: +// Daniel A. Reed (reed@cs.uiuc.edu) +// +// Funded in part by the Defense Advanced Research Projects Agency under +// DARPA contracts DABT63-94-C0049 (SIO Initiative), F30602-96-C-0161, +// and DABT63-96-C-0027 by the National Science Foundation under the PACI +// program and grants NSF CDA 94-01124 and ASC 97-20202, and by the +// Department of Energy under contracts DOE B-341494, W-7405-ENG-48, and +// 1-B-333164. +//========================================================================*/ + +#include +#include +#include +#include +#ifndef fileno +int fileno ( FILE * ); +#endif +/* on ipsc/860 don't include this or you'll get multiply defined SEEK_* */ +#ifndef __NX +#include +#endif + + +#define HDFtrace3OPEN__ +int HDFtrace3OPEN( const char *, int, mode_t ); + +#include "SDDFparam.h" +#include "TraceParam.h" + +#include "SystemDepend.h" +#include "Trace.h" + +#include "IO_TraceParams.h" +#include "HDFIOTrace.h" + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +/* mode_t is not defined on the ipsc/860 so we define it here */ +#ifdef __NX +typedef unsigned int mode_t; +#endif + +int OUTPUT_SWITCH = 1; +int *procTrace; +extern void preInitIOTrace( void ); + +#include "ProcTrace.h" +#include "HDF5Trace.h" +#include "IOTrace.h" + +#define ID_HDFprocName 9996 +#define ID_malloc 9997 +#define ID_free 9998 +#define ID_timeStamp 9999 +#define DUMMY_HDF 10000 + +#ifdef HAVE_PARALLEL +#include "mpio.h" +#include "MPIO_TraceParams.h" +#endif /* HAVE_PARALLEL*/ + +#ifdef HAVE_MPIOTRACE +#include "MPIO_Init.h" +#include "MPIO_EventArgs.h" +#include "HDFmpioProtos.h" +#endif /* HAVE_MPIOTRACE */ + +void HDFinitTrace_RT ( const char *, int ); +void HDFinitTrace_SDDF ( const char *, int ); +void h5inittracex_ ( int [], int *, int[], int *,unsigned * ); +void hdf5endtrace_ ( void ) ; +void HDFendTrace_RT (int); +void HDFendTrace_SDDF(int); +void HDFfinalTimeStamp( void ); +void startHDFtraceEvent (int ); +int computeProcMask (int eventID); +int computePacketTag(int eventID); +void endHDFtraceEvent (int , int , char *, int ); +void traceEvent ( int , char *, unsigned ); +void HDFtraceEvent_RT ( int , HDFsetInfo *, unsigned ); +void HDFtraceIOEvent( int , void *, unsigned ); +extern int IOtracingEnabled; +char *hdfRecordPointer; +double WriteTotals = 0.0; +double ReadTotals = 0.0; +/*======================================================================* +// NAME * +// HDF5initTrace -- initialize HDF tracing * +// USAGE * +// VOID HDFinitTrace( traceFileName, out_sw ) * +// char *traceFileName; IN: name of the generated trace output * +// file * +// int ... IN: indicates which routines to trace * +// The list is terminated by the * +// OUTPUT_SWITCH value indicating * +// whether to do RunTime or Summary * +// tracing. * +// RETURNS * +// None. * +//======================================================================*/ +/*======================================================================* +// fortran to C interface. To insure portability, the character array * +// passed in Fortran is converted to an integer array using the ICHAR * +// function. This program converts it from integer to char, then * +// passes it to the C initialization routine. * +//======================================================================*/ +void h5inittracex_( int *file, int *len, int flags[], int *nflags, + unsigned *out_sw ) +{ + char *traceFileName; + int i; + traceFileName = (char *)malloc(*len+1); + for ( i = 0; i < *len; ++i ) { + traceFileName[i] = file[i]; + } + traceFileName[*len+1] = 0; + /*==============================================================* + // Allocate space for trace indicators. * + //==============================================================*/ + procTrace = ( int * ) malloc( NUM_HDF5_IDS*sizeof(int) ); + if ( procTrace == NULL ) { + fprintf(stderr,">> Error: Unable to allocate procTrace "); + fprintf(stderr,"array in program HDF5initTrace. <<<\n"); + fprintf(stderr,">>> Exiting program! <<<\n"); + exit (-1); + } + /*==============================================================* + // Initialize to 0. * + //==============================================================*/ + for ( i = 0; i <= NUM_HDF5_IDS; ++i ) { + procTrace[i] = 0; + } + /*==============================================================* + // Read in the flags indicating which procedures to trace. * + // The last parameter passed is an indicator of the type of * + // tracing to do. This indicator has a value larger than any * + // of the flags. * + //==============================================================*/ + for ( i = 0; i < *nflags; ++i ) { + procTrace[flags[i]] = 1; + } + OUTPUT_SWITCH = *out_sw; + /*==============================================================* + // if no flags were passed, the default is to trace all of the * + // procedures. * + //==============================================================*/ + if ( *nflags == 0 || procTrace[AllHDF5] ) { + for ( i = ID_HDF_Last_Entry + 1; i < NUM_HDF5_IDS; ++i ) { + procTrace[i] = 1; + } + } + if ( OUTPUT_SWITCH == RUNTIME_TRACE + || OUTPUT_SWITCH == MPI_RUNTIME_TRACE ) { + HDFinitTrace_SDDF( traceFileName, OUTPUT_SWITCH ); + IOtracingEnabled = 1; + } else if ( OUTPUT_SWITCH == SUMMARY_TRACE + || OUTPUT_SWITCH == MPI_SUMMARY_TRACE ) { + HDFinitTrace_RT( traceFileName, OUTPUT_SWITCH ); + IOtracingEnabled = 1; + } else if ( OUTPUT_SWITCH == NO_TRACE ) { + IOtracingEnabled = 0; + } else { + fprintf(stderr,">> Error in HDF5initTrace: the third argument "); + fprintf(stderr,"must have a value between %4d<<\n",RUNTIME_TRACE); + fprintf(stderr,">> and %4d, inclusive.",NO_TRACE); + fprintf(stderr," The value received was %4u.", OUTPUT_SWITCH); + fprintf(stderr," Exiting Program. <<\n"); + exit (-1); + } +} +void HDF5initTrace( const char *traceFileName, int id_flag, ... ) +{ + int i, nIDs; + va_list ap; + + /*==============================================================* + // Allocate space for trace indicators. * + //==============================================================*/ + procTrace = ( int * ) malloc( NUM_HDF5_IDS*sizeof(int) ); + if ( procTrace == NULL ) { + fprintf(stderr,">> Error: Unable to allocate procTrace "); + fprintf(stderr,"array in program HDF5initTrace. <<<\n"); + fprintf(stderr,">>> Exiting program! <<<\n"); + exit (-1); + } + /*==============================================================* + // Initialize to 0. * + //==============================================================*/ + for ( i = 0; i < NUM_HDF5_IDS; ++i ) { + procTrace[i] = 0; + } + /*==============================================================* + // Read in the flags indicating which procedures to trace. * + // The last parameter passed is an indicator of the type of * + // tracing to do. This indicator has a value larger than any * + // of the flags. * + //==============================================================*/ + nIDs = 0; + va_start( ap, id_flag ); + while ( id_flag > NO_TRACE ) { + procTrace[id_flag] = 1; + ++nIDs; + id_flag = va_arg ( ap, int ); + } + OUTPUT_SWITCH = id_flag; + /*==============================================================* + // if no flags were passed, the default is to trace all of the * + // procedures. * + //==============================================================*/ + if ( nIDs == 0 || procTrace[AllHDF5] ) { + for ( i = ID_HDF_Last_Entry + 1; i < NUM_HDF5_IDS; ++i ) { + procTrace[i] = 1; + } + } + if ( OUTPUT_SWITCH == RUNTIME_TRACE + || OUTPUT_SWITCH == MPI_RUNTIME_TRACE ) { + HDFinitTrace_SDDF( traceFileName, OUTPUT_SWITCH ); + IOtracingEnabled = 1; + } else if ( OUTPUT_SWITCH == SUMMARY_TRACE + || OUTPUT_SWITCH == MPI_SUMMARY_TRACE ) { + HDFinitTrace_RT( traceFileName, OUTPUT_SWITCH ); + IOtracingEnabled = 1; + } else if ( OUTPUT_SWITCH == NO_TRACE ) { + IOtracingEnabled = 0; + } else { + fprintf(stderr,">> Error in HDF5initTrace: the third argument "); + fprintf(stderr,"must have a value between %4d<<\n",RUNTIME_TRACE); + fprintf(stderr,">> and %4d, inclusive.",NO_TRACE); + fprintf(stderr," The value received was %4u.", OUTPUT_SWITCH); + fprintf(stderr," Exiting Program. <<\n"); + exit (-1); + } +} +/*======================================================================* +// NAME * +// HDF5endTrace -- end HDF tracing * +// USAGE * +// VOID HDF5endTrace(VOID) * +// RETURNS * +// None. * +//======================================================================*/ +void hdf5endtrace_( void ) +{ + HDF5endTrace (); +} +void HDF5endTrace(void) +{ + if ( OUTPUT_SWITCH == RUNTIME_TRACE + || OUTPUT_SWITCH == MPI_RUNTIME_TRACE ) { + HDFendTrace_SDDF( OUTPUT_SWITCH ); + } else if ( OUTPUT_SWITCH == SUMMARY_TRACE + || OUTPUT_SWITCH == MPI_SUMMARY_TRACE ) { + HDFendTrace_RT( OUTPUT_SWITCH ); + } +} +void startHDFtraceEvent(int eventID) +{ + if ( OUTPUT_SWITCH == RUNTIME_TRACE + || OUTPUT_SWITCH == MPI_RUNTIME_TRACE ) { + traceEvent( eventID, NULL, 0 ) ; + } else { + HDFtraceEvent_RT( eventID, NULL, 0 ) ; + } +} +void endHDFtraceEvent(int eventID, int setID, char *setName, int IDtype ) +{ + HDFsetInfo info; + info.setID = setID; + info.setName = setName; + if ( OUTPUT_SWITCH == RUNTIME_TRACE + || OUTPUT_SWITCH == MPI_RUNTIME_TRACE ) { + traceEvent( eventID, (char *)&info, 0 ) ; + } else if ( OUTPUT_SWITCH == SUMMARY_TRACE + || OUTPUT_SWITCH == MPI_SUMMARY_TRACE ) { + HDFtraceEvent_RT( eventID, &info, 0 ) ; + } else if ( OUTPUT_SWITCH != NO_TRACE ) { + fprintf(stderr,"endHDFtraceEvent: "); + fprintf(stderr,"invalid OUTPUT_SWITCH %d, IDtype = %d\n", + OUTPUT_SWITCH, IDtype ) ; + } +} +/******************************************************************************/ + +/*+ Open routines +*/ +/*+ ------------- +*/ +/*+ +*/ +/*+ Routine: FILE *HDFtraceFOPEN( const char *filename, const char *type ) +*/ +/*+ substitute for fopen() +*/ +/*+ generates fopenBeginID, fopenEndID +*/ +/*+ record Open (fopenBegin) +*/ +/*+ Mode = -1 +*/ +/*+ +*/ +FILE *HDFtraceFOPEN( const char *filename, const char *type ) +{ + FILE *fp; + int fd, id; + int flags = 0; + struct open_args openArgs; + size_t typeLen; + + if ( IOtracingEnabled ) { + strcpy( openArgs.filename, filename ); + + /* check for 'b' - usually if 2 chars, second is '+' */ + typeLen = strlen( type ); + if ( ( typeLen == 2 ) && ( type [1] == 'b' ) ) { + typeLen = 1; + } + + if ( typeLen == 1 ) { + switch( type[0] ) { + case 'r': + flags = flags | O_RDONLY; + break; + case 'w': + flags = O_TRUNC | O_CREAT | O_WRONLY; + break; + case 'a': + flags = flags | O_APPEND | O_CREAT | O_WRONLY; + break; + } + } else { + switch( type[0] ) { + case 'r': + flags = O_RDWR; + break; + case 'w': + flags = O_TRUNC | O_CREAT | O_RDWR; + break; + case 'a': + flags = O_APPEND | O_CREAT | O_RDWR; + break; + } + } + openArgs.flags = flags; + openArgs.mode= -1; + + HDFtraceIOEvent( fopenBeginID, (void *)&openArgs, sizeof(openArgs) ); + } + + fp = fopen( filename, type ); + if ( fp != NULL ) { + fd = fileno( fp ); + id = set_c_mappedID( fd ); + } else { + id = -1; + } + + if ( IOtracingEnabled ) { + HDFtraceIOEvent( fopenEndID, (void *) &id, int_SIZE ); + } + + return( fp ); +} + +/*+ Routine: int HDFtraceCREAT( const char *path, mode_t mode ) +*/ +/*+ substitute for creat() +*/ +/*+ generates openBeginID, openEndID +*/ +/*+ record Open (openBeginID) +*/ +/*+ +*/ +int HDFtraceCREAT( const char *path, mode_t mode ) +{ + struct open_args openArgs; + int fd; + int id; + + if ( IOtracingEnabled ) { + strcpy( openArgs.filename, path ); + openArgs.flags = O_WRONLY | O_CREAT | O_TRUNC; + openArgs.mode = (int) mode; + + HDFtraceIOEvent( openBeginID, (void *)&openArgs, sizeof(openArgs) ); + } + + fd = creat( path, mode ); + id = set_c_mappedID( fd ); + + if ( IOtracingEnabled ) { + HDFtraceIOEvent( openEndID, (void *) &id, int_SIZE ); + } + + return( fd ); +} + +/******************************************************************************/ + +/*+ Flush routines +*/ +/*+ -------------- +*/ +/*+ +*/ +/*+ Routine: int HDFtraceFFLUSH( FILE *stream ) +*/ +/*+ substitute for fflush() +*/ +/*+ generates fflushBeginID, fflushEndID +*/ +/*+ record Flush (fflushBeginID) +*/ +/*+ +*/ +int HDFtraceFFLUSH( FILE *stream ) +{ + int ret; + int id; + int fd; + + if ( IOtracingEnabled ) { + /* + * If stream is NULL, all files open for write are flushed. + * We show this with a -2 in the trace record as too much overhead + * to try and tell what files those are and generate individual + * trace records. + */ + if ( stream == NULL ) { + id = -2; + } else { + fd = fileno( stream ); + id = c_mappedID( fd ); + HDFtraceIOEvent( fflushBeginID, (void *) 0, int_SIZE ); + } + } + + ret = fflush( stream ); + + if ( IOtracingEnabled ) { + HDFtraceIOEvent( fflushEndID, (void *) &id, 0 ); + } + + /* + * Note that if fflush called on stream open for reading, the file pointer + * is moved to EOF if it isn't there already. We don't account for that + * in our file positioning information. + */ + + return( ret ); +} + +/******************************************************************************/ +/*+ Close routines +*/ +/*+ -------------- +*/ +/*+ +*/ +/*+ Routine: int HDFtraceFCLOSE( FILE *stream ) +*/ +/*+ substitute for fclose() +*/ +/*+ generates fcloseBeginID, fcloseEndID +*/ +/*+ record Close (fcloseBeginID) +*/ +/*+ +*/ +int HDFtraceFCLOSE( FILE *stream ) +{ + int ret; + int id; + int fd = fileno( stream ); + + if ( IOtracingEnabled ) { + id = c_mappedID( fd ); + HDFtraceIOEvent( fcloseBeginID, (void *) &id, int_SIZE ); + } + + ret = fclose( stream ); + + if ( IOtracingEnabled ) { + HDFtraceIOEvent( fcloseEndID, (void *) 0, 0 ); + } + + return( ret ); +} + +/*+ Routine: int HDFtrace3OPEN( char *path, int flags, mode_t mode ) +*/ +/*+ substitute for open() when called with 3 arguments +*/ +/*+ generates openBeginID, openEndID +*/ +/*+ record Open (openBeginID) +*/ +/*+ +*/ +int HDFtrace3OPEN( const char *path, int flags, mode_t mode ) +{ + struct open_args openArgs; + int fd; + int id; + + if ( IOtracingEnabled ) { + strcpy( openArgs.filename, path ); + openArgs.flags = flags; + openArgs.mode = (int) mode; + + HDFtraceIOEvent( openBeginID, (char *)&openArgs, sizeof(openArgs) ); + } + + fd = open( path, flags, mode ); + id = set_c_mappedID( fd ); + + if ( IOtracingEnabled ) { + HDFtraceIOEvent( openEndID, (char *) &id, int_SIZE ); + } + + return( fd ); +} + +/*+ Routine: int HDFtraceCLOSE( int fd ) +*/ +/*+ substitute for close() +*/ +/*+ generates closeBeginID, closeEndID +*/ +/*+ record Close (closeBeginID) +*/ +/*+ +*/ +int HDFtraceCLOSE( int fd ) +{ + int ret; + int id; + + if ( IOtracingEnabled ) { + id = c_mappedID( fd ); + HDFtraceIOEvent( closeBeginID, (void *) &id, int_SIZE ); + } + + ret = close( fd ); + + if ( IOtracingEnabled ) { + HDFtraceIOEvent( closeEndID, (void *) 0, 0 ); + } + + return( ret ); +} + +/******************************************************************************/ +/*+ Read routines +*/ +/*+ ------------- +*/ +/*+ +*/ +/*+ Routine: int HDFtraceREAD( int fd, char *buf, int nbyte ) +*/ +/*+ substitute for read() +*/ +/*+ generates readBeginID, readEndID +*/ +/*+ record Read (readBeginID) +*/ +/*+ Number Variables = 1 +*/ +/*+ Cause = -1 +*/ +/*+ +*/ +size_t HDFtraceREAD( int fd, char *buf, int nbyte ) +{ + struct read_write_args readArgs; + size_t ret; + int bytes; + CLOCK t1, t2, incDur; + + if ( IOtracingEnabled ) { + readArgs.fileID = c_mappedID( fd ); + readArgs.numVariables = 1; + readArgs.cause = -1; + + HDFtraceIOEvent( readBeginID, (void *) &readArgs, sizeof(readArgs) ); + } + + t1 = getClock(); + ret = read( fd, buf, nbyte ); + t2 = getClock(); + incDur = clockSubtract(t2,t1); + ReadTotals += clockToSeconds( incDur ); + + if ( IOtracingEnabled ) { + if ( ret > 0 ) { + bytes = (int)ret; + } else { + bytes = 0; + } + HDFtraceIOEvent( readEndID, (void *) &bytes, int_SIZE ); + } + + return( ret ); +} + +/*+ Routine: int HDFtraceFREAD( char *ptr, int size, int nitems, +*/ +/*+ FILE *stream) +*/ +/*+ substitute for fread() +*/ +/*+ generates freadBeginID, freadEndID +*/ +/*+ record Read (freadBeginID) +*/ +/*+ Number Variables = nitems +*/ +/*+ Cause = -1 +*/ +/*+ +*/ +size_t HDFtraceFREAD( void *ptr, int size, int nitems, FILE *stream ) +{ + struct read_write_args readArgs; + size_t ret; + int nbytes; + int fd = fileno( stream ); + CLOCK t1, t2, incDur; + + if ( IOtracingEnabled ) { + readArgs.fileID = c_mappedID( fd ); + readArgs.numVariables = nitems; + readArgs.cause = -1; + HDFtraceIOEvent( freadBeginID, (void *) &readArgs, sizeof(readArgs) ); + } + + t1 = getClock(); + ret = fread( ptr, size, nitems, stream ); + t2 = getClock(); + incDur = clockSubtract(t2,t1); + ReadTotals += clockToSeconds( incDur ); + + if ( IOtracingEnabled ) { + if ( ret > 0 ) { + nbytes = (int)ret * size ; + } else { + nbytes = 0; + } + HDFtraceIOEvent( freadEndID, (void *) &nbytes, int_SIZE ); + } + + return( ret ); +} + + +/******************************************************************************/ +/*+ Seek routines +*/ +/*+ ------------- +*/ +/*+ +*/ +/*+ Routine: off_t HDFtraceLSEEK( int fd, off_t offset, int whence ) +*/ +/*+ substitute for lseek() +*/ +/*+ generates lseekBeginID, lseekEndID +*/ +/*+ record Seek (lseekBeginID) +*/ +/*+ +*/ +off_t HDFtraceLSEEK( int fd, off_t offset, int whence ) +{ + struct seek_args seekArgs; + off_t ret; + long arg; + + if ( IOtracingEnabled ) { + seekArgs.fileID = c_mappedID( fd ); + seekArgs.offset = (int) offset; + seekArgs.whence = whence; + + HDFtraceIOEvent( lseekBeginID, (void *) &seekArgs, sizeof(seekArgs) ); + } + + ret = lseek( fd, offset, whence ); + + if ( IOtracingEnabled ) { + arg = (long) ret; + HDFtraceIOEvent( lseekEndID, (void *)&arg, long_SIZE ); + } + + return( ret ); +} + +/*+ routine: int HDF traceFSEEK( FILE *stream, long offset, int whence ) +*/ +/*+ substitute for fseek() +*/ +/*+ generates fseekBeginID, fseekEndID +*/ +/*+ record Seek (fseekBeginID) +*/ +/*+ +*/ +int HDFtraceFSEEK( FILE *stream, long offset, int whence ) +{ + struct seek_args seekArgs; + int ret; + long arg; + int fd = fileno( stream ); + + if ( IOtracingEnabled ) { + seekArgs.fileID = c_mappedID( fd );; + seekArgs.offset = (int) offset; + seekArgs.whence = whence; + + HDFtraceIOEvent( fseekBeginID, (void *) &seekArgs, sizeof(seekArgs) ); + } + + ret = fseek( stream, offset, whence ); + + if ( IOtracingEnabled ) { + arg = ftell( stream ); + HDFtraceIOEvent( fseekEndID, (void *)&arg, long_SIZE ); + } + + return( ret ); +} + +#ifdef fpos_t +/*+ Routine: int HDFtraceFSETPOS( FILE *stream, const fpos_t *position ) +*/ +/*+ substitute for fsetpos() +*/ +/*+ generates fsetposBeginID, fsetposEndID +*/ +/*+ record Seek (fsetposBeginID) +*/ +/*+ +*/ +int HDFtraceFSETPOS( FILE stream, const fpos_t *position ) +{ + struct seek_args seekArgs; + int ret; + long arg; + int fd = fileno( stream ); + + if ( IOtracingEnabled ) { + seekArgs.fileID = c_mappedID( fd );; + seekArgs.offset = (int) *position; + seekArgs.whence = SEEK_SET; + + HDFtraceIOEvent( fsetposBeginID, (void *) &seekArgs, sizeof(seekArgs) ); + } + + ret = fsetpos( stream, position ); + + if ( IOtracingEnabled ) { + arg = (long) *position; + HDFtraceIOEvent( fsetposEndID, (void *)&arg, long_SIZE ); + } + + return( ret ); +} +#endif /* fpos_t */ + +/*+ Routine: void HDFtraceREWIND ( FILE *stream ) +*/ +/*+ substitute for rewind() +*/ +/*+ generates rewindBeginID, rewindEndID +*/ +/*+ record Seek (rewindBeginID) +*/ +/*+ Offset = 0 +*/ +/*+ Whence = SEEK_SET +*/ +/*+ +*/ +void HDFtraceREWIND( FILE *stream ) +{ + struct seek_args seekArgs; + long arg; + int fd = fileno( stream ); + + if ( IOtracingEnabled ) { + seekArgs.fileID = c_mappedID( fd ); + seekArgs.offset = 0; + seekArgs.whence = SEEK_SET; + + HDFtraceIOEvent( rewindBeginID, (void *) &seekArgs, sizeof(seekArgs) ); + } + + rewind( stream ); + + if ( IOtracingEnabled ) { + arg = 0; + HDFtraceIOEvent( rewindEndID, (void *)&arg, long_SIZE ); + } + + return; +} + +/******************************************************************************/ +/*+ Write routines +*/ +/*+ -------------- +*/ +/*+ +*/ +/*+ Routine: int HDFtraceWRITE( int fd, char *buf, int nbyte ) +*/ +/*+ substitute for write() +*/ +/*+ generates writeBeginID, writeEndID +*/ +/*+ record Write (writeBeginID) +*/ +/*+ Number Variables = 1 +*/ +/*+ Cause = -1 +*/ +/*+ +*/ +size_t HDFtraceWRITE( int fd, const char *buf, int nbyte ) +{ + struct read_write_args writeArgs; + size_t ret; + int bytes; + CLOCK t1, t2, incDur; + + if ( IOtracingEnabled ) { + writeArgs.fileID = c_mappedID( fd ); + writeArgs.numVariables = 1; + writeArgs.cause = -1; + + HDFtraceIOEvent( writeBeginID, (void *) &writeArgs, sizeof(writeArgs) ); + } + + t1 = getClock(); + ret = (size_t)write( fd, buf, nbyte ); + t2 = getClock(); + incDur = clockSubtract(t2,t1); + WriteTotals += clockToSeconds( incDur ); + + if ( IOtracingEnabled ) { + if ( ret > 0 ) { + bytes = (int)ret; + } else { + bytes = 0; + } + HDFtraceIOEvent( writeEndID, (void *) &bytes, int_SIZE ); + } + return( ret ); +} + +/*+ Routine: size_t HDFtraceFWRITE( const char *ptr, int size, int nitems, +*/ +/*+ FILE *stream ) +*/ +/*+ substitute for fwrite() +*/ +/*+ generates fwriteBeginID, fwriteEndID +*/ +/*+ record Write (fwriteBeginID) +*/ +/*+ Number Variables = nitems +*/ +/*+ Cause = -1 +*/ +/*+ +*/ +size_t HDFtraceFWRITE( const char *ptr, int size, int nitems, FILE *stream ) +{ + struct read_write_args writeArgs; + size_t ret; + int nbytes; + int fd = fileno( stream ); + CLOCK t1, t2, incDur; + + if ( IOtracingEnabled ) { + writeArgs.fileID = c_mappedID( fd ); + writeArgs.numVariables = nitems; + writeArgs.cause = -1; + + HDFtraceIOEvent( fwriteBeginID, (void *) &writeArgs, sizeof(writeArgs) ); + } + + t1 = getClock(); + ret = fwrite( ptr, size, nitems, stream ); + t2 = getClock(); + incDur = clockSubtract(t2,t1); + WriteTotals += clockToSeconds( incDur ); + + + if ( IOtracingEnabled ) { + if ( ret > 0 ) { + nbytes = (int)ret * size ; + } else { + nbytes = 0; + } + HDFtraceIOEvent( fwriteEndID, (void *) &nbytes, int_SIZE ); + } + + return( ret ); +} + +/*+ Routine: int HDFtracePUTS( char *s ) +*/ +/*+ substitute for puts() +*/ +/*+ generates fwriteBeginID, fwriteEndID +*/ +/*+ record Write (fwriteBeginID) +*/ +/*+ Number Variables = 1 +*/ +/*+ Cause = -1 +*/ +/*+ +*/ +int HDFtracePUTS( char *s ) +{ + struct read_write_args writeArgs; + int ret; + int fd = fileno( stdout ); + + if ( IOtracingEnabled ) { + writeArgs.fileID = c_mappedID( fd ); + writeArgs.numVariables = 1; + writeArgs.cause = -1; + + HDFtraceIOEvent( fwriteBeginID, (void *) &writeArgs, sizeof(writeArgs) ); + } + + ret = puts( s ); + + if ( IOtracingEnabled ) { + HDFtraceIOEvent( fwriteEndID, (void *) &ret, int_SIZE ); + } + + return( ret ); +} + +/*+ Routine: int HDFtraceFPUTC( int c, FILE *stream ) +*/ +/*+ substitute for fputc() +*/ +/*+ generates fwriteBeginID, fwriteEndID +*/ +/*+ record Write (fwriteBeginID) +*/ +/*+ Number Variables = 1 +*/ +/*+ Cause = -1 +*/ +/*+ +*/ +int HDFtraceFPUTC( int c, FILE *stream ) +{ + struct read_write_args writeArgs; + int ret; + int nbytes = char_SIZE; + int fd = fileno( stream ); + + if ( IOtracingEnabled ) { + writeArgs.fileID = c_mappedID( fd ); + writeArgs.numVariables = 1; + writeArgs.cause = -1; + + HDFtraceIOEvent( fwriteBeginID, (void *) &writeArgs, sizeof(writeArgs) ); + } + + ret = fputc( c, stream ); + + if ( IOtracingEnabled ) { + if ( ret == EOF ) { + nbytes = 0; + HDFtraceIOEvent( fwriteEndID, (void *) &nbytes, int_SIZE ); + } + } + + return( ret ); +} +/*+ Routine: int HDFtraceFPUTS( char *s, FILE *stream ) +*/ +/*+ substitute for fputs() +*/ +/*+ generates fwriteBeginID, fwriteEndID +*/ +/*+ record Write (fwriteBeginID) +*/ +/*+ Number Variables = 1 +*/ +/*+ Cause = -1 +*/ +/*+ +*/ +int HDFtraceFPUTS( const char *s, FILE *stream ) +{ + struct read_write_args writeArgs; + int ret; + int fd = fileno( stream ); + + if ( IOtracingEnabled ) { + writeArgs.fileID = c_mappedID( fd ); + writeArgs.numVariables = 1; + writeArgs.cause = -1; + + HDFtraceIOEvent(fwriteBeginID, (void *)&writeArgs, sizeof(writeArgs)); + } + + ret = fputs( s, stream ); + + if ( IOtracingEnabled ) { + HDFtraceIOEvent( fwriteEndID, (void *) &ret, int_SIZE ); + } + + return( ret ); +} +void *HDFtraceMALLOC(size_t bytes ) +{ + void *ptr; + int byte_req; + byte_req = (int)bytes; + if ( IOtracingEnabled ) { + HDFtraceIOEvent ( ID_malloc, NULL, 0 ); + } + + ptr = malloc( bytes ); + + if ( IOtracingEnabled ) { + HDFtraceIOEvent ( -ID_malloc, &byte_req, sizeof(int) ); + } + + return ptr ; + +} + +void HDFtraceIOEvent( int eventType, void *dataPtr, unsigned dataLen ) +{ + if ( OUTPUT_SWITCH == RUNTIME_TRACE + || OUTPUT_SWITCH == MPI_RUNTIME_TRACE ) { + traceEvent( eventType, dataPtr, dataLen ); + } else { + HDFtraceEvent_RT( eventType, (HDFsetInfo *)dataPtr, dataLen ); + } +} +/*======================================================================* +// record the final time stamp * +//======================================================================*/ +void HDFfinalTimeStamp( void ) +{ + CLOCK currentTime; + double seconds; + struct { + int packetLength, + packetType, + packetTag, + timeDim; + double Seconds; + int eventID, + node, + dataLen; + } Packet; + + currentTime = getClock(); + seconds = clockToSeconds( currentTime ); + + Packet.packetLength = sizeof(Packet); + Packet.packetType = PKT_DATA; + Packet.packetTag = FAMILY_EXTERNAL | RECORD_TRACE; + Packet.timeDim = 0; /* use fp time stamp only */ + Packet.Seconds = seconds; /* fp time stamp */ + Packet.eventID = ID_timeStamp; + Packet.node = TRgetNode(); + Packet.dataLen = 0; + putBytes( (void *)&Packet , sizeof(Packet) ); +} +/*======================================================================* +// This Program is called to specify which routines are to be traced. * +// On first entry, the program allocates storage for and initializes a * +// global array procTrace. The array has one element for each possible * +// HDF5 procedure and HDF5 library file. If a procedure or all of the * +// procedure in an HDF file are to be traced, then the elemen in the * +// array corresponding to the procedure or file is turned on. This is * +// used by the macros TRACE_ON and TRACE_OFF to enable tracing. If * +// this procedure is not called prior to initialization, then all of * +// the elements of procTrace corresponding to HDF 5 files will be * +// turned on, in which case all HDF 5 procedures will be traced. * +//======================================================================*/ +void PabloHDF5Trace( int ID ) +{ + int i; + if ( procTrace == NULL ) { + procTrace = ( int * ) malloc( NUM_HDF5_IDS*sizeof(int) ); + if ( procTrace == NULL ) { + fprintf(stderr,">> Error: Unable to allocate procTrace "); + fprintf(stderr,"array in program PabloHDF5Trace. <<<\n"); + fprintf(stderr," Exiting program. <<<\n"); + exit (-1); + } + for ( i = 0; i < NUM_HDF5_IDS; ++i ) { + procTrace[i] = 0; + } + } + if ( ID >= 0 && ID < NUM_HDF5_IDS ) { + procTrace[ID] = 1; + } else { + fprintf(stderr,">> Error: Value passed to PabloHDF5Trace, "); + fprintf(stderr,"%d, is out of range. <<<\n",ID); + fprintf(stderr," Exiting program. <<<\n"); + exit (-1); + } +} +#ifdef HAVE_PARALLEL +int HDF_XMPI_File_open( MPI_Comm comm, char *filename, int amode, + MPI_Info info, MPI_File *fh ); +int HDF_XMPI_File_close( MPI_File *fh ); +int HDF_XMPI_File_delete( char *filename, MPI_Info info ); +int HDF_XMPI_File_set_size( MPI_File fh, MPI_Offset size ); +int HDF_XMPI_File_preallocate( MPI_File fh, MPI_Offset size); +int HDF_XMPI_File_get_size( MPI_File fh, MPI_Offset *size ); +int HDF_XMPI_File_get_group( MPI_File fh, MPI_Group *group ); +int HDF_XMPI_File_get_amode( MPI_File fh, int *amode ); +int HDF_XMPI_File_set_view( MPI_File fh, MPI_Offset disp, MPI_Datatype etype, + MPI_Datatype filetype, char *datarep, + MPI_Info info ); +int HDF_XMPI_File_get_view( MPI_File fh, MPI_Offset *disp, + MPI_Datatype *etype, MPI_Datatype *filetype, + char *datarep ); +int HDF_XMPI_File_read_at( MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, + MPI_Status *status ); +int HDF_XMPI_File_read_at_all( MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, + MPI_Status *status ); +int HDF_XMPI_File_write_at( MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, + MPI_Status *status ); +int HDF_XMPI_File_write_at_all( MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, + MPI_Status *status ); + +int HDF_XMPI_File_iread_at( MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, + MPIO_Request *request ); +int HDF_XMPI_File_iwrite_at( MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, + MPIO_Request *request ); +int HDF_XMPI_File_read( MPI_File fh, void *buf, int count, + MPI_Datatype datatype, MPI_Status *status ); +int HDF_XMPI_File_read_all( MPI_File fh, void *buf, int count, + MPI_Datatype datatype, MPI_Status *status ); +int HDF_XMPI_File_write( MPI_File fh, void *buf, int count, + MPI_Datatype datatype, MPI_Status *status ); +int HDF_XMPI_File_write_all( MPI_File fh, void *buf, int count, + MPI_Datatype datatype, MPI_Status *status ); +int HDF_XMPI_File_iread( MPI_File fh, void *buf, int count, + MPI_Datatype datatype, MPIO_Request *request ); +int HDF_XMPI_File_iwrite( MPI_File fh, void *buf, int count, + MPI_Datatype datatype, MPIO_Request *request ); +int HDF_XMPI_File_seek( MPI_File fh, + MPI_Offset offset, int whence ) ; +int HDF_XMPI_File_get_position( MPI_File fh, MPI_Offset *offset ); +int HDF_XMPI_File_get_byte_offset( MPI_File fh, MPI_Offset offset, + MPI_Offset *disp) ; +int HDF_XMPI_File_get_type_extent( MPI_File fh, MPI_Datatype datatype, + MPI_Aint *extent ); +int HDF_XMPI_File_set_atomicity( MPI_File fh, int flag ); +int HDF_XMPI_File_get_atomicity( MPI_File fh, int *flag ); +int HDF_XMPI_File_sync( MPI_File fh ); +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_open( MPI_Comm comm, char *filename, int amode, + MPI_Info info, MPI_File *fh ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_open( comm, filename, amode, info, fh ); + } else { + dataLen = sizeof( HDFsetInfo ); + dataPtr.setID = (long)fh; + dataPtr.setName = (char *)malloc( strlen(filename) + 1); + strcpy( dataPtr.setName , filename ); + HDFtraceEvent_RT( mpiOpenBeginID, &dataPtr, dataLen ); + returnVal = PMPI_File_open( comm, filename, amode, info, fh ); + HDFtraceEvent_RT( mpiOpenEndID, &dataPtr, dataLen ); + } + return returnVal; +} + + + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_close( MPI_File *fh ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_close( fh ); + } else { + dataLen = sizeof( HDFsetInfo ); + dataPtr.setID = (long)fh; + dataPtr.setName = NULL; + HDFtraceEvent_RT( mpiCloseBeginID, &dataPtr, dataLen ); + returnVal = PMPI_File_close( fh ); + HDFtraceEvent_RT( mpiCloseEndID, &dataPtr, dataLen ); + free( dataPtr.setName ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_delete( char *filename, MPI_Info info ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_delete( filename, info ); + } else { + dataLen = sizeof( HDFsetInfo ); + dataPtr.setID = 0; + dataPtr.setName = (char *)malloc( sizeof(filename) ); + strcpy( dataPtr.setName , filename ); + HDFtraceEvent_RT( mpiDeleteBeginID, &dataPtr, dataLen ); + returnVal = PMPI_File_delete( filename, info ); + HDFtraceEvent_RT( mpiDeleteEndID, &dataPtr, dataLen ); + free( dataPtr.setName ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_set_size( MPI_File fh, MPI_Offset size ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_set_size( fh, size ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiSetSizeBeginID,&dataPtr,dataLen ); + returnVal = PMPI_File_set_size( fh, size ); + HDFtraceEvent_RT( mpiSetSizeEndID, &dataPtr, dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_preallocate( MPI_File fh, MPI_Offset size) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_preallocate( fh, size); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiPreallocateBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_preallocate( fh, size); + HDFtraceEvent_RT( mpiPreallocateEndID, + &dataPtr, dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_get_size( MPI_File fh, MPI_Offset *size ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_get_size( fh, size); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiGetSizeBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_get_size( fh, size); + HDFtraceEvent_RT( mpiGetSizeEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_get_group( MPI_File fh, MPI_Group *group ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_get_group( fh, group); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiGetGroupBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_get_group( fh, group); + HDFtraceEvent_RT( mpiGetGroupEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_get_amode( MPI_File fh, int *amode ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_get_amode( fh, amode); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiGetAmodeBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_get_amode( fh, amode); + HDFtraceEvent_RT( mpiGetAmodeEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_set_view( MPI_File fh, MPI_Offset disp, MPI_Datatype etype, + MPI_Datatype filetype, char *datarep, MPI_Info info ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_set_view( fh, disp, etype, filetype, + datarep, info ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiSetViewBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_set_view( fh, disp, etype, filetype, + datarep, info ); + HDFtraceEvent_RT( mpiSetViewEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_get_view( MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype, + MPI_Datatype *filetype, char *datarep ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_get_view(fh, disp, etype, filetype, datarep); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiSetViewBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_get_view(fh, disp, etype, filetype, datarep); + HDFtraceEvent_RT( mpiSetViewEndID, + &dataPtr,dataLen ); + returnVal = PMPI_File_get_view(fh, disp, etype, filetype, datarep); + + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_read_at( MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, MPI_Status *status ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_read_at( fh, offset, buf, count, datatype, + status ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiReadAtBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_read_at( fh, offset, buf, count, datatype, + status ); + HDFtraceEvent_RT( mpiReadAtEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_read_at_all( MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, MPI_Status *status ) +{ + + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_read_at_all( fh, offset, buf, + count, datatype, status ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiReadAtAllBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_read_at_all( fh, offset, buf, + count, datatype, status ); + HDFtraceEvent_RT( mpiReadAtAllEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_write_at( MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, MPI_Status *status ) +{ + + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_write_at( fh, offset, buf, count, datatype, + status ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiWriteAtBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_write_at( fh, offset, buf, count, datatype, + status ); + HDFtraceEvent_RT( mpiWriteAtEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_write_at_all( MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, MPI_Status *status ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_write_at_all( fh, offset, buf, + count, datatype, status ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiWriteAtAllBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_write_at_all( fh, offset, buf, + count, datatype, status ); + HDFtraceEvent_RT( mpiWriteAtAllEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_iread_at( MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, MPIO_Request *request ) +{ + return HDF_XMPI_File_iread_at( fh, offset, buf, count, datatype, request ); +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_iwrite_at( MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, MPIO_Request *request) +{ + return HDF_XMPI_File_iwrite_at( fh, offset, buf, count, datatype, request ); +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_read( MPI_File fh, void *buf, int count, + MPI_Datatype datatype, MPI_Status *status) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_read( fh, buf, count, datatype, status ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiReadBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_read( fh, buf, count, datatype, status ); + HDFtraceEvent_RT( mpiReadEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_read_all( MPI_File fh, void *buf, int count, + MPI_Datatype datatype, MPI_Status *status) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_read_all( fh, buf, count, datatype, status ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiReadAllBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_read_all( fh, buf, count, datatype, status ); + HDFtraceEvent_RT( mpiReadAllEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_write( MPI_File fh, void *buf, int count, + MPI_Datatype datatype, MPI_Status *status ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_write( fh, buf, count, datatype, status ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiWriteBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_write( fh, buf, count, datatype, status ); + HDFtraceEvent_RT( mpiWriteEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_write_all( MPI_File fh, void *buf, int count, + MPI_Datatype datatype, MPI_Status *status ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal =HDF_XMPI_File_write_all( fh, buf, count, datatype, status ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiWriteAllBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_write_all( fh, buf, count, datatype, status ); + HDFtraceEvent_RT( mpiWriteAllEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_iread( MPI_File fh, void *buf, int count, + MPI_Datatype datatype, MPIO_Request *request ) +{ + return HDF_XMPI_File_iread( fh, buf, count, datatype, request ); +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_iwrite( MPI_File fh, void *buf, int count, + MPI_Datatype datatype, MPIO_Request *request ) +{ + return HDF_XMPI_File_iwrite( fh, buf, count, datatype, request ); +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_seek( MPI_File fh, MPI_Offset offset, int whence ) +{ + + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_seek( fh, offset, whence ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiSeekBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_seek( fh, offset, whence ); + HDFtraceEvent_RT( mpiSeekEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_get_position( MPI_File fh, MPI_Offset *offset ) +{ + + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_get_position( fh, offset ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiGetPositionBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_get_position( fh, offset ); + HDFtraceEvent_RT( mpiGetPositionEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_get_byte_offset( MPI_File fh, MPI_Offset offset, + MPI_Offset *disp ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_get_byte_offset( fh, offset, disp ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiGetByteOffsetBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_get_byte_offset( fh, offset, disp ); + HDFtraceEvent_RT( mpiGetByteOffsetEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_get_type_extent( MPI_File fh, MPI_Datatype datatype, + MPI_Aint *extent ) +{ + + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_get_type_extent( fh, datatype, extent ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiGetTypeExtentBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_get_type_extent( fh, datatype, extent ); + HDFtraceEvent_RT( mpiGetTypeExtentEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_set_atomicity( MPI_File fh, int flag ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_set_atomicity( fh, flag ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiSetAtomicityBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_set_atomicity( fh, flag ); + HDFtraceEvent_RT( mpiSetAtomicityEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_get_atomicity( MPI_File fh, int *flag ) +{ + + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_get_atomicity( fh, flag ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiGetAtomicityBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_get_atomicity( fh, flag ); + HDFtraceEvent_RT( mpiGetAtomicityEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +/*======================================================================* +// Pass call through to regular MPIO entry except in case of Real Time * +// tracing. * +// Note: The regular MPIO entry may or may not be instrumented. * +//======================================================================*/ +int HDF_MPI_File_sync( MPI_File fh ) +{ + int returnVal; + HDFsetInfo dataPtr; + int dataLen; + + if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) { + returnVal = HDF_XMPI_File_sync ( fh ); + } else { + dataLen = 0; + HDFtraceEvent_RT( mpiSyncBeginID, + &dataPtr,dataLen ); + returnVal = PMPI_File_sync ( fh ); + HDFtraceEvent_RT( mpiSyncEndID, + &dataPtr,dataLen ); + } + return returnVal; +} + +#endif /* HAVE_PARALLEL */ diff --git a/pablo/PabloHDF_RT.c b/pablo/PabloHDF_RT.c index 7daf6b1..c3bbc21 100644 --- a/pablo/PabloHDF_RT.c +++ b/pablo/PabloHDF_RT.c @@ -114,6 +114,7 @@ #include "Trace.h" #include "TraceParam.h" #include "ProcIDs.h" +#include "IO_TraceParams.h" #include "HDF5Trace.h" #include "SDDFparam.h" #include @@ -141,9 +142,12 @@ #ifdef HAVE_PARALLEL #include "mpio.h" +#include "MPIO_TraceParams.h" #include "MPIO_Init.h" #include "MPIO_EventArgs.h" -#include "MPIO_TraceParams.h" +#endif + +#ifdef HAVE_MPIOTRACE #endif #ifndef TRgetThreadID @@ -156,8 +160,6 @@ #define AllThreads -1 -#define set_c_mappedID( fd ) (fd) -#define c_mappedID( fd ) (fd) /*======================================================================* // User output file pointer. * //======================================================================*/ @@ -183,8 +185,8 @@ fileRec_t *HDFfileList; /*======================================================================* // Internal Function prototypes * //======================================================================*/ -void HDFinitTrace_RT( char *, unsigned ); -void HDFendTrace_RT( void ); +void HDFinitTrace_RT( char *, int ); +void HDFendTrace_RT( int ); int initproctracert_( void ); int initHDFProcTrace_RT( void ); void HDFtraceEvent_RT( int , char *, unsigned ) ; @@ -222,14 +224,14 @@ extern char *hdfRecordPointer; // NAME * // HDFinitTrace_RT-- initialize HDF real-time tracing * // USAGE * -// VOID HDFinitTrace_RT( fileName, procTraceMask) * +// VOID HDFinitTrace_RT( fileName, OUTSW ) * // * // char *fileName; IN: name of output file * -// unsigned procTraceMask; IN: families of procedures to trace * +// int OUTSW ; IN: Type of tracing * // RETURNS * // None. * //======================================================================*/ -void HDFinitTrace_RT( char *fileName, unsigned procTraceMask ) +void HDFinitTrace_RT( char *fileName, int OUTSW ) { #ifdef HAVE_PARALLEL int myNode; @@ -239,7 +241,6 @@ void HDFinitTrace_RT( char *fileName, unsigned procTraceMask ) TRgetClock( &epoch ); criticalSection = TRlock(); error = initHDFProcTrace_RT() ; - procTrace = procTraceMask; TRunlock( criticalSection ); if ( error != SUCCESS ) { fprintf (stderr,"Unable to Initialize properly. Exiting program\n"); @@ -247,13 +248,21 @@ void HDFinitTrace_RT( char *fileName, unsigned procTraceMask ) } FileName = ( char * ) malloc ( strlen( fileName ) + 10 ); #ifdef HAVE_PARALLEL - MPI_Comm_rank( MPI_COMM_WORLD, &myNode ); - setTraceProcessorNumber( myNode ); - sprintf(FileName,"%s.nd%d",fileName,myNode); /*==============================================================* - // In the parallel case, initialize MPI-IO tracing. This will * - // set the trace file name. * + // Here the library was built to linked with the MPI and MPIO * + // libraries. However, the use may chose not to run with MPI. * + // A check is made to see if MPI has been initialized. If so, * + // a trace file is assigned to the current node with the number * + // of the node as a suffix; if not, only one file is opened * + // and it is not given a suffix. * //==============================================================*/ + if ( OUTSW == MPI_SUMMARY_TRACE ) { + MPI_Comm_rank( MPI_COMM_WORLD, &myNode ); + setTraceProcessorNumber( myNode ); + sprintf(FileName,"%s.nd%d",fileName,myNode); + } else { + strcpy( FileName, fileName ) ; + } #else /*==============================================================* // In the non-parallel case, set the trace file name and * @@ -272,14 +281,16 @@ void HDFinitTrace_RT( char *fileName, unsigned procTraceMask ) // RETURNS * // None. * //======================================================================*/ -void HDFendTrace_RT( void ) +void HDFendTrace_RT( int OUTSW ) { int j, numSetIDs; HDFnode_t *P; char **Names; char* mapFile; + TR_LOCK criticalSection; HDFfinalTimeStamp(); + criticalSection = TRlock(); /*==============================================================* // Assing pablo ids to named identifiers and tag records * //==============================================================*/ @@ -303,23 +314,7 @@ void HDFendTrace_RT( void ) HDFSummarySDDF( HDFQueues[j], j ); } endTracing(); - /*==============================================================* - // Clean up storage * - //==============================================================*/ - free( (void *)mapFile ); - for ( j = 0; j < numSetIDs; ++j ) { - if ( Names[j] != NULL ) { - free((void *)Names[j]); - } - } - free( (void *)Names ); - P = CallStack; - if ( P->ptr != NULL ) { - fprintf(stderr,"CallStack not empty at termination\n"); - } else { - free((void *)P); - } - free((void *)HDFQueues) ; + TRunlock( criticalSection ); } /*======================================================================* // initHFDProcTrace_RT * @@ -726,6 +721,7 @@ void EndHDFEventRecord ( int eventID, CLOCK secs, void *dataPtr ) HDFnode_t *HDFrec; CLOCK incSecs; static int dummyIDs = -4; + eventID = 0; /*==============================================================* // pop record from top of the stack, compute inclusive duration * // and set the corresponding record field and increment nCalls. * @@ -1114,7 +1110,6 @@ void HDFSummarySDDF( HDFnode_t *P, int procIndex ) arrayLen = 0; /* name length */ memcpy( Packet, &arrayLen, sizeof(int) ); putBytes( buff, Header.packetLen ); - free((void *)P); P = Q; } } @@ -1411,6 +1406,11 @@ void _hdfDescriptorRT( char *recordName, char *recordDescription, void writeHDFRecDescrptrsRT( void ) { char HDFProcNames[][40] = { + "noName", + "noName", + "noName", + "noName", + "noName", # include "HDFentryNames.h" "HDF_Last_Entry" }; diff --git a/pablo/PabloHDF_SDDF.c b/pablo/PabloHDF_SDDF.c index 7c5f272..c2c9119 100644 --- a/pablo/PabloHDF_SDDF.c +++ b/pablo/PabloHDF_SDDF.c @@ -72,7 +72,7 @@ #include "TraceParam.h" #include "Trace.h" #include "HDF5Trace.h" -void HDFendTrace_SDDF(void); +void HDFendTrace_SDDF(int); void startHDFtraceEvent(int eventID); void endHDFtraceEvent(int , int , char *, int ); int preInitHDFProcTrace( void ); @@ -83,7 +83,8 @@ TR_RECORD *HDFprocEventRecord( int, TR_EVENT *, CLOCK, HDFsetInfo *, unsigned ); TR_RECORD *miscEventRecord( int , TR_EVENT *, CLOCK, void *, unsigned ); void _hdfMiscDescriptor( void ); void _hdfProcNameDescriptor( void ); -int setEventRecordFunction( int, void *(*)() ); +/*int setEventRecordFunction( int, void *(*)() );*/ +int setEventRecordFunction( int, TR_RECORD *(*)() ); void HDFtraceIOEvent( int, void *, unsigned ); void initIOTrace( void ); void enableIOdetail( void ); @@ -107,12 +108,14 @@ void endIOTrace( void ); #ifdef HAVE_MPIOTRACE int initMPIOTrace( char *, int ); void endMPIOTrace( void ) ; +#else + void endMPIOTrace( void ) {return;} #endif extern char *hdfRecordPointer; /*======================================================================* // Prototypes of functions in this file. * //======================================================================*/ -void HDFinitTrace_SDDF( char *, uint32 ); +void HDFinitTrace_SDDF( char *, int ); /*======================================================================* // Each procedure being traced has associated with it a distinct pair * // of entry and exit event IDs. This code maintains a vector of such * @@ -191,6 +194,7 @@ struct miscTraceRecordData { // events. * //======================================================================*/ int procEntries[] = { +0, 0, 0, 0, 0, #include "HDFidList.h" ID_HDF_Last_Entry }; @@ -203,6 +207,11 @@ int *procEntryCalled; // The HDFProcNames array holds the names of the HDF entries. * //======================================================================*/ static char HDFProcNames[][40] = { +"noName", +"noName", +"noName", +"noName", +"noName", #include "HDFentryNames.h" "HDF_LAST_ENTRY" }; @@ -218,30 +227,64 @@ static char HDFProcNames[][40] = { // RETURNS * // None * //======================================================================*/ -void HDFinitTrace_SDDF( char *traceFileName, uint32 procTraceMask ) +void HDFinitTrace_SDDF( char *traceFileName, int OUTSW ) { /*=============================================================== // set traceFileName and set IO tracing switches. If MPIO * - // tracing is available, this will be initialized also. * + // tracing is available, MPIO tracing will also be initialized. * //==============================================================*/ #ifdef HAVE_PARALLEL + /*=============================================================== + // The code is built to handle parallel processing using MPI. * + // However, the code may or may not be run using MPI and there * + // may or may not be support for MPIO tracing in the Pablo * + // Trace libraries. The type of initialization performed * + // depends on these factors. * + //==============================================================*/ int myNode; char *buff; /*=============================================================== - // in the parallel case, initialize MPI-IO tracing. This will * - // initialize the traceFileName and set the I/O tracing * - // switches. * + // Determine if MPI is running the program. * //==============================================================*/ - MPI_Comm_rank( MPI_COMM_WORLD, &myNode ); - setTraceProcessorNumber( myNode ); + if ( OUTSW == MPI_RUNTIME_TRACE ) { + /*============================================================ + // in the parallel case, initialize MPI-IO tracing. This * + // will initialize the traceFileName and set the I/O tracing * + // switches. * + //===========================================================*/ + MPI_Comm_rank( MPI_COMM_WORLD, &myNode ); + setTraceProcessorNumber( myNode ); #ifdef HAVE_MPIOTRACE - initMPIOTrace( traceFileName, 0 ); + /*============================================================ + // MPIO Tracing is supported in the Pablo Library. Let the * + // MPIO initialization be performed and handle the naming of * + // trace files. * + //===========================================================*/ + initMPIOTrace( traceFileName, RUNTIME_TRACE ); #else - buff = (char *)malloc( strlen(traceFileName)+12); - sprintf( buff, "%s.nd%.4d\0",traceFileName,myNode); - setTraceFileName( buff ); - free( buff ); + /*============================================================ + // MPIO tracing is not supported. * + // Set up the trace file names depending on the number of * + // current node. * + //===========================================================*/ + buff = (char *)malloc( strlen(traceFileName)+12); + sprintf( buff, "%s.nd%.4d\0",traceFileName,myNode); + setTraceFileName( buff ); + free( buff ); #endif + } else { + /*============================================================ + // The HDF library was built to run with MPI, but the * + // application is being run in serial mode. Initialization * + // is done as in the serial case. * + //===========================================================*/ + setTraceFileName(traceFileName); + initIOTrace(); + enableIOdetail(); + disableLifetimeSummaries(); + disableTimeWindowSummaries(); + disableFileRegionSummaries(); + } #else /*=============================================================== // in the non-parallel case, set the trace file name and the * @@ -259,7 +302,6 @@ void HDFinitTrace_SDDF( char *traceFileName, uint32 procTraceMask ) //==============================================================*/ preInitHDFProcTrace(); initHDFProcTrace( sizeof(procEntries)/sizeof(int), procEntries ); - procTrace = procTraceMask; } /*======================================================================= // NAME * @@ -269,22 +311,23 @@ void HDFinitTrace_SDDF( char *traceFileName, uint32 procTraceMask ) // RETURNS * // None. * //======================================================================*/ -void HDFendTrace_SDDF(void) +void HDFendTrace_SDDF(int OUTSW) { HDFfinalTimeStamp(); -#ifdef HAVE_MPIOTRACE - /*=============================================================== - // termintate MPI-IO tracing in the parallel case. This will * - // terminate the I/O tracing and close tracing as well. * - //==============================================================*/ - endMPIOTrace(); -#else - /*=============================================================== - // terminate tracing * - //==============================================================*/ - endIOTrace(); - endTracing(); -#endif + if ( OUTSW == MPI_RUNTIME_TRACE ) { + /*============================================================ + // termintate MPI-IO tracing in the parallel case. This * + // will terminate the I/O tracing and close tracing as well. * + //===========================================================*/ + endMPIOTrace(); + } else { + /*============================================================ + // terminate tracing * + //===========================================================*/ + endIOTrace(); + endTracing(); + exit(1); + } } /*======================================================================= // NAME * @@ -306,7 +349,7 @@ void HDFendTrace_SDDF(void) //======================================================================*/ int initHDFProcTrace( int numProcs, int *procEntryID ) { - int procIndex; + int procIndex, IX, ID; if (( numProcs <= 0 ) || ( procEntryID == (int *) 0 ) ) return FAILURE; @@ -331,13 +374,13 @@ int initHDFProcTrace( int numProcs, int *procEntryID ) //==============================================================*/ for ( procIndex = 0; procIndex < numProcs; procIndex++ ) { - procEvents[ procIndex ].entryID = procEntryID[ procIndex ]; - procEvents[ procIndex ].exitID = -procEntryID[ procIndex ]; + IX = procEntryID[ procIndex ]; + ID = HDFIXtoEventID( IX ); + procEvents[ procIndex ].entryID = ID; + procEvents[ procIndex ].exitID = -ID; - setEventRecordFunction( procEntryID[ procIndex ], - (void *(*)())HDFprocEventRecord ); - setEventRecordFunction( -procEntryID[ procIndex ], - (void *(*)())HDFprocEventRecord ); + setEventRecordFunction( ID, HDFprocEventRecord ); + setEventRecordFunction( -ID, HDFprocEventRecord ); procEntryCalled[ procIndex ] = 0; } @@ -349,12 +392,12 @@ int initHDFProcTrace( int numProcs, int *procEntryID ) //==============================================================*/ procEvents[ numProcs ].entryID = ID_malloc; procEvents[ numProcs ].exitID = -ID_malloc; - setEventRecordFunction( ID_malloc, (void *(*)())miscEventRecord ); - setEventRecordFunction( -ID_malloc, (void *(*)())miscEventRecord ); + setEventRecordFunction( ID_malloc, miscEventRecord ); + setEventRecordFunction( -ID_malloc, miscEventRecord ); procEvents[ numProcs+1 ].entryID = ID_free; procEvents[ numProcs+1 ].exitID = -ID_free; - setEventRecordFunction( ID_free, (void *(*)())miscEventRecord ); - setEventRecordFunction( -ID_free, (void *(*)())miscEventRecord ); + setEventRecordFunction( ID_free, miscEventRecord ); + setEventRecordFunction( -ID_free, miscEventRecord ); return SUCCESS; } @@ -533,7 +576,7 @@ HDFprocEventRecord( int recordType, TR_EVENT *eventPointer, CLOCK timeStamp, TraceRecordHeader->nameLen = 0; } } else { - TraceRecordHeader->setID = NoDSid; + TraceRecordHeader->setID = 0; TraceRecordHeader->nameLen = 0; } diff --git a/pablo/ProcIDs.h b/pablo/ProcIDs.h index 87e63c0..80d4bef 100644 --- a/pablo/ProcIDs.h +++ b/pablo/ProcIDs.h @@ -81,55 +81,85 @@ #ifndef PROCIDS_H /* avoid re-inclusion */ #define PROCIDS_H -#include "ProcMasks.h" -extern unsigned procTrace; +extern int *procTrace; /* - * Define the event IDs that will be used for the various I/O events + * Define the event IDs that will be used for the various HDF events */ +#include "ProcTrace.h" -/*======================================================================*/ -/* Assign HDF identifier routine tags */ -/*======================================================================*/ -enum HDF_IDS { - ID_HDFprocName=9996, - ID_malloc=9997, - ID_free=9998, - ID_timeStamp=9999, - DUMMY_HDF = 10000, -/*======================================================================*/ -/* the following part of the enumeration is only needed when the */ -/* instrumented HDF library is built. It is created in the pablo */ -/* subdirectory of HDF. */ -/*======================================================================*/ -#include "HDFidList.h" -ID_HDF_Last_Entry -} ; +#define H5_mask ID_H5_c +#define H5A_mask ID_H5A_c +#define H5AC_mask ID_H5AC_c +#define H5B_mask ID_H5B_c +#define H5D_mask ID_H5D_c +#define H5E_mask ID_H5E_c +#define H5F_mask ID_H5F_c +#define H5F_arr_mask ID_H5Farray_c +#define H5F_core_mask ID_H5Fcore_c +#define H5F_family_mask ID_H5Ffamily_c +#define H5F_istore_mask ID_H5Fistore_c +#define H5F_low_mask ID_H5Flow_c +#define H5F_mpio_mask ID_H5Fmpio_c +#define H5F_sec2_mask ID_H5Fsec2_c +#define H5F_split_mask ID_H5Fsplit_c +#define H5F_stdio_mask ID_H5Fstdio_c +#define H5G_mask ID_H5G_c +#define H5G_ent_mask ID_H5Gent_c +#define H5G_node_mask ID_H5Gnode_c +#define H5G_stab_mask ID_H5Gstab_c +#define H5HG_mask ID_H5HG_c +#define H5HL_mask ID_H5HL_c +#define H5I_mask ID_H5I_c +#define H5MF_mask ID_H5MF_c +#define H5MM_mask ID_H5MM_c +#define H5O_mask ID_H5O_c +#define H5O_attr_mask ID_H5Oattr_c +#define H5O_pline_mask ID_H5Ocomp_c +#define H5O_cont_mask ID_H5Ocont_c +#define H5O_dtype_mask ID_H5Odtype_c +#define H5O_efl_mask ID_H5Oefl_c +#define H5O_fill_mask ID_H5Ofill_c +#define H5O_layout_mask ID_H5Olayout_c +#define H5O_mtime_mask ID_H5Omtime_c +#define H5O_name_mask ID_H5Oname_c +#define H5O_null_mask ID_H5Onull_c +#define H5O_sdspace_mask ID_H5Osdspace_c +#define H5O_shared_mask ID_H5Oshared_c +#define H5O_stab_mask ID_H5Ostab_c +#define H5P_mask ID_H5P_c +#define H5R_mask ID_H5R_c +#define H5RA_mask ID_H5RA_c +#define H5S_mask ID_H5S_c +#define H5S_all_mask ID_H5Sall_c +#define H5S_hyper_mask ID_H5Shyper_c +#define H5S_mpio_mask ID_H5Smpio_c +#define H5S_none_mask ID_H5Snone_c +#define H5S_point_mask ID_H5Spoint_c +#define H5S_select_mask ID_H5Sselect_c +#define H5T_mask ID_H5T_c +#define H5TB_mask ID_H5TB_c +#define H5Tbit_mask ID_H5Tbit_c +#define H5T_conv_mask ID_H5Tconv_c +#define H5T_init_mask ID_H5Tinit_c +#define H5V_mask ID_H5V_c +#define H5Z_mask ID_H5Z_c + +#define ID_HDFprocName 9996 +#define ID_malloc 9997 +#define ID_free 9998 +#define ID_timeStamp 9999 +#define DUMMY_HDF 10000 #define BEGIN_HDF (DUMMY_HDF + 1) -#define END_HDF ID_HDF_Last_Entry -#define NumHDFProcs ( END_HDF - BEGIN_HDF ) -/*======================================================================*/ -/* HDF attribute, file, data_set, etc ID codes. May not be used. */ -/*======================================================================*/ -#define NoDSid 0 /* no data set id */ -#define HDF_NULL_ID 0 -#define HDF_File_ID 1 -#define HDF_SDS_ID 2 -#define HDF_Dim_ID 3 -#define HDF_Attribute_ID 4 -#define HDF_Label_ID 5 -#define HDF_Access_ID 6 -#define HDF_Directory_ID 7 -#define HDF_Annotation_ID 8 -#define HDF_Gen_Raster_ID 9 -#define HDF_Look_Up_Table_ID 10 -#define HDF_Vdata_ID 11 +#define END_HDF (ID_HDF_Last_Entry + DUMMY_HDF) +#define NumHDFProcs ( ID_HDF_Last_Entry ) + #define BEGIN_MPIO 900800 #define END_MPIO 900899 /*======================================================================*/ /* Macros to tell if the ID is that of an HDF Entry or Exit */ /*======================================================================*/ -#define isBeginHDFEvent( ID ) ( BEGIN_HDF <= (ID) && (ID) < END_HDF ) +#define isBeginHDFEvent( ID ) ( BEGIN_HDF <= (ID) && (ID) <= END_HDF ) #define isEndHDFEvent( ID ) isBeginHDFEvent(-(ID)) #define isBeginMPIOEvent( ID ) \ ( BEGIN_MPIO <= (ID) && (ID) <= END_MPIO && (ID)%2 == 0 ) @@ -143,11 +173,11 @@ ID_HDF_Last_Entry #define ProcIndex( ID ) ( (ID) - BEGIN_HDF ) #define ProcIndexForHDFEntry( ID ) ( (ID) - BEGIN_HDF ) #define ProcIndexForHDFExit( ID ) ProcIndexForHDFEntry(-ID) -#define HDFProcIXtoEventID( ID ) ( (ID) + BEGIN_HDF ) +#define HDFIXtoEventID( ID ) ( (ID) + BEGIN_HDF ) -#define TRACE_ON(mask, eventID) \ - if (procTrace & mask) startHDFtraceEvent(eventID) -#define TRACE_OFF(mask, eventID ) \ - if (procTrace & mask) endHDFtraceEvent(-eventID, 0, NULL, 0 ) +#define TRACE_ON(mask, ID) \ +if ( procTrace[mask] || procTrace[ID] ) startHDFtraceEvent( HDFIXtoEventID( ID ) ) +#define TRACE_OFF(mask, ID ) \ +if ( procTrace[mask] || procTrace[ID] ) endHDFtraceEvent(-HDFIXtoEventID(ID), 0, NULL, 0 ) #endif /* PROCIDS_H */ diff --git a/pablo/ProcTrace.h b/pablo/ProcTrace.h new file mode 100644 index 0000000..7060725 --- /dev/null +++ b/pablo/ProcTrace.h @@ -0,0 +1,198 @@ +/* This file is part of the Pablo Performance Analysis Environment +// +// (R) +// The Pablo Performance Analysis Environment software is NOT in +// the public domain. However, it is freely available without fee for +// education, research, and non-profit purposes. By obtaining copies +// of this and other files that comprise the Pablo Performance Analysis +// Environment, you, the Licensee, agree to abide by the following +// conditions and understandings with respect to the copyrighted software: +// +// 1. The software is copyrighted in the name of the Board of Trustees +// of the University of Illinois (UI), and ownership of the software +// remains with the UI. +// +// 2. Permission to use, copy, and modify this software and its documentation +// for education, research, and non-profit purposes is hereby granted +// to Licensee, provided that the copyright notice, the original author's +// names and unit identification, and this permission notice appear on +// all such copies, and that no charge be made for such copies. Any +// entity desiring permission to incorporate this software into commercial +// products should contact: +// +// Professor Daniel A. Reed reed@cs.uiuc.edu +// University of Illinois +// Department of Computer Science +// 2413 Digital Computer Laboratory +// 1304 West Springfield Avenue +// Urbana, Illinois 61801 +// USA +// +// 3. Licensee may not use the name, logo, or any other symbol of the UI +// nor the names of any of its employees nor any adaptation thereof in +// advertizing or publicity pertaining to the software without specific +// prior written approval of the UI. +// +// 4. THE UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE +// SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS +// OR IMPLIED WARRANTY. +// +// 5. The UI shall not be liable for any damages suffered by Licensee from +// the use of this software. +// +// 6. The software was developed under agreements between the UI and the +// Federal Government which entitle the Government to certain rights. +// +// ************************************************************************* +// +// Developed by: The Pablo Research Group +// University of Illinois at Urbana-Champaign +// Department of Computer Science +// 1304 W. Springfield Avenue +// Urbana, IL 61801 +// +// http://www-pablo.cs.uiuc.edu +// +// Send comments to: pablo-feedback@guitar.cs.uiuc.edu +// +// Copyright (c) 1987-1998 +// The University of Illinois Board of Trustees. +// All Rights Reserved. +// +// PABLO is a registered trademark of +// The Board of Trustees of the University of Illinois +// registered in the U.S. Patent and Trademark Office. +// +// Project Manager and Principal Investigator: +// Daniel A. Reed (reed@cs.uiuc.edu) +// +// Funded in part by the Defense Advanced Research Projects Agency under +// DARPA contracts DABT63-94-C0049 (SIO Initiative), F30602-96-C-0161, +// and DABT63-96-C-0027 by the National Science Foundation under the PACI +// program and grants NSF CDA 94-01124 and ASC 97-20202, and by the +// Department of Energy under contracts DOE B-341494, W-7405-ENG-48, and +// 1-B-333164. +//-------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------------- + * File: ProcTrace.h + * Purpose: define entities for tracing HDF procedures + *-------------------------------------------------------------------------*/ + +#ifndef PROCTRACE_H /* avoid re-inclusion */ +#define PROCTRACE_H +#include +/*======================================================================* +// By default, all HDF procedures are traced. Tracing of individual * +// procedures or all of the procedures in a particular source file in * +// the HDF 5 library can be done by calling the procedure PabloHDF5trace* +// with the appropriate argument. The call must be made prior to * +// calling HDF5initTrace. As many calls as necessary may be made prior * +// to calling HDF5initTrace so several specific procedures can be * +// traced. * +// PabloHDF5trace has the following syntax. * +// #include "ProcTrace.h" * +// void PabloHDF5trace( int traceID ); * +// where * +// traceID specifies the procedure or procedures within an HDF 5 file * +// that are to be traced. If a single procedure named is to * +// be traced, then traceID should have the value ID_. If all * +// of the procedures within the HDF 5 library routine .c are to * +// be traced, then the value of traceID should be FID_. The * +// constants ID_ and FID_ are declared for all possible * +// values of and below. * +// * +// Example: * +// To enable tracing of the individual procedures H5I_register and * +// H5Topen and all of the procedures in the HDF 5 library source * +// files H5A.c and H5Gent.c the following code segements could be * +// used: * +// * +// #include "ProcTrace.h" * +// ... * +// PabloHDF5trace( ID_H5I_register ); * +// PabloHDF5trace( ID_H5Topenr ); * +// PabloHDF5trace( FID_H5A ); * +// PabloHDF5trace( FID_H5Gent ); * +// ... * +// HDF5initTrace( ... ); * +// * +// See the document PabloHDF5.doc for further information * +//======================================================================*/ +/*======================================================================*/ +/* Assign HDF identifier routine tags */ +/*======================================================================*/ +#ifdef RUNTIME_TRACE +#undef RUNTIME_TRACE +#endif +enum HDF_IDS { +RUNTIME_TRACE, +SUMMARY_TRACE, +MPI_RUNTIME_TRACE, +MPI_SUMMARY_TRACE, +NO_TRACE, +#include "HDFidList.h" +ID_HDF_Last_Entry, +AllHDF5 = ID_HDF_Last_Entry, +ID_H5_c, +ID_H5A_c, +ID_H5AC_c, +ID_H5B_c, +ID_H5D_c, +ID_H5E_c, +ID_H5F_c, +ID_H5Farray_c, +ID_H5Fcore_c, +ID_H5Ffamily_c, +ID_H5Fistore_c, +ID_H5Flow_c, +ID_H5Fmpio_c, +ID_H5Fsec2_c, +ID_H5Fsplit_c, +ID_H5Fstdio_c, +ID_H5G_c, +ID_H5Gent_c, +ID_H5Gnode_c, +ID_H5Gstab_c, +ID_H5HG_c, +ID_H5HL_c, +ID_H5I_c, +ID_H5MF_c, +ID_H5MM_c, +ID_H5O_c, +ID_H5Oattr_c, +ID_H5Ocomp_c, +ID_H5Ocont_c, +ID_H5Odtype_c, +ID_H5Oefl_c, +ID_H5Ofill_c, +ID_H5Olayout_c, +ID_H5Omtime_c, +ID_H5Oname_c, +ID_H5Onull_c, +ID_H5Osdspace_c, +ID_H5Oshared_c, +ID_H5Ostab_c, +ID_H5P_c, +ID_H5R_c, +ID_H5RA_c, +ID_H5S_c, +ID_H5Sall_c, +ID_H5Shyper_c, +ID_H5Smpio_c, +ID_H5Snone_c, +ID_H5Spoint_c, +ID_H5Sselect_c, +ID_H5T_c, +ID_H5TB_c, +ID_H5Tbit_c, +ID_H5Tconv_c, +ID_H5Tinit_c, +ID_H5V_c, +ID_H5Z_c, +NUM_HDF5_IDS +} ; + +void PabloHDF5Trace( int ) ; +void HDF5initTrace( const char *, int trace_id, ... ); +void HDF5endTrace( void ); +#endif /* PROCTRACE_H */ -- cgit v0.12