[MLton-commit] r4678
Stephen Weeks
MLton@mlton.org
Wed, 5 Jul 2006 16:07:54 -0700
A couple more bugfixes to get profiling working.
----------------------------------------------------------------------
U mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/profile.sml
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h
----------------------------------------------------------------------
Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/profile.sml
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/profile.sml 2006-07-05 19:57:40 UTC (rev 4677)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/profile.sml 2006-07-05 23:07:49 UTC (rev 4678)
@@ -71,7 +71,9 @@
else if !isFreed then
raise Fail "write of freed profile data"
else
- P.Data.write (gcState, raw, Primitive.NullString8.fromString file)
+ P.Data.write (gcState, raw,
+ Primitive.NullString8.fromString
+ (String.nullTerm file))
end
val r: Data.t ref = ref (Data.make P.Data.dummy)
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c 2006-07-05 19:57:40 UTC (rev 4677)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c 2006-07-05 23:07:49 UTC (rev 4678)
@@ -244,13 +244,13 @@
writeNewline (f);
}
-void GC_profileWrite (GC_state s, GC_profileData p, NullString8_t fileName) {
+void GC_profileWrite (GC_state s, GC_profileData p, const char *fileName) {
FILE *f;
const char* kind;
if (DEBUG_PROFILE)
fprintf (stderr, "GC_profileWrite\n");
- f = fopen_safe ((const char*)fileName, "wb");
+ f = fopen_safe (fileName, "wb");
writeString (f, "MLton prof\n");
kind = "";
switch (s->profiling.kind) {
@@ -390,16 +390,14 @@
static GC_state atexitForProfilingState;
void atexitForProfiling (void) {
- FILE *f;
GC_state s;
if (DEBUG_PROFILE)
fprintf (stderr, "atexitForProfiling ()\n");
s = atexitForProfilingState;
if (s->profiling.isOn) {
- f = fopen_safe ("mlmon.out", "wb");
- GC_profileWrite (s, s->profiling.data, f);
- fclose_safe (f);
+ fprintf (stderr, "profiling is on\n");
+ GC_profileWrite (s, s->profiling.data, "mlmon.out");
}
}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h 2006-07-05 19:57:40 UTC (rev 4677)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h 2006-07-05 23:07:49 UTC (rev 4678)
@@ -116,7 +116,7 @@
void GC_setProfileCurrent (GC_state s, GC_profileData p);
GC_profileData GC_profileMalloc (GC_state s);
-void GC_profileWrite (GC_state s, GC_profileData p, NullString8_t fileName);
+void GC_profileWrite (GC_state s, GC_profileData p, const char *fileName);
void GC_profileFree (GC_state s, GC_profileData p);
void GC_profileDone (GC_state s);