Commit 8def8755 authored by stolz's avatar stolz
Browse files

[project @ 2003-10-24 14:45:38 by stolz]

Initialize hp_file for heap profiling (code stolen from Profiling.c).
This bug might suggest some general reviewing of this code-path...

Closes: SF bug [ 827485 ] Heap profile w/ debugging RTS dumps core
http://sourceforge.net/tracker/index.php?func=detail&aid=827485&group_id=8032&atid=108032
parent d59c3f1b
/* -----------------------------------------------------------------------------
* $Id: ProfHeap.c,v 1.48 2003/09/23 15:38:36 simonmar Exp $
* $Id: ProfHeap.c,v 1.49 2003/10/24 14:45:38 stolz Exp $
*
* (c) The GHC Team, 1998-2003
*
......@@ -351,6 +351,7 @@ nextEra( void )
#ifdef DEBUG_HEAP_PROF
FILE *hp_file;
static char *hp_filename;
void initProfiling1( void )
{
......@@ -358,6 +359,20 @@ void initProfiling1( void )
void initProfiling2( void )
{
if (RtsFlags.ProfFlags.doHeapProfile) {
/* Initialise the log file name */
hp_filename = stgMallocBytes(strlen(prog_name) + 6, "hpFileName");
sprintf(hp_filename, "%s.hp", prog_name);
/* open the log file */
if ((hp_file = fopen(hp_filename, "w")) == NULL) {
fprintf(stderr, "Can't open profiling report file %s\n",
hp_filename);
RtsFlags.ProfFlags.doHeapProfile = 0;
return;
}
}
initHeapProfiling();
}
......@@ -407,6 +422,7 @@ initHeapProfiling(void)
initEra( &censuses[era] );
/* initProfilingLogFile(); */
fprintf(hp_file, "JOB \"%s", prog_name);
#ifdef PROFILING
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment