diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-08-19 22:46:31 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-08-19 22:46:31 (GMT) |
commit | e455040749ca1d47fb218b9bb35d78247fb9561d (patch) | |
tree | 2d26f2ae1fea1ff393f00eb36e3f2155dec690b6 /src | |
parent | 4322bfe90ab7de7245ff770155867fa5da78147c (diff) | |
download | hdf5-e455040749ca1d47fb218b9bb35d78247fb9561d.zip hdf5-e455040749ca1d47fb218b9bb35d78247fb9561d.tar.gz hdf5-e455040749ca1d47fb218b9bb35d78247fb9561d.tar.bz2 |
[svn-r606] Debugging can be enabled/disabled at runtime though code is still
conditionally included at compile time. Tracing and debugging share
the same environment variable. All is documented in Debugging.html.
Diffstat (limited to 'src')
-rw-r--r-- | src/.distdep | 624 | ||||
-rw-r--r-- | src/H5.c | 137 | ||||
-rw-r--r-- | src/H5AC.c | 105 | ||||
-rw-r--r-- | src/H5B.c | 2 | ||||
-rw-r--r-- | src/H5D.c | 14 | ||||
-rw-r--r-- | src/H5Distore.c | 23 | ||||
-rw-r--r-- | src/H5E.c | 1 | ||||
-rw-r--r-- | src/H5F.c | 31 | ||||
-rw-r--r-- | src/H5Ffamily.c | 22 | ||||
-rw-r--r-- | src/H5Fistore.c | 23 | ||||
-rw-r--r-- | src/H5Flow.c | 6 | ||||
-rw-r--r-- | src/H5Fprivate.h | 2 | ||||
-rw-r--r-- | src/H5HL.c | 23 | ||||
-rw-r--r-- | src/H5MF.c | 16 | ||||
-rw-r--r-- | src/H5O.c | 12 | ||||
-rw-r--r-- | src/H5S.c | 138 | ||||
-rw-r--r-- | src/H5T.c | 45 | ||||
-rw-r--r-- | src/H5Z.c | 80 | ||||
-rw-r--r-- | src/H5private.h | 43 |
19 files changed, 765 insertions, 582 deletions
diff --git a/src/.distdep b/src/.distdep index 9f9d5a9..e5d6c0d 100644 --- a/src/.distdep +++ b/src/.distdep @@ -1,34 +1,3 @@ -H5.o: \ - H5.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Iprivate.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Pprivate.h \ - H5Ppublic.h \ - H5Zpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h H5A.o: \ H5A.c \ H5private.h \ @@ -62,111 +31,6 @@ H5A.o: \ H5Ppublic.h \ H5Apkg.h \ H5Aprivate.h -H5AC.o: \ - H5AC.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Eprivate.h \ - H5Epublic.h -H5B.o: \ - H5B.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MFprivate.h \ - H5MFpublic.h \ - H5MMprivate.h -H5D.o: \ - H5D.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Dprivate.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5HLprivate.h \ - H5HLpublic.h \ - H5MFprivate.h \ - H5MFpublic.h -H5E.o: \ - H5E.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Eprivate.h -H5F.o: \ - H5F.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Aprivate.h \ - H5Apublic.h \ - H5Ipublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5Dprivate.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Iprivate.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MMprivate.h \ - H5MMpublic.h H5Farray.o: \ H5Farray.c \ H5private.h \ @@ -203,55 +67,6 @@ H5Fcore.o: \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h -H5Ffamily.o: \ - H5Ffamily.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h -H5Fistore.o: \ - H5Fistore.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Dprivate.h \ - H5Dpublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ - H5Zprivate.h \ - H5Zpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MFprivate.h \ - H5MFpublic.h -H5Flow.o: \ - H5Flow.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ - H5MMprivate.h \ - H5MMpublic.h H5Fmpio.o: \ H5Fmpio.c \ H5private.h \ @@ -450,24 +265,6 @@ H5HG.o: \ H5MFprivate.h \ H5MFpublic.h \ H5MMprivate.h -H5HL.o: \ - H5HL.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5HLprivate.h \ - H5HLpublic.h \ - H5MFprivate.h \ - H5MFpublic.h \ - H5MMprivate.h H5I.o: \ H5I.c \ H5private.h \ @@ -476,14 +273,6 @@ H5I.o: \ H5Iprivate.h \ H5Ipublic.h \ H5Eprivate.h -H5MF.o: \ - H5MF.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5Ipublic.h H5MM.o: \ H5MM.c \ H5private.h \ @@ -492,34 +281,6 @@ H5MM.o: \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h -H5O.o: \ - H5O.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5ACprivate.h \ - H5ACpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Ipublic.h \ - H5Dpublic.h \ - H5Eprivate.h \ - H5Epublic.h \ - H5MFprivate.h \ - H5MFpublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h \ - H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Sprivate.h H5Oattr.o: \ H5Oattr.c \ H5private.h \ @@ -829,31 +590,31 @@ H5P.o: \ H5Eprivate.h \ H5Epublic.h \ H5MMprivate.h -H5S.o: \ - H5S.c \ +H5Sall.o: \ + H5Sall.c \ H5private.h \ H5public.h \ H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ H5Eprivate.h \ H5Epublic.h \ - H5MMprivate.h \ - H5MMpublic.h \ - H5Oprivate.h \ - H5Opublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ + H5Ipublic.h \ + H5Sprivate.h \ + H5Spublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ - H5Tprivate.h -H5Sall.o: \ - H5Sall.c \ + H5Tprivate.h \ + H5Tpublic.h +H5Shyper.o: \ + H5Shyper.c \ H5private.h \ H5public.h \ H5config.h \ @@ -875,14 +636,16 @@ H5Sall.o: \ H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h -H5Shyper.o: \ - H5Shyper.c \ +H5Spoint.o: \ + H5Spoint.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ H5Sprivate.h \ H5Spublic.h \ H5Gprivate.h \ @@ -895,17 +658,18 @@ H5Shyper.o: \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ - H5HGpublic.h \ - H5Tprivate.h \ - H5Tpublic.h -H5Smpio.o: \ - H5Smpio.c \ + H5HGpublic.h +H5Sselect.o: \ + H5Sselect.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ + H5Iprivate.h \ + H5MMprivate.h \ + H5MMpublic.h \ H5Sprivate.h \ H5Spublic.h \ H5Gprivate.h \ @@ -920,60 +684,245 @@ H5Smpio.o: \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ - H5Tpublic.h -H5Spoint.o: \ - H5Spoint.c \ + H5Tpublic.h \ + H5Zprivate.h \ + H5Zpublic.h +H5Tbit.o: \ + H5Tbit.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ + H5Iprivate.h \ + H5Tpkg.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Gprivate.h +H5Tconv.o: \ + H5Tconv.c \ + H5Iprivate.h \ + H5Ipublic.h \ + H5public.h \ + H5config.h \ + H5private.h \ + H5Eprivate.h \ + H5Epublic.h \ H5MMprivate.h \ H5MMpublic.h \ - H5Sprivate.h \ - H5Spublic.h \ + H5Tpkg.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ - H5Bpublic.h \ + H5Bpublic.h +H5Tinit.o: \ + H5Tinit.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Iprivate.h \ + H5Ipublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h \ + H5MMpublic.h \ + H5Tpkg.h \ + H5HGprivate.h \ + H5HGpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ + H5Tprivate.h +H5TB.o: \ + H5TB.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Iprivate.h \ + H5Ipublic.h \ + H5Eprivate.h +H5V.o: \ + H5V.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h \ H5Oprivate.h \ H5Opublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ H5HGprivate.h \ - H5HGpublic.h -H5Sselect.o: \ - H5Sselect.c \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h +H5.o: \ + H5.c \ H5private.h \ H5public.h \ H5config.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ H5Eprivate.h \ H5Epublic.h \ - H5Ipublic.h \ H5Iprivate.h \ H5MMprivate.h \ H5MMpublic.h \ + H5Pprivate.h \ + H5Ppublic.h \ + H5Zpublic.h \ H5Sprivate.h \ H5Spublic.h \ H5Gprivate.h \ H5Gpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h +H5AC.o: \ + H5AC.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ + H5Eprivate.h \ + H5Epublic.h +H5B.o: \ + H5B.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ H5Bprivate.h \ H5Bpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MFprivate.h \ + H5MFpublic.h \ + H5MMprivate.h +H5D.o: \ + H5D.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Iprivate.h \ + H5Ipublic.h \ + H5ACprivate.h \ + H5ACpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ + H5Dprivate.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ H5Oprivate.h \ H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ H5Zprivate.h \ - H5Zpublic.h -H5T.o: \ - H5T.c \ + H5Zpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5HLprivate.h \ + H5HLpublic.h \ + H5MFprivate.h \ + H5MFpublic.h +H5E.o: \ + H5E.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Iprivate.h \ + H5Ipublic.h \ + H5Eprivate.h +H5F.o: \ + H5F.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Aprivate.h \ + H5Apublic.h \ + H5Ipublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ + H5Dprivate.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Iprivate.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h \ + H5MMpublic.h +H5Ffamily.o: \ + H5Ffamily.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h +H5Fistore.o: \ + H5Fistore.c \ H5private.h \ H5public.h \ H5config.h \ @@ -996,53 +945,79 @@ H5T.o: \ H5Spublic.h \ H5Zprivate.h \ H5Zpublic.h \ - H5Iprivate.h \ H5Eprivate.h \ H5Epublic.h \ - H5MMprivate.h -H5Tbit.o: \ - H5Tbit.c \ + H5MFprivate.h \ + H5MFpublic.h +H5Flow.o: \ + H5Flow.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ - H5Iprivate.h \ - H5Tpkg.h \ - H5HGprivate.h \ - H5HGpublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ - H5Tprivate.h \ - H5Tpublic.h \ - H5Gprivate.h -H5Tconv.o: \ - H5Tconv.c \ - H5Iprivate.h \ + H5MMprivate.h \ + H5MMpublic.h +H5HL.o: \ + H5HL.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ H5Ipublic.h \ + H5Dpublic.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5HLprivate.h \ + H5HLpublic.h \ + H5MFprivate.h \ + H5MFpublic.h \ + H5MMprivate.h +H5MF.o: \ + H5MF.c \ + H5private.h \ H5public.h \ H5config.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5Ipublic.h +H5O.o: \ + H5O.c \ H5private.h \ + H5public.h \ + H5config.h \ + H5ACprivate.h \ + H5ACpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Ipublic.h \ + H5Dpublic.h \ H5Eprivate.h \ H5Epublic.h \ + H5MFprivate.h \ + H5MFpublic.h \ H5MMprivate.h \ H5MMpublic.h \ - H5Tpkg.h \ + H5Oprivate.h \ + H5Opublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ H5HGprivate.h \ H5HGpublic.h \ - H5Fprivate.h \ - H5Fpublic.h \ - H5Dpublic.h \ H5Tprivate.h \ H5Tpublic.h \ - H5Gprivate.h \ - H5Gpublic.h \ - H5Bprivate.h \ - H5Bpublic.h -H5Tinit.o: \ - H5Tinit.c \ + H5Sprivate.h +H5S.o: \ + H5S.c \ H5private.h \ H5public.h \ H5config.h \ @@ -1052,44 +1027,69 @@ H5Tinit.o: \ H5Epublic.h \ H5MMprivate.h \ H5MMpublic.h \ - H5Tpkg.h \ - H5HGprivate.h \ - H5HGpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5Fprivate.h \ H5Fpublic.h \ H5Dpublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ H5Tprivate.h -H5TB.o: \ - H5TB.c \ - H5private.h \ - H5public.h \ - H5config.h \ - H5Iprivate.h \ - H5Ipublic.h \ - H5Eprivate.h -H5V.o: \ - H5V.c \ +H5Smpio.o: \ + H5Smpio.c \ H5private.h \ H5public.h \ H5config.h \ H5Eprivate.h \ H5Epublic.h \ H5Ipublic.h \ + H5Sprivate.h \ + H5Spublic.h \ + H5Gprivate.h \ + H5Gpublic.h \ + H5Bprivate.h \ + H5Bpublic.h \ + H5Fprivate.h \ + H5Fpublic.h \ + H5Dpublic.h \ H5Oprivate.h \ H5Opublic.h \ + H5HGprivate.h \ + H5HGpublic.h \ + H5Tprivate.h \ + H5Tpublic.h +H5T.o: \ + H5T.c \ + H5private.h \ + H5public.h \ + H5config.h \ + H5Dprivate.h \ + H5Dpublic.h \ + H5Ipublic.h \ H5Fprivate.h \ H5Fpublic.h \ - H5Dpublic.h \ H5Gprivate.h \ H5Gpublic.h \ H5Bprivate.h \ H5Bpublic.h \ + H5Oprivate.h \ + H5Opublic.h \ H5HGprivate.h \ H5HGpublic.h \ H5Tprivate.h \ H5Tpublic.h \ H5Sprivate.h \ - H5Spublic.h + H5Spublic.h \ + H5Zprivate.h \ + H5Zpublic.h \ + H5Iprivate.h \ + H5Eprivate.h \ + H5Epublic.h \ + H5MMprivate.h H5Z.o: \ H5Z.c \ H5private.h \ @@ -62,7 +62,8 @@ FILE *fdopen(int fd, const char *mode); hbool_t library_initialize_g = FALSE; hbool_t thread_initialize_g = FALSE; hbool_t install_atexit_g = TRUE; -static FILE *H5_trace_g = NULL; +H5_debug_t H5_debug_g; /*debugging info */ +static void H5_debug_mask(const char*); typedef struct H5_exit { void (*func) (void); /* Interface function to call during exit */ @@ -91,14 +92,40 @@ DESCRIPTION herr_t H5_init_library(void) { + const char *s = NULL; + FUNC_ENTER_INIT(H5_init_library, NULL, FAIL); - /* Install atexit() library cleanup routine */ - if (install_atexit_g == TRUE) - if (HDatexit(&H5_term_library) != 0) - HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, - "unable to register atexit function"); + /* + * Make sure the package information is updated. + */ + HDmemset(&H5_debug_g, 0, sizeof H5_debug_g); + H5_debug_g.pkg[H5_PKG_A].name = "a"; + H5_debug_g.pkg[H5_PKG_AC].name = "ac"; + H5_debug_g.pkg[H5_PKG_B].name = "b"; + H5_debug_g.pkg[H5_PKG_D].name = "d"; + H5_debug_g.pkg[H5_PKG_E].name = "e"; + H5_debug_g.pkg[H5_PKG_F].name = "f"; + H5_debug_g.pkg[H5_PKG_G].name = "g"; + H5_debug_g.pkg[H5_PKG_HG].name = "hg"; + H5_debug_g.pkg[H5_PKG_HL].name = "hl"; + H5_debug_g.pkg[H5_PKG_I].name = "i"; + H5_debug_g.pkg[H5_PKG_MF].name = "mf"; + H5_debug_g.pkg[H5_PKG_MM].name = "mm"; + H5_debug_g.pkg[H5_PKG_O].name = "o"; + H5_debug_g.pkg[H5_PKG_P].name = "p"; + H5_debug_g.pkg[H5_PKG_S].name = "s"; + H5_debug_g.pkg[H5_PKG_T].name = "t"; + H5_debug_g.pkg[H5_PKG_V].name = "v"; + H5_debug_g.pkg[H5_PKG_Z].name = "z"; + /* Install atexit() library cleanup routine */ + if (install_atexit_g == TRUE && + HDatexit(&H5_term_library) != 0) { + HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, + "unable to register atexit function"); + } + /* * Initialize interfaces that might not be able to initialize themselves * soon enough. @@ -108,16 +135,9 @@ H5_init_library(void) "unable to initialize type interface"); } -#ifdef H5_DEBUG_API - { - /* Turn on tracing? */ - const char *s = getenv ("HDF5_TRACE"); - if (s && isdigit(*s)) { - int fd = (int)HDstrtol (s, NULL, 0); - H5_trace_g = HDfdopen (fd, "w"); - } - } -#endif + /* Debugging? */ + H5_debug_mask("-all"); + H5_debug_mask(getenv("HDF5_DEBUG")); FUNC_LEAVE(SUCCEED); } @@ -297,10 +317,91 @@ H5dont_atexit(void) install_atexit_g = FALSE; FUNC_LEAVE(SUCCEED); -} /* end H5dont_atexit() */ +} /*------------------------------------------------------------------------- + * Function: H5_debug_mask + * + * Purpose: Set runtime debugging flags according to the string S. The + * string should contain file numbers and package names + * separated by other characters. A file number applies to all + * following package names up to the next file number. The + * initial file number is `2' (the standard error stream). Each + * package name can be preceded by a `+' or `-' to add or remove + * the package from the debugging list (`+' is the default). The + * special name `all' means all packages. + * + * The name `trace' indicates that API tracing is to be turned + * on or off. + * + * Return: void + * + * Programmer: Robb Matzke + * Wednesday, August 19, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +H5_debug_mask(const char *s) +{ + FILE *stream = stderr; + char pkg_name[32], *rest; + int i, clear; + + while (s && *s) { + if (isalpha(*s) || '-'==*s || '+'==*s) { + /* Enable or Disable debugging? */ + if ('-'==*s) { + clear = TRUE; + s++; + } else if ('+'==*s) { + clear = FALSE; + s++; + } else { + clear = FALSE; + } + + /* Get the name */ + for (i=0; isalpha(*s); i++, s++) { + if (i<sizeof pkg_name) pkg_name[i] = *s; + } + pkg_name[MIN(sizeof(pkg_name)-1, i)] = '\0'; + + /* Trace, all, or one? */ + if (!strcmp(pkg_name, "trace")) { + H5_debug_g.trace = clear?NULL:stream; + } else if (!strcmp(pkg_name, "all")) { + for (i=0; i<H5_NPKGS; i++) { + H5_debug_g.pkg[i].stream = clear?NULL:stream; + } + } else { + for (i=0; i<H5_NPKGS; i++) { + if (!strcmp(H5_debug_g.pkg[i].name, pkg_name)) { + H5_debug_g.pkg[i].stream = clear?NULL:stream; + break; + } + } + if (i>=H5_NPKGS) { + fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); + } + } + + } else if (isdigit(*s)) { + int fd = (int)HDstrtol (s, &rest, 0); + stream = HDfdopen (fd, "w"); + setvbuf (stream, NULL, _IOLBF, 0); + s = rest; + } else { + s++; + } + } +} + + +/*------------------------------------------------------------------------- * Function: H5version * * Purpose: Returns the library version numbers through arguments. MAJNUM @@ -1058,7 +1159,7 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...) hssize_t asize[16]; hssize_t i; void *vp = NULL; - FILE *out = H5_trace_g; + FILE *out = H5_debug_g.trace; if (!out) return; /*tracing is off*/ va_start (ap, type); @@ -649,9 +649,9 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, H5AC_slot_t *slot = NULL; #ifdef H5AC_DEBUG - static int ncalls = 0; + static int ncalls = 0; if (0 == ncalls++) { - fprintf(stderr, "H5AC: debugging cache (expensive)\n"); + fprintf(stderr, "H5AC: debugging cache (expensive)\n"); } #endif @@ -857,55 +857,58 @@ H5AC_debug(H5F_t __unused__ *f) FUNC_ENTER(H5AC_debug, FAIL); #ifdef H5AC_DEBUG - fprintf(stderr, "H5AC: meta data cache statistics for file %s\n", f->name); - fprintf(stderr, " %-18s %8s %8s %8s %8s+%-8s\n", - "Layer", "Hits", "Misses", "MissRate", "Inits", "Flushes"); - fprintf(stderr, " %-18s %8s %8s %8s %8s-%-8s\n", - "-----", "----", "------", "--------", "-----", "-------"); - - for (i = H5AC_BT_ID; i < H5AC_NTYPES; i++) { - - switch (i) { - case H5AC_BT_ID: - strcpy(s, "B-tree nodes"); - break; - case H5AC_SNODE_ID: - strcpy(s, "symbol table nodes"); - break; - case H5AC_LHEAP_ID: - strcpy (s, "local heaps"); - break; - case H5AC_GHEAP_ID: - strcpy (s, "global heaps"); - break; - case H5AC_OHDR_ID: - strcpy(s, "object headers"); - break; - default: - sprintf(s, "unknown id %d", i); - } - - if (cache->diagnostics[i].nhits>0 || - cache->diagnostics[i].nmisses>0) { - miss_rate = 100.0 * cache->diagnostics[i].nmisses / - (cache->diagnostics[i].nhits+ - cache->diagnostics[i].nmisses); - } else { - miss_rate = 0.0; - } - - if (miss_rate > 100) { - sprintf(ascii, "%7d%%", (int) (miss_rate + 0.5)); - } else { - sprintf(ascii, "%7.2f%%", miss_rate); - } - fprintf(stderr, " %-18s %8u %8u %7s %8u%+-9ld\n", s, - cache->diagnostics[i].nhits, - cache->diagnostics[i].nmisses, - ascii, - cache->diagnostics[i].ninits, - ((long)(cache->diagnostics[i].nflushes) - - (long)(cache->diagnostics[i].ninits))); + if (H5DEBUG(AC)) { + fprintf(H5DEBUG(AC), "H5AC: meta data cache statistics for file %s\n", + f->name); + fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n", + "Layer", "Hits", "Misses", "MissRate", "Inits", "Flushes"); + fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n", + "-----", "----", "------", "--------", "-----", "-------"); + + for (i = H5AC_BT_ID; i < H5AC_NTYPES; i++) { + + switch (i) { + case H5AC_BT_ID: + strcpy(s, "B-tree nodes"); + break; + case H5AC_SNODE_ID: + strcpy(s, "symbol table nodes"); + break; + case H5AC_LHEAP_ID: + strcpy (s, "local heaps"); + break; + case H5AC_GHEAP_ID: + strcpy (s, "global heaps"); + break; + case H5AC_OHDR_ID: + strcpy(s, "object headers"); + break; + default: + sprintf(s, "unknown id %d", i); + } + + if (cache->diagnostics[i].nhits>0 || + cache->diagnostics[i].nmisses>0) { + miss_rate = 100.0 * cache->diagnostics[i].nmisses / + (cache->diagnostics[i].nhits+ + cache->diagnostics[i].nmisses); + } else { + miss_rate = 0.0; + } + + if (miss_rate > 100) { + sprintf(ascii, "%7d%%", (int) (miss_rate + 0.5)); + } else { + sprintf(ascii, "%7.2f%%", miss_rate); + } + fprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8u%+-9ld\n", s, + cache->diagnostics[i].nhits, + cache->diagnostics[i].nmisses, + ascii, + cache->diagnostics[i].ninits, + ((long)(cache->diagnostics[i].nflushes) - + (long)(cache->diagnostics[i].ninits))); + } } #endif @@ -1680,7 +1680,7 @@ H5B_assert(H5F_t *f, const haddr_t *addr, const H5B_class_t *type, } *head = NULL, *tail = NULL, *prev = NULL, *cur = NULL, *tmp = NULL; FUNC_ENTER(H5B_assert, FAIL); - if (0 == ncalls++) { + if (0==ncalls++) { fprintf(stderr, "H5B: debugging B-trees (expensive)\n"); } /* Initialize the queue */ @@ -1370,8 +1370,11 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, "collective read failed"); #endif #ifdef H5D_DEBUG - fprintf (stderr, "H5D: data space conversion could not be optimized " - "for this case (using general method instead)\n"); + if (H5DEBUG(D)) { + fprintf (H5DEBUG(D), "H5D: data space conversion could not be " + "optimized for this case (using general method " + "instead)\n"); + } #endif H5E_clear (); } @@ -1715,8 +1718,11 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, "collective write failed"); #endif #ifdef H5D_DEBUG - fprintf (stderr, "H5D: data space conversion could not be optimized " - "for this case (using general method instead)\n"); + if (H5DEBUG(D)) { + fprintf (H5DEBUG(D), "H5D: data space conversion could not be " + "optimized for this case (using general method " + "instead)\n"); + } #endif H5E_clear (); } diff --git a/src/H5Distore.c b/src/H5Distore.c index efeb7d7..94d3590 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -1699,7 +1699,7 @@ H5F_istore_create(H5F_t *f, H5O_layout_t *layout /*out */ ) /*------------------------------------------------------------------------- * Function: H5F_istore_stats * - * Purpose: Print raw data cache statistics to the stderr stream. If + * Purpose: Print raw data cache statistics to the debug stream. If * HEADERS is non-zero then print table column headers, * otherwise assume that the H5AC layer has already printed them. * @@ -1722,23 +1722,22 @@ H5F_istore_stats (H5F_t *f, hbool_t headers) char ascii[32]; FUNC_ENTER (H5F_istore_stats, FAIL); + if (!H5DEBUG(AC)) HRETURN(SUCCEED); if (headers) { - fprintf(stderr, "H5F: raw data cache statistics for file %s\n", + fprintf(H5DEBUG(AC), "H5F: raw data cache statistics for file %s\n", f->name); - fprintf(stderr, " %-18s %8s %8s %8s %8s+%-8s\n", + fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n", "Layer", "Hits", "Misses", "MissRate", "Inits", "Flushes"); - fprintf(stderr, " %-18s %8s %8s %8s %8s-%-8s\n", + fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n", "-----", "----", "------", "--------", "-----", "-------"); } -#ifndef H5AC_DEBUG - /* - * If we're not debugging the H5AC layer then print these statistics only - * if we printed the headers that go with them. - */ - if (headers) { +#ifdef H5AC_DEBUG + if (H5DEBUG(AC)) headers = TRUE; #endif + + if (headers) { if (rdcc->nhits>0 || rdcc->nmisses>0) { miss_rate = 100.0 * rdcc->nmisses / (rdcc->nhits + rdcc->nmisses); @@ -1751,12 +1750,10 @@ H5F_istore_stats (H5F_t *f, hbool_t headers) sprintf(ascii, "%7.2f%%", miss_rate); } - fprintf(stderr, " %-18s %8u %8u %7s %8d+%-9ld\n", + fprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n", "raw data chunks", rdcc->nhits, rdcc->nmisses, ascii, rdcc->ninits, (long)(rdcc->nflushes)-(long)(rdcc->ninits)); -#ifndef H5AC_DEBUG } -#endif FUNC_LEAVE (SUCCEED); } @@ -123,7 +123,6 @@ H5E_t H5E_stack_g[1]; * Automatic error stack traversal occurs if the traversal callback function * is non null and an API function is about to return an error. These should * probably be part of the error stack so they're local to a thread. - * */ herr_t (*H5E_auto_g)(void*) = (herr_t(*)(void*))H5Eprint; void *H5E_auto_data_g = stderr; @@ -1062,11 +1062,10 @@ H5F_open(const char *name, uintn flags, * hdf5 data. */ #ifdef H5F_DEBUG - fprintf(stderr, "H5F: resetting EOF from "); - H5F_addr_print(stderr, &addr1); - fprintf(stderr, " to "); - H5F_addr_print(stderr, &addr2); - fprintf(stderr, " (abs)\n"); + if (H5DEBUG(F)) { + HDfprintf(H5DEBUG(F), "H5F: resetting EOF from %a to %a (abs)\n", + &addr1, &addr2); + } #endif H5F_low_seteof(f->shared->lf, &addr2); } @@ -1531,19 +1530,23 @@ H5F_close(H5F_t *f) * forgetting to close everything is not a major problem. */ if (f->nopen>0) { -#ifndef NDEBUG - fprintf(stderr, "H5F: H5F_close(%s): %u object header%s still " - "open (file close will complete when %s closed)\n", - f->name, - f->nopen, - 1 == f->nopen ? " is" : "s are", - 1 == f->nopen ? "that header is" : "those headers are"); +#ifdef H5F_DEBUG + if (H5DEBUG(F)) { + fprintf(H5DEBUG(F), "H5F: H5F_close(%s): %u object header%s still " + "open (file close will complete when %s closed)\n", + f->name, + f->nopen, + 1 == f->nopen ? " is" : "s are", + 1 == f->nopen ? "that header is" : "those headers are"); + } #endif f->close_pending = TRUE; HRETURN(SUCCEED); } else if (f->close_pending) { -#ifndef NDEBUG - fprintf(stderr, "H5F: H5F_close: operation completed\n"); +#ifdef H5F_DEBUG + if (H5DEBUG(F)) { + fprintf(H5DEBUG(F), "H5F: H5F_close: operation completed\n"); + } #endif } diff --git a/src/H5Ffamily.c b/src/H5Ffamily.c index fd876c0..464ffa1 100644 --- a/src/H5Ffamily.c +++ b/src/H5Ffamily.c @@ -177,9 +177,11 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms, * the same as the actual member size, but at least 1kB */ #ifdef H5F_DEBUG - HDfprintf (stderr, "H5F: family member size has been increased " - "from %a to %a\n", &(access_parms->u.fam.memb_size), - &tmp_addr); + if (H5DEBUG(F)) { + HDfprintf (H5DEBUG(F), "H5F: family member size has been " + "increased from %a to %a\n", + &(access_parms->u.fam.memb_size), &tmp_addr); + } #endif if (tmp_addr.offset<1024) tmp_addr.offset = 1024; lf->u.fam.memb_size = tmp_addr; @@ -198,8 +200,11 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms, * member as the member size. */ #ifdef H5F_DEBUG - HDfprintf (stderr, "H5F: family member size adjusted from %a to %a\n", - &(access_parms->u.fam.memb_size), &tmp_addr); + if (H5DEBUG(F)) { + HDfprintf (H5DEBUG(F), "H5F: family member size adjusted from " + "%a to %a\n", &(access_parms->u.fam.memb_size), + &tmp_addr); + } #endif lf->u.fam.memb_size = tmp_addr; for (membno=1; membno<lf->u.fam.nmemb; membno++) { @@ -221,9 +226,10 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms, * member size but on a 32-bit machine this isn't possible. The largest * file on a 32-bit machine is 2^32-1. */ - if (lf->u.fam.memb_size.offset == ((size_t)1<<(sizeof(off_t)-1))) { - HDfprintf (stderr, "H5F: family member size may be too large: %a\n", - &(lf->u.fam.memb_size)); + if (H5DEBUG(F) && + lf->u.fam.memb_size.offset == ((size_t)1<<(sizeof(off_t)-1))) { + HDfprintf(H5DEBUG(F), "H5F: family member size may be too large: %a\n", + &(lf->u.fam.memb_size)); } #endif diff --git a/src/H5Fistore.c b/src/H5Fistore.c index efeb7d7..94d3590 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -1699,7 +1699,7 @@ H5F_istore_create(H5F_t *f, H5O_layout_t *layout /*out */ ) /*------------------------------------------------------------------------- * Function: H5F_istore_stats * - * Purpose: Print raw data cache statistics to the stderr stream. If + * Purpose: Print raw data cache statistics to the debug stream. If * HEADERS is non-zero then print table column headers, * otherwise assume that the H5AC layer has already printed them. * @@ -1722,23 +1722,22 @@ H5F_istore_stats (H5F_t *f, hbool_t headers) char ascii[32]; FUNC_ENTER (H5F_istore_stats, FAIL); + if (!H5DEBUG(AC)) HRETURN(SUCCEED); if (headers) { - fprintf(stderr, "H5F: raw data cache statistics for file %s\n", + fprintf(H5DEBUG(AC), "H5F: raw data cache statistics for file %s\n", f->name); - fprintf(stderr, " %-18s %8s %8s %8s %8s+%-8s\n", + fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n", "Layer", "Hits", "Misses", "MissRate", "Inits", "Flushes"); - fprintf(stderr, " %-18s %8s %8s %8s %8s-%-8s\n", + fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n", "-----", "----", "------", "--------", "-----", "-------"); } -#ifndef H5AC_DEBUG - /* - * If we're not debugging the H5AC layer then print these statistics only - * if we printed the headers that go with them. - */ - if (headers) { +#ifdef H5AC_DEBUG + if (H5DEBUG(AC)) headers = TRUE; #endif + + if (headers) { if (rdcc->nhits>0 || rdcc->nmisses>0) { miss_rate = 100.0 * rdcc->nmisses / (rdcc->nhits + rdcc->nmisses); @@ -1751,12 +1750,10 @@ H5F_istore_stats (H5F_t *f, hbool_t headers) sprintf(ascii, "%7.2f%%", miss_rate); } - fprintf(stderr, " %-18s %8u %8u %7s %8d+%-9ld\n", + fprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n", "raw data chunks", rdcc->nhits, rdcc->nmisses, ascii, rdcc->ninits, (long)(rdcc->nflushes)-(long)(rdcc->ninits)); -#ifndef H5AC_DEBUG } -#endif FUNC_LEAVE (SUCCEED); } diff --git a/src/H5Flow.c b/src/H5Flow.c index 5ddc299..73a5125 100644 --- a/src/H5Flow.c +++ b/src/H5Flow.c @@ -312,7 +312,11 @@ H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms, tmp_addr = *addr; H5F_addr_inc(&tmp_addr, (hsize_t)size); if (H5F_addr_gt(&tmp_addr, &(lf->eof))) { - fprintf(stderr, "H5F: extending file w/o allocation\n"); +#ifdef H5F_DEBUG + if (H5DEBUG(F)) { + fprintf(H5DEBUG(F), "H5F: extending file w/o allocation\n"); + } +#endif lf->eof = tmp_addr; } #ifdef HAVE_PARALLEL diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 1dba61c..396b448 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -36,7 +36,7 @@ /* * Feature: Define this constant on the compiler command-line if you want to - * see some debugging messages on stderr. + * see some debugging messages on the debug stream. */ #ifdef NDEBUG # undef H5F_DEBUG @@ -643,8 +643,8 @@ H5HL_insert(H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf) if (max_fl->size < H5HL_SIZEOF_FREE(f)) { #ifdef H5HL_DEBUG - if (max_fl->size) { - fprintf(stderr, "H5HL: lost %lu bytes at line %d\n", + if (H5DEBUG(HL) && max_fl->size) { + fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes at line %d\n", (unsigned long)(max_fl->size), __LINE__); } #endif @@ -670,17 +670,21 @@ H5HL_insert(H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf) if (heap->freelist) heap->freelist->prev = fl; heap->freelist = fl; #ifdef H5HL_DEBUG - } else if (need_more > need_size) { - fprintf(stderr, "H5HL_insert: lost %lu bytes at line %d\n", + } else if (H5DEBUG(HL) && need_more > need_size) { + fprintf(H5DEBUG(HL), + "H5HL_insert: lost %lu bytes at line %d\n", (unsigned long)(need_more - need_size), __LINE__); #endif } } #ifdef H5HL_DEBUG - fprintf(stderr, "H5HL: resize mem buf from %lu to %lu bytes\n", - (unsigned long)(heap->mem_alloc), - (unsigned long)(heap->mem_alloc + need_more)); + if (H5DEBUG(HL)) { + fprintf(H5DEBUG(HL), + "H5HL: resize mem buf from %lu to %lu bytes\n", + (unsigned long)(heap->mem_alloc), + (unsigned long)(heap->mem_alloc + need_more)); + } #endif old_size = heap->mem_alloc; heap->mem_alloc += need_more; @@ -859,7 +863,10 @@ H5HL_remove(H5F_t *f, const haddr_t *addr, size_t offset, size_t size) */ if (size < H5HL_SIZEOF_FREE(f)) { #ifdef H5HL_DEBUG - fprintf(stderr, "H5HL: lost %lu bytes\n", (unsigned long) size); + if (H5DEBUG(HL)) { + fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n", + (unsigned long) size); + } #endif HRETURN(SUCCEED); } @@ -71,12 +71,7 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/) assert(H5MF_META == op || H5MF_RAW == op); assert(size > 0); assert(addr); - -#if 0 - HDfprintf (stderr, "A %Hu\n", size); -#endif - /* Fail if we don't have write access */ if (0==(f->intent & H5F_ACC_RDWR)) { HRETURN_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "file is read-only"); @@ -226,8 +221,11 @@ H5MF_xfree(H5F_t *f, const haddr_t *addr, hsize_t size) for (i=0; i<H5MF_NFREE; i++) { if (f->shared->fl_free[i].size<size) { #ifdef H5MF_DEBUG - fprintf(stderr, "H5MF_free: lost %lu bytes of file storage\n", - (unsigned long) f->shared->fl_free[i].size); + if (H5DEBUG(MF)) { + fprintf(H5DEBUG(MF), + "H5MF_free: lost %lu bytes of file storage\n", + (unsigned long) f->shared->fl_free[i].size); + } #endif f->shared->fl_free[i].addr = *addr; f->shared->fl_free[i].size = size; @@ -315,8 +313,8 @@ H5MF_realloc (H5F_t *f, intn op, hsize_t orig_size, const haddr_t *orig_addr, } else { /* New size is not larger */ #ifdef H5MF_DEBUG - if (new_size<orig_size) { - HDfprintf (stderr, "H5MF: realloc lost %Hd bytes\n", + if (H5DEBUG(MF) && new_size<orig_size) { + HDfprintf (H5DEBUG(MF), "H5MF: realloc lost %Hd bytes\n", orig_size-new_size); } #endif @@ -238,9 +238,9 @@ H5O_open(H5G_entry_t *obj_ent) assert(obj_ent->file); #ifdef H5O_DEBUG - fprintf(stderr, ">"); - H5F_addr_print(stderr, &(obj_ent->header)); - fprintf(stderr, "\n"); + if (H5DEBUG(O)) { + HDfprintf(H5DEBUG(O), "> %a\n", &(obj_ent->header)); + } #endif /* Increment open-lock counters */ @@ -286,9 +286,9 @@ H5O_close(H5G_entry_t *obj_ent) H5F_close(obj_ent->file); } #ifdef H5O_DEBUG - fprintf(stderr, "<"); - H5F_addr_print(stderr, &(obj_ent->header)); - fprintf(stderr, "\n"); + if (H5DEBUG(O)) { + HDfprintf(H5DEBUG(O), "< %a\n", &(obj_ent->header)); + } #endif FUNC_LEAVE(SUCCEED); @@ -105,73 +105,77 @@ H5S_term_interface(void) /* * Print statistics about each conversion path. */ - for (i=0; i<H5S_nconv_g; i++) { - path = H5S_conv_g[i]; - for (j=0; j<2; j++) { - if (0==path->stats[j].gath_ncalls && - 0==path->stats[j].scat_ncalls && - 0==path->stats[j].bkg_ncalls) { - continue; - } - if (0==nprints++) { - fprintf(stderr, "H5S: data space conversion statistics " - "accumulated over life of library:\n"); - fprintf(stderr, " %-16s %10s %10s %8s %8s %8s %10s\n", - "Memory <> File", "Bytes", "Calls", - "User", "System", "Elapsed", "Bandwidth"); - fprintf(stderr, " %-16s %10s %10s %8s %8s %8s %10s\n", - "--------------", "-----", "-----", - "----", "------", "-------", "---------"); - } - - /* Summary */ - sprintf(buf, "%s %c %s", - path->m->name, 0==j?'>':'<', path->f->name); - fprintf(stderr, " %-16s\n", buf); - - /* Gather */ - if (path->stats[j].gath_ncalls) { - H5_bandwidth(buf, (double)(path->stats[j].gath_nbytes), - path->stats[j].gath_timer.etime); - HDfprintf(stderr, - " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n", - "gather", - path->stats[j].gath_nbytes, - path->stats[j].gath_ncalls, - path->stats[j].gath_timer.utime, - path->stats[j].gath_timer.stime, - path->stats[j].gath_timer.etime, - buf); - } - - /* Scatter */ - if (path->stats[j].scat_ncalls) { - H5_bandwidth(buf, (double)(path->stats[j].scat_nbytes), - path->stats[j].scat_timer.etime); - HDfprintf(stderr, - " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n", - "scatter", - path->stats[j].scat_nbytes, - path->stats[j].scat_ncalls, - path->stats[j].scat_timer.utime, - path->stats[j].scat_timer.stime, - path->stats[j].scat_timer.etime, - buf); - } - - /* Background */ - if (path->stats[j].bkg_ncalls) { - H5_bandwidth(buf, (double)(path->stats[j].bkg_nbytes), - path->stats[j].bkg_timer.etime); - HDfprintf(stderr, - " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n", - "background", - path->stats[j].bkg_nbytes, - path->stats[j].bkg_ncalls, - path->stats[j].bkg_timer.utime, - path->stats[j].bkg_timer.stime, - path->stats[j].bkg_timer.etime, - buf); + if (H5DEBUG(S)) { + for (i=0; i<H5S_nconv_g; i++) { + path = H5S_conv_g[i]; + for (j=0; j<2; j++) { + if (0==path->stats[j].gath_ncalls && + 0==path->stats[j].scat_ncalls && + 0==path->stats[j].bkg_ncalls) { + continue; + } + if (0==nprints++) { + fprintf(H5DEBUG(S), "H5S: data space conversion " + "statistics accumulated over life of library:\n"); + fprintf(H5DEBUG(S), + " %-16s %10s %10s %8s %8s %8s %10s\n", + "Memory <> File", "Bytes", "Calls", + "User", "System", "Elapsed", "Bandwidth"); + fprintf(H5DEBUG(S), + " %-16s %10s %10s %8s %8s %8s %10s\n", + "--------------", "-----", "-----", + "----", "------", "-------", "---------"); + } + + /* Summary */ + sprintf(buf, "%s %c %s", + path->m->name, 0==j?'>':'<', path->f->name); + fprintf(H5DEBUG(S), " %-16s\n", buf); + + /* Gather */ + if (path->stats[j].gath_ncalls) { + H5_bandwidth(buf, (double)(path->stats[j].gath_nbytes), + path->stats[j].gath_timer.etime); + HDfprintf(H5DEBUG(S), + " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n", + "gather", + path->stats[j].gath_nbytes, + path->stats[j].gath_ncalls, + path->stats[j].gath_timer.utime, + path->stats[j].gath_timer.stime, + path->stats[j].gath_timer.etime, + buf); + } + + /* Scatter */ + if (path->stats[j].scat_ncalls) { + H5_bandwidth(buf, (double)(path->stats[j].scat_nbytes), + path->stats[j].scat_timer.etime); + HDfprintf(H5DEBUG(S), + " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n", + "scatter", + path->stats[j].scat_nbytes, + path->stats[j].scat_ncalls, + path->stats[j].scat_timer.utime, + path->stats[j].scat_timer.stime, + path->stats[j].scat_timer.etime, + buf); + } + + /* Background */ + if (path->stats[j].bkg_ncalls) { + H5_bandwidth(buf, (double)(path->stats[j].bkg_nbytes), + path->stats[j].bkg_timer.etime); + HDfprintf(H5DEBUG(S), + " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n", + "background", + path->stats[j].bkg_nbytes, + path->stats[j].bkg_ncalls, + path->stats[j].bkg_timer.utime, + path->stats[j].bkg_timer.stime, + path->stats[j].bkg_timer.etime, + buf); + } } } } @@ -727,20 +727,24 @@ H5T_term_interface(void) path->cdata.command = H5T_CONV_FREE; if ((path->func)(FAIL, FAIL, &(path->cdata), 0, NULL, NULL)<0) { #ifdef H5T_DEBUG - fprintf (stderr, "H5T: conversion function failed " - "to free private data\n"); + if (H5DEBUG(T)) { + fprintf (H5DEBUG(T), "H5T: conversion function failed " + "to free private data\n"); + } #endif H5E_clear(); /*ignore the error*/ } #ifdef H5T_DEBUG - if (path->cdata.stats->ncalls>0) { + if (H5DEBUG(T) && path->cdata.stats->ncalls>0) { if (0==nprint++) { - HDfprintf (stderr, "H5T: type conversion statistics " + HDfprintf (H5DEBUG(T), "H5T: type conversion statistics " "accumulated over life of library:\n"); - HDfprintf (stderr, " %-16s %10s %10s %8s %8s %8s %10s\n", + HDfprintf (H5DEBUG(T), + " %-16s %10s %10s %8s %8s %8s %10s\n", "Conversion", "Elmts", "Calls", "User", "System", "Elapsed", "Bandwidth"); - HDfprintf (stderr, " %-16s %10s %10s %8s %8s %8s %10s\n", + HDfprintf (H5DEBUG(T), + " %-16s %10s %10s %8s %8s %8s %10s\n", "----------", "-----", "-----", "----", "------", "-------", "---------"); } @@ -749,7 +753,7 @@ H5T_term_interface(void) nbytes *= path->cdata.stats->nelmts; H5_bandwidth(bandwidth, (double)nbytes, path->cdata.stats->timer.etime); - HDfprintf (stderr, + HDfprintf (H5DEBUG(T), " %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n", path->name, path->cdata.stats->nelmts, @@ -770,21 +774,22 @@ H5T_term_interface(void) #ifdef H5T_DEBUG /* Print debugging infor for the `noop' conversion */ - if (H5T_conv_noop==H5T_find(NULL, NULL, H5T_BKG_NO, &cdata)) { + if (H5DEBUG(T) && + H5T_conv_noop==H5T_find(NULL, NULL, H5T_BKG_NO, &cdata)) { if (cdata->stats->ncalls>0) { if (0==nprint++) { - HDfprintf (stderr, "H5T: type conversion statistics " + HDfprintf (H5DEBUG(T), "H5T: type conversion statistics " "accumulated over life of library:\n"); - HDfprintf (stderr, " %-16s %10s %10s %8s %8s %8s %10s\n", + HDfprintf (H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", "Conversion", "Elmts", "Calls", "User", "System", "Elapsed", "Bandwidth"); - HDfprintf (stderr, " %-16s %10s %10s %8s %8s %8s %10s\n", + HDfprintf (H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", "----------", "-----", "-----", "----", "------", "-------", "---------"); } nbytes = cdata->stats->nelmts; H5_bandwidth(bandwidth, (double)nbytes, cdata->stats->timer.etime); - HDfprintf (stderr, + HDfprintf (H5DEBUG(T), " %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n", "no-op", cdata->stats->nelmts, @@ -3091,8 +3096,10 @@ H5Tregister_soft (const char *name, H5T_class_t src_cls, H5T_class_t dst_cls, if ((path->func)(src_id, dst_id, &(path->cdata), 0, NULL, NULL)<0) { #ifdef H5T_DEBUG - fprintf (stderr, "H5T: conversion function failed " - "to free private data.\n"); + if (H5DEBUG(T)) { + fprintf (H5DEBUG(T), "H5T: conversion function failed " + "to free private data.\n"); + } #endif H5E_clear(); } @@ -3170,8 +3177,10 @@ H5Tunregister (H5T_conv_t func) path->cdata.command = H5T_CONV_FREE; if ((func)(FAIL, FAIL, &(path->cdata), 0, NULL, NULL)<0) { #ifdef H5T_DEBUG - fprintf (stderr, "H5T: conversion function failed to " + if (H5DEBUG(T)) { + fprintf (H5DEBUG(T), "H5T: conversion function failed to " "free private data.\n"); + } #endif H5E_clear(); } @@ -4486,8 +4495,10 @@ H5T_path_find(const char *name, const H5T_t *src, const H5T_t *dst, } if ((func)(src_id, dst_id, &(path->cdata), 0, NULL, NULL)<0) { #ifdef H5T_DEBUG - fprintf (stderr, "H5T: conversion function init " - "failed\n"); + if (H5DEBUG(T)) { + fprintf (H5DEBUG(T), "H5T: conversion function init " + "failed\n"); + } #endif H5E_clear(); /*ignore the failure*/ } @@ -86,45 +86,49 @@ H5Z_term_interface (void) int dir, nprint=0; char comment[16], bandwidth[32]; - for (i=0; i<H5Z_table_used_g; i++) { - for (dir=0; dir<2; dir++) { - if (0==H5Z_table_g[i].stats[dir].total) continue; - - if (0==nprint++) { - /* Print column headers */ - HDfprintf (stderr, "H5Z: filter statistics accumulated " - "over life of library:\n"); - HDfprintf (stderr, " %-16s %10s %10s %8s %8s %8s %10s\n", - "Filter", "Total", "Errors", "User", - "System", "Elapsed", "Bandwidth"); - HDfprintf (stderr, " %-16s %10s %10s %8s %8s %8s %10s\n", - "------", "-----", "------", "----", - "------", "-------", "---------"); - } + if (H5DEBUG(Z)) { + for (i=0; i<H5Z_table_used_g; i++) { + for (dir=0; dir<2; dir++) { + if (0==H5Z_table_g[i].stats[dir].total) continue; + + if (0==nprint++) { + /* Print column headers */ + HDfprintf (H5DEBUG(Z), "H5Z: filter statistics " + "accumulated over life of library:\n"); + HDfprintf (H5DEBUG(Z), + " %-16s %10s %10s %8s %8s %8s %10s\n", + "Filter", "Total", "Errors", "User", + "System", "Elapsed", "Bandwidth"); + HDfprintf (H5DEBUG(Z), + " %-16s %10s %10s %8s %8s %8s %10s\n", + "------", "-----", "------", "----", + "------", "-------", "---------"); + } - /* Truncate the comment to fit in the field */ - strncpy(comment, H5Z_table_g[i].name, sizeof comment); - comment[sizeof(comment)-1] = '\0'; - - /* - * Format bandwidth to have four significant digits and units - * of `B/s', `kB/s', `MB/s', `GB/s', or `TB/s' or the word - * `Inf' if the elapsed time is zero. - */ - H5_bandwidth(bandwidth, - (double)(H5Z_table_g[i].stats[dir].total), - H5Z_table_g[i].stats[dir].timer.etime); - - /* Print the statistics */ - HDfprintf (stderr, - " %s%-15s %10Hd %10Hd %8.2f %8.2f %8.2f " - "%10s\n", dir?"<":">", comment, - H5Z_table_g[i].stats[dir].total, - H5Z_table_g[i].stats[dir].errors, - H5Z_table_g[i].stats[dir].timer.utime, - H5Z_table_g[i].stats[dir].timer.stime, - H5Z_table_g[i].stats[dir].timer.etime, - bandwidth); + /* Truncate the comment to fit in the field */ + strncpy(comment, H5Z_table_g[i].name, sizeof comment); + comment[sizeof(comment)-1] = '\0'; + + /* + * Format bandwidth to have four significant digits and units + * of `B/s', `kB/s', `MB/s', `GB/s', or `TB/s' or the word + * `Inf' if the elapsed time is zero. + */ + H5_bandwidth(bandwidth, + (double)(H5Z_table_g[i].stats[dir].total), + H5Z_table_g[i].stats[dir].timer.etime); + + /* Print the statistics */ + HDfprintf (H5DEBUG(Z), + " %s%-15s %10Hd %10Hd %8.2f %8.2f %8.2f " + "%10s\n", dir?"<":">", comment, + H5Z_table_g[i].stats[dir].total, + H5Z_table_g[i].stats[dir].errors, + H5Z_table_g[i].stats[dir].timer.utime, + H5Z_table_g[i].stats[dir].timer.stime, + H5Z_table_g[i].stats[dir].timer.etime, + bandwidth); + } } } #endif diff --git a/src/H5private.h b/src/H5private.h index 0b2aba8..e0147e5 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -472,6 +472,49 @@ int64 HDstrtoll (const char *s, const char **rest, int base); extern char *strdup(const char *s); #define HDstrdup(S) strdup(S) +/* + * These macros check whether debugging has been requested for a certain + * package at run-time. Code for debugging is conditionally compiled by + * defining constants like `H5X_DEBUG'. In order to see the output though + * the code must be enabled at run-time with an environment variable + * HDF5_DEBUG which is a list of packages to debug. + * + * Note: If you add/remove items from this enum then be sure to update the + * information about the package in H5_init_library(). + */ +typedef enum { + H5_PKG_A, /*Attributes */ + H5_PKG_AC, /*Meta data cache */ + H5_PKG_B, /*B-trees */ + H5_PKG_D, /*Datasets */ + H5_PKG_E, /*Error handling */ + H5_PKG_F, /*Files */ + H5_PKG_G, /*Groups */ + H5_PKG_HG, /*Global heap */ + H5_PKG_HL, /*Local heap */ + H5_PKG_I, /*Interface */ + H5_PKG_MF, /*File memory management */ + H5_PKG_MM, /*Core memory management */ + H5_PKG_O, /*Object headers */ + H5_PKG_P, /*Property lists */ + H5_PKG_S, /*Data spaces */ + H5_PKG_T, /*Data types */ + H5_PKG_V, /*Vector functions */ + H5_PKG_Z, /*Raw data filters */ + H5_NPKGS /*Must be last */ +} H5_pkg_t; + +typedef struct H5_debug_t { + FILE *trace; /*API trace output stream */ + struct { + const char *name; /*package name */ + FILE *stream; /*output stream or NULL */ + } pkg[H5_NPKGS]; +} H5_debug_t; + +extern H5_debug_t H5_debug_g; +#define H5DEBUG(X) (H5_debug_g.pkg[H5_PKG_##X].stream) + /*------------------------------------------------------------------------- * Purpose: These macros are inserted automatically just after the * FUNC_ENTER() macro of API functions and are used to trace |