summaryrefslogtreecommitdiff
path: root/dbug
diff options
context:
space:
mode:
Diffstat (limited to 'dbug')
-rw-r--r--dbug/Makefile.am4
-rw-r--r--dbug/dbug.c8
-rw-r--r--dbug/monty.doc13
-rw-r--r--dbug/readme.prof70
4 files changed, 10 insertions, 85 deletions
diff --git a/dbug/Makefile.am b/dbug/Makefile.am
index 39e8bb36c71..872ebdb7902 100644
--- a/dbug/Makefile.am
+++ b/dbug/Makefile.am
@@ -20,8 +20,8 @@ LDADD = libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a
pkglib_LIBRARIES = libdbug.a
noinst_HEADERS = dbug_long.h
libdbug_a_SOURCES = dbug.c sanity.c
-EXTRA_DIST = example1.c example2.c example3.c \
- user.r monty.doc readme.prof dbug_add_tags.pl \
+EXTRA_DIST = CMakeLists.txt example1.c example2.c example3.c \
+ user.r monty.doc dbug_add_tags.pl \
my_main.c main.c factorial.c dbug_analyze.c \
CMakeLists.txt
NROFF_INC = example1.r example2.r example3.r main.r \
diff --git a/dbug/dbug.c b/dbug/dbug.c
index baf080f5e27..1cebbbcf72a 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -1851,7 +1851,13 @@ static void DBUGOpenFile(CODE_STATE *cs,
else
{
newfile= !EXISTS(name);
- if (!(fp= fopen(name, append ? "a+" : "w")))
+ if (!(fp= fopen(name,
+#if defined(MSDOS) || defined(__WIN__)
+ append ? "a+c" : "wc"
+#else
+ append ? "a+" : "w"
+#endif
+ )))
{
(void) fprintf(stderr, ERR_OPEN, cs->process, name);
perror("");
diff --git a/dbug/monty.doc b/dbug/monty.doc
index bd4096951d2..1af67b81d42 100644
--- a/dbug/monty.doc
+++ b/dbug/monty.doc
@@ -1,15 +1,3 @@
-Some extra options to DBUG_PUSH:
-
-O,logfile - As in "o,logfile", but do a close and reopen each time anything
- is written to the logfile. This is needed when one expects
- the program to crash anywhere, in which case one doesn't
- (at least in MSDOS) get a full log-file.
-
-If one wants a logfile with a ':' in the filename, one can get it by
-giving a double ':'. (As in "O,c::\tmp\log")
-
-DBUG_DUMP("keyword",memory-position,length) writes a hexdump of the
-given memory-area to the outputfile.
All changes that I or other people at MySQL AB have done to all files
in the dbug library (Mainly in dbug.c, dbug_analyze.c, dbug_long.h,
@@ -18,3 +6,4 @@ dbug.h) are put in public domain, as the rest of the dbug.c library)
To my knowledge, all code in dbug library is in public domain.
Michael Widenius
+
diff --git a/dbug/readme.prof b/dbug/readme.prof
deleted file mode 100644
index cfffe376857..00000000000
--- a/dbug/readme.prof
+++ /dev/null
@@ -1,70 +0,0 @@
-Hi,
-
-I'm sending you the modifications I made to your Dbug routines to
-allow profiling in a (relatively) machine independent fashion.
-I use your Dbug routines fairly extensively. Unfortunately, it's
-a royal pain to have to keep profiled versions of various libraries
-around. The modifications allow profiling without the need for this.
-
-How it works.
-------------
-
-Basically, I just added code in the dbug routines to write out a file
-called dbugmon.out (by default). This is an ascii file containing lines
-of the form:
-
-<function-name> E <time-entered>
-<function-name> X <time-exited>
-
-A second program (analyze) reads this file, and produces a report on
-standard output.
-
-Profiling is enabled through the `g' flag. It can take a list of
-procedure names for which profiling is enabled. By default, it
-profiles all procedures.
-
-The code in ``dbug.c'' opens the profile file for appending. This
-is in order that one can run a program several times, and get the
-sum total of all the times, etc.
-
-The only system dependent part that I'm aware of is the routine
-Clock() at the end of dbug.c. This returns the elapsed user time
-in milliseconds. The version which I have is for 4.3 BSD. As I
-don't have access to other systems, I'm not certain how this would
-change.
-
-An example of the report generated follows:
-
- Profile of Execution
- Execution times are in milliseconds
-
- Calls Time
- ----- ----
- Times Percentage Time Spent Percentage
-Function Called of total in Function of total Importance
-======== ====== ========== =========== ========== ==========
-factorial 5 83.33 30 100.00 8333
-main 1 16.67 0 0.00 0
-======== ====== ========== =========== ==========
-Totals 6 100.00 30 100.00
-
-
-As you can see, it's quite self-evident. The ``Importance'' column is a
-metric obtained by multiplying the percentage of the calls and the percentage
-of the time. Functions with higher 'importance' benefit the most from
-being sped up.
-
-I'm really not certain how to add support for setjmp/longjmp, or for
-child processes, so I've ignored that for the time being. In most of
-the code that I write, it isn't necessary. If you have any good ideas,
-feel free to add them.
-
-This has been very useful to me. If you can use it as part of your
-dbug distribution, please feel free to do so.
-
-Regards,
-
- Binayak Banerjee
- {allegra | astrovax | bpa | burdvax}!sjuvax!bbanerje
- bbanerje%sjuvax.sju.edu@relay.cs.net
- July 9, 1987