1 /* -----------------------------------------------------------------------------
2 * $Id: Profiling.c,v 1.40 2004/09/03 15:28:37 simonmar Exp $
4 * (c) The GHC Team, 1998-2000
6 * Support for profiling
8 * ---------------------------------------------------------------------------*/
12 #include "PosixSource.h"
16 #include "Profiling.h"
18 #include "Proftimer.h"
22 #include "RetainerProfile.h"
23 #include "LdvProfile.h"
28 * Profiling allocation arena.
33 * Global variables used to assign unique IDs to cc's, ccs's, and
41 /* figures for the profiling report.
43 static ullong total_alloc;
44 static lnat total_prof_ticks;
46 /* Globals for opening the profiling log file(s)
48 static char *prof_filename; /* prof report file name = <program>.prof */
51 static char *hp_filename; /* heap profile (hp2ps style) log file */
54 /* The Current Cost Centre Stack (for attributing costs)
56 CostCentreStack *CCCS;
58 /* Linked lists to keep track of cc's and ccs's that haven't
59 * been declared in the log file yet
62 CostCentreStack *CCS_LIST;
65 * Built-in cost centres and cost-centre stacks:
67 * MAIN is the root of the cost-centre stack tree. If there are
68 * no _scc_s in the program, all costs will be attributed
71 * SYSTEM is the RTS in general (scheduler, etc.). All costs for
72 * RTS operations apart from garbage collection are attributed
75 * GC is the storage manager / garbage collector.
77 * OVERHEAD gets all costs generated by the profiling system
78 * itself. These are costs that would not be incurred
79 * during non-profiled execution of the program.
81 * SUBSUMED is the one-and-only CCS placed on top-level functions.
82 * It indicates that all costs are to be attributed to the
83 * enclosing cost centre stack. SUBSUMED never accumulates
84 * any costs. The is_caf flag is set on the subsumed cost
87 * DONT_CARE is a placeholder cost-centre we assign to static
88 * constructors. It should *never* accumulate any costs.
91 CC_DECLARE(CC_MAIN, "MAIN", "MAIN", CC_IS_BORING, );
92 CC_DECLARE(CC_SYSTEM, "SYSTEM", "MAIN", CC_IS_BORING, );
93 CC_DECLARE(CC_GC, "GC", "GC", CC_IS_BORING, );
94 CC_DECLARE(CC_OVERHEAD, "OVERHEAD_of", "PROFILING", CC_IS_CAF, );
95 CC_DECLARE(CC_SUBSUMED, "SUBSUMED", "MAIN", CC_IS_CAF, );
96 CC_DECLARE(CC_DONT_CARE, "DONT_CARE", "MAIN", CC_IS_BORING, );
98 CCS_DECLARE(CCS_MAIN, CC_MAIN, );
99 CCS_DECLARE(CCS_SYSTEM, CC_SYSTEM, );
100 CCS_DECLARE(CCS_GC, CC_GC, );
101 CCS_DECLARE(CCS_OVERHEAD, CC_OVERHEAD, );
102 CCS_DECLARE(CCS_SUBSUMED, CC_SUBSUMED, );
103 CCS_DECLARE(CCS_DONT_CARE, CC_DONT_CARE, );
106 * Uniques for the XML log-file format
111 #define HEAP_OBJ_UQ 4
112 #define TIME_UPD_UQ 5
113 #define HEAP_UPD_UQ 6
119 static CostCentreStack * ActualPush_ ( CostCentreStack *ccs, CostCentre *cc,
120 CostCentreStack *new_ccs );
121 static rtsBool ccs_to_ignore ( CostCentreStack *ccs );
122 static void count_ticks ( CostCentreStack *ccs );
123 static void inherit_costs ( CostCentreStack *ccs );
124 static void reportCCS ( CostCentreStack *ccs, nat indent );
125 static void DecCCS ( CostCentreStack *ccs );
126 static void DecBackEdge ( CostCentreStack *ccs,
127 CostCentreStack *oldccs );
128 static CostCentreStack * CheckLoop ( CostCentreStack *ccs, CostCentre *cc );
129 static CostCentreStack * pruneCCSTree ( CostCentreStack *ccs );
130 static CostCentreStack * ActualPush ( CostCentreStack *, CostCentre * );
131 static CostCentreStack * IsInIndexTable ( IndexTable *, CostCentre * );
132 static IndexTable * AddToIndexTable ( IndexTable *, CostCentreStack *,
133 CostCentre *, unsigned int );
134 static void ccsSetSelected ( CostCentreStack *ccs );
136 static void initTimeProfiling ( void );
137 static void initProfilingLogFile( void );
139 static void reportCCS_XML ( CostCentreStack *ccs );
141 /* -----------------------------------------------------------------------------
142 Initialise the profiling environment
143 -------------------------------------------------------------------------- */
146 initProfiling1 (void)
148 // initialise our arena
149 prof_arena = newArena();
151 /* for the benefit of allocate()... */
154 /* Initialize counters for IDs */
159 /* Initialize Declaration lists to NULL */
163 /* Register all the cost centres / stacks in the program
164 * CC_MAIN gets link = 0, all others have non-zero link.
166 REGISTER_CC(CC_MAIN);
167 REGISTER_CC(CC_SYSTEM);
169 REGISTER_CC(CC_OVERHEAD);
170 REGISTER_CC(CC_SUBSUMED);
171 REGISTER_CC(CC_DONT_CARE);
172 REGISTER_CCS(CCS_MAIN);
173 REGISTER_CCS(CCS_SYSTEM);
174 REGISTER_CCS(CCS_GC);
175 REGISTER_CCS(CCS_OVERHEAD);
176 REGISTER_CCS(CCS_SUBSUMED);
177 REGISTER_CCS(CCS_DONT_CARE);
181 /* cost centres are registered by the per-module
182 * initialisation code now...
187 initProfiling2 (void)
189 CostCentreStack *ccs, *next;
193 /* Set up the log file, and dump the header and cost centre
194 * information into it. */
195 initProfilingLogFile();
197 /* find all the "special" cost centre stacks, and make them children
200 ASSERT(CCS_MAIN->prevStack == 0);
201 CCS_MAIN->root = CC_MAIN;
202 ccsSetSelected(CCS_MAIN);
205 for (ccs = CCS_LIST; ccs != CCS_MAIN; ) {
206 next = ccs->prevStack;
208 ActualPush_(CCS_MAIN,ccs->cc,ccs);
213 if (RtsFlags.CcFlags.doCostCentres) {
217 if (RtsFlags.ProfFlags.doHeapProfile) {
222 // Decide whether closures with this CCS should contribute to the heap
225 ccsSetSelected( CostCentreStack *ccs )
227 if (RtsFlags.ProfFlags.modSelector) {
228 if (! strMatchesSelector( ccs->cc->module,
229 RtsFlags.ProfFlags.modSelector ) ) {
234 if (RtsFlags.ProfFlags.ccSelector) {
235 if (! strMatchesSelector( ccs->cc->label,
236 RtsFlags.ProfFlags.ccSelector ) ) {
241 if (RtsFlags.ProfFlags.ccsSelector) {
243 for (c = ccs; c != NULL; c = c->prevStack) {
244 if ( strMatchesSelector( c->cc->label,
245 RtsFlags.ProfFlags.ccsSelector )) {
261 initProfilingLogFile(void)
263 /* Initialise the log file name */
264 prof_filename = arenaAlloc(prof_arena, strlen(prog_name) + 6);
265 sprintf(prof_filename, "%s.prof", prog_name);
267 /* open the log file */
268 if ((prof_file = fopen(prof_filename, "w")) == NULL) {
269 debugBelch("Can't open profiling report file %s\n", prof_filename);
270 RtsFlags.CcFlags.doCostCentres = 0;
271 // The following line was added by Sung; retainer/LDV profiling may need
272 // two output files, i.e., <program>.prof/hp.
273 if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_RETAINER)
274 RtsFlags.ProfFlags.doHeapProfile = 0;
278 if (RtsFlags.CcFlags.doCostCentres == COST_CENTRES_XML) {
279 /* dump the time, and the profiling interval */
280 fprintf(prof_file, "\"%s\"\n", time_str());
281 fprintf(prof_file, "\"%d ms\"\n", TICK_MILLISECS);
283 /* declare all the cost centres */
286 for (cc = CC_LIST; cc != NULL; cc = cc->link) {
287 fprintf(prof_file, "%d %d \"%s\" \"%s\"\n",
288 CC_UQ, cc->ccID, cc->label, cc->module);
293 if (RtsFlags.ProfFlags.doHeapProfile) {
294 /* Initialise the log file name */
295 hp_filename = arenaAlloc(prof_arena, strlen(prog_name) + 6);
296 sprintf(hp_filename, "%s.hp", prog_name);
298 /* open the log file */
299 if ((hp_file = fopen(hp_filename, "w")) == NULL) {
300 debugBelch("Can't open profiling report file %s\n",
302 RtsFlags.ProfFlags.doHeapProfile = 0;
309 initTimeProfiling(void)
316 endProfiling ( void )
318 if (RtsFlags.CcFlags.doCostCentres) {
321 if (RtsFlags.ProfFlags.doHeapProfile) {
326 /* -----------------------------------------------------------------------------
327 Set cost centre stack when entering a function.
328 -------------------------------------------------------------------------- */
329 rtsBool entering_PAP;
332 EnterFunCCS ( CostCentreStack *ccsfn )
334 /* PAP_entry has already set CCCS for us */
336 entering_PAP = rtsFalse;
340 if (ccsfn->root->is_caf == CC_IS_CAF) {
341 CCCS = AppendCCS(CCCS,ccsfn);
347 /* -----------------------------------------------------------------------------
348 Cost-centre stack manipulation
349 -------------------------------------------------------------------------- */
352 CostCentreStack * _PushCostCentre ( CostCentreStack *ccs, CostCentre *cc );
354 PushCostCentre ( CostCentreStack *ccs, CostCentre *cc )
355 #define PushCostCentre _PushCostCentre
358 debugBelch("Pushing %s on ", cc->label);
361 return PushCostCentre(ccs,cc);
366 PushCostCentre ( CostCentreStack *ccs, CostCentre *cc )
368 CostCentreStack *temp_ccs;
370 if (ccs == EMPTY_STACK)
371 return ActualPush(ccs,cc);
376 /* check if we've already memoized this stack */
377 temp_ccs = IsInIndexTable(ccs->indexTable,cc);
379 if (temp_ccs != EMPTY_STACK)
382 temp_ccs = CheckLoop(ccs,cc);
383 if (temp_ccs != NULL) {
384 /* we have recursed to an older CCS. Mark this in
385 * the index table, and emit a "back edge" into the
388 ccs->indexTable = AddToIndexTable(ccs->indexTable,temp_ccs,cc,1);
389 DecBackEdge(temp_ccs,ccs);
392 return ActualPush(ccs,cc);
399 static CostCentreStack *
400 CheckLoop ( CostCentreStack *ccs, CostCentre *cc )
402 while (ccs != EMPTY_STACK) {
405 ccs = ccs->prevStack;
410 /* Append ccs1 to ccs2 (ignoring any CAF cost centre at the root of ccs1 */
413 CostCentreStack *_AppendCCS ( CostCentreStack *ccs1, CostCentreStack *ccs2 );
415 AppendCCS ( CostCentreStack *ccs1, CostCentreStack *ccs2 )
416 #define AppendCCS _AppendCCS
420 debugBelch("Appending ");
425 return AppendCCS(ccs1,ccs2);
430 AppendCCS ( CostCentreStack *ccs1, CostCentreStack *ccs2 )
432 CostCentreStack *ccs = NULL;
438 if (ccs2->cc->is_caf == CC_IS_CAF) {
442 if (ccs2->prevStack != NULL) {
443 ccs = AppendCCS(ccs1, ccs2->prevStack);
446 return PushCostCentre(ccs,ccs2->cc);
449 static CostCentreStack *
450 ActualPush ( CostCentreStack *ccs, CostCentre *cc )
452 CostCentreStack *new_ccs;
454 /* allocate space for a new CostCentreStack */
455 new_ccs = (CostCentreStack *) arenaAlloc(prof_arena, sizeof(CostCentreStack));
457 return ActualPush_(ccs, cc, new_ccs);
460 static CostCentreStack *
461 ActualPush_ ( CostCentreStack *ccs, CostCentre *cc, CostCentreStack *new_ccs )
463 /* assign values to each member of the structure */
464 new_ccs->ccsID = CCS_ID++;
466 new_ccs->prevStack = ccs;
468 new_ccs->indexTable = EMPTY_TABLE;
470 /* Initialise the various _scc_ counters to zero
472 new_ccs->scc_count = 0;
474 /* Initialize all other stats here. There should be a quick way
475 * that's easily used elsewhere too
477 new_ccs->time_ticks = 0;
478 new_ccs->mem_alloc = 0;
479 new_ccs->inherited_ticks = 0;
480 new_ccs->inherited_alloc = 0;
482 new_ccs->root = ccs->root;
484 // Set the selected field.
485 ccsSetSelected(new_ccs);
487 /* update the memoization table for the parent stack */
488 if (ccs != EMPTY_STACK)
489 ccs->indexTable = AddToIndexTable(ccs->indexTable, new_ccs, cc,
490 0/*not a back edge*/);
492 /* make sure this CC is declared at the next heap/time sample */
495 /* return a pointer to the new stack */
500 static CostCentreStack *
501 IsInIndexTable(IndexTable *it, CostCentre *cc)
503 while (it!=EMPTY_TABLE)
511 /* otherwise we never found it so return EMPTY_TABLE */
517 AddToIndexTable(IndexTable *it, CostCentreStack *new_ccs,
518 CostCentre *cc, unsigned int back_edge)
522 new_it = arenaAlloc(prof_arena, sizeof(IndexTable));
525 new_it->ccs = new_ccs;
527 new_it->back_edge = back_edge;
533 DecCCS(CostCentreStack *ccs)
535 if (prof_file && RtsFlags.CcFlags.doCostCentres == COST_CENTRES_XML) {
536 if (ccs->prevStack == EMPTY_STACK)
537 fprintf(prof_file, "%d %d 1 %d\n", CCS_UQ,
538 ccs->ccsID, ccs->cc->ccID);
540 fprintf(prof_file, "%d %d 2 %d %d\n", CCS_UQ,
541 ccs->ccsID, ccs->cc->ccID, ccs->prevStack->ccsID);
546 DecBackEdge( CostCentreStack *ccs, CostCentreStack *oldccs )
548 if (prof_file && RtsFlags.CcFlags.doCostCentres == COST_CENTRES_XML) {
549 if (ccs->prevStack == EMPTY_STACK)
550 fprintf(prof_file, "%d %d 1 %d\n", CCS_UQ,
551 ccs->ccsID, ccs->cc->ccID);
553 fprintf(prof_file, "%d %d 2 %d %d\n", CCS_UQ,
554 ccs->ccsID, ccs->cc->ccID, oldccs->ccsID);
558 /* -----------------------------------------------------------------------------
559 Generating a time & allocation profiling report.
560 -------------------------------------------------------------------------- */
562 /* We omit certain system-related CCs and CCSs from the default
563 * reports, so as not to cause confusion.
566 cc_to_ignore (CostCentre *cc)
568 if ( cc == CC_OVERHEAD
569 || cc == CC_DONT_CARE
571 || cc == CC_SYSTEM) {
579 ccs_to_ignore (CostCentreStack *ccs)
581 if ( ccs == CCS_OVERHEAD
582 || ccs == CCS_DONT_CARE
584 || ccs == CCS_SYSTEM) {
591 /* -----------------------------------------------------------------------------
592 Generating the aggregated per-cost-centre time/alloc report.
593 -------------------------------------------------------------------------- */
595 static CostCentre *sorted_cc_list;
598 aggregate_cc_costs( CostCentreStack *ccs )
602 ccs->cc->mem_alloc += ccs->mem_alloc;
603 ccs->cc->time_ticks += ccs->time_ticks;
605 for (i = ccs->indexTable; i != 0; i = i->next) {
607 aggregate_cc_costs(i->ccs);
613 insert_cc_in_sorted_list( CostCentre *new_cc )
615 CostCentre **prev, *cc;
617 prev = &sorted_cc_list;
618 for (cc = sorted_cc_list; cc != NULL; cc = cc->link) {
619 if (new_cc->time_ticks > cc->time_ticks) {
632 report_per_cc_costs( void )
634 CostCentre *cc, *next;
636 aggregate_cc_costs(CCS_MAIN);
637 sorted_cc_list = NULL;
639 for (cc = CC_LIST; cc != NULL; cc = next) {
641 if (cc->time_ticks > total_prof_ticks/100
642 || cc->mem_alloc > total_alloc/100
643 || RtsFlags.CcFlags.doCostCentres >= COST_CENTRES_ALL) {
644 insert_cc_in_sorted_list(cc);
648 fprintf(prof_file, "%-30s %-20s", "COST CENTRE", "MODULE");
649 fprintf(prof_file, "%6s %6s", "%time", "%alloc");
650 if (RtsFlags.CcFlags.doCostCentres >= COST_CENTRES_VERBOSE) {
651 fprintf(prof_file, " %5s %9s", "ticks", "bytes");
653 fprintf(prof_file, "\n\n");
655 for (cc = sorted_cc_list; cc != NULL; cc = cc->link) {
656 if (cc_to_ignore(cc)) {
659 fprintf(prof_file, "%-30s %-20s", cc->label, cc->module);
660 fprintf(prof_file, "%6.1f %6.1f",
661 total_prof_ticks == 0 ? 0.0 : (cc->time_ticks / (StgFloat) total_prof_ticks * 100),
662 total_alloc == 0 ? 0.0 : (cc->mem_alloc / (StgFloat)
666 if (RtsFlags.CcFlags.doCostCentres >= COST_CENTRES_VERBOSE) {
667 fprintf(prof_file, " %5lu %9llu", cc->time_ticks, cc->mem_alloc);
669 fprintf(prof_file, "\n");
672 fprintf(prof_file,"\n\n");
675 /* -----------------------------------------------------------------------------
676 Generate the cost-centre-stack time/alloc report
677 -------------------------------------------------------------------------- */
680 fprint_header( void )
682 fprintf(prof_file, "%-24s %-10s individual inherited\n", "", "");
684 fprintf(prof_file, "%-24s %-50s", "COST CENTRE", "MODULE");
685 fprintf(prof_file, "%6s %10s %5s %5s %5s %5s", "no.", "entries", "%time", "%alloc", "%time", "%alloc");
687 if (RtsFlags.CcFlags.doCostCentres >= COST_CENTRES_VERBOSE) {
688 fprintf(prof_file, " %5s %9s", "ticks", "bytes");
689 #if defined(PROFILING_DETAIL_COUNTS)
690 fprintf(prof_file, " %8s %8s %8s %8s %8s %8s %8s",
691 "closures", "thunks", "funcs", "PAPs", "subfuns", "subcafs", "cafssub");
695 fprintf(prof_file, "\n\n");
699 reportCCSProfiling( void )
702 char temp[128]; /* sigh: magic constant */
706 total_prof_ticks = 0;
708 count_ticks(CCS_MAIN);
710 switch (RtsFlags.CcFlags.doCostCentres) {
713 case COST_CENTRES_XML:
720 fprintf(prof_file, "\t%s Time and Allocation Profiling Report (%s)\n",
721 time_str(), "Final");
723 fprintf(prof_file, "\n\t ");
724 fprintf(prof_file, " %s", prog_name);
725 fprintf(prof_file, " +RTS");
726 for (count = 0; rts_argv[count]; count++)
727 fprintf(prof_file, " %s", rts_argv[count]);
728 fprintf(prof_file, " -RTS");
729 for (count = 1; prog_argv[count]; count++)
730 fprintf(prof_file, " %s", prog_argv[count]);
731 fprintf(prof_file, "\n\n");
733 fprintf(prof_file, "\ttotal time = %11.2f secs (%lu ticks @ %d ms)\n",
734 total_prof_ticks / (StgFloat) TICK_FREQUENCY,
735 total_prof_ticks, TICK_MILLISECS);
737 fprintf(prof_file, "\ttotal alloc = %11s bytes",
738 ullong_format_string(total_alloc * sizeof(W_),
739 temp, rtsTrue/*commas*/));
741 #if defined(PROFILING_DETAIL_COUNTS)
742 fprintf(prof_file, " (%lu closures)", total_allocs);
744 fprintf(prof_file, " (excludes profiling overheads)\n\n");
746 report_per_cc_costs();
748 inherit_costs(CCS_MAIN);
751 reportCCS(pruneCCSTree(CCS_MAIN), 0);
755 reportCCS(CostCentreStack *ccs, nat indent)
762 /* Only print cost centres with non 0 data ! */
764 if ( RtsFlags.CcFlags.doCostCentres >= COST_CENTRES_ALL ||
765 ! ccs_to_ignore(ccs))
766 /* force printing of *all* cost centres if -P -P */
769 fprintf(prof_file, "%-*s%-*s %-50s",
770 indent, "", 24-indent, cc->label, cc->module);
772 fprintf(prof_file, "%6d %11.0f %5.1f %5.1f %5.1f %5.1f",
773 ccs->ccsID, (double) ccs->scc_count,
774 total_prof_ticks == 0 ? 0.0 : ((double)ccs->time_ticks / (double)total_prof_ticks * 100.0),
775 total_alloc == 0 ? 0.0 : ((double)ccs->mem_alloc / (double)total_alloc * 100.0),
776 total_prof_ticks == 0 ? 0.0 : ((double)ccs->inherited_ticks / (double)total_prof_ticks * 100.0),
777 total_alloc == 0 ? 0.0 : ((double)ccs->inherited_alloc / (double)total_alloc * 100.0)
780 if (RtsFlags.CcFlags.doCostCentres >= COST_CENTRES_VERBOSE) {
781 fprintf(prof_file, " %5lu %9llu", ccs->time_ticks, ccs->mem_alloc*sizeof(W_));
782 #if defined(PROFILING_DETAIL_COUNTS)
783 fprintf(prof_file, " %8ld %8ld %8ld %8ld %8ld %8ld %8ld",
784 ccs->mem_allocs, ccs->thunk_count,
785 ccs->function_count, ccs->pap_count,
786 ccs->subsumed_fun_count, ccs->subsumed_caf_count,
787 ccs->caffun_subsumed);
790 fprintf(prof_file, "\n");
793 for (i = ccs->indexTable; i != 0; i = i->next) {
795 reportCCS(i->ccs, indent+1);
801 /* Traverse the cost centre stack tree and accumulate
805 count_ticks(CostCentreStack *ccs)
809 if (!ccs_to_ignore(ccs)) {
810 total_alloc += ccs->mem_alloc;
811 total_prof_ticks += ccs->time_ticks;
813 for (i = ccs->indexTable; i != NULL; i = i->next)
819 /* Traverse the cost centre stack tree and inherit ticks & allocs.
822 inherit_costs(CostCentreStack *ccs)
826 if (ccs_to_ignore(ccs)) { return; }
828 ccs->inherited_ticks += ccs->time_ticks;
829 ccs->inherited_alloc += ccs->mem_alloc;
831 for (i = ccs->indexTable; i != NULL; i = i->next)
833 inherit_costs(i->ccs);
834 ccs->inherited_ticks += i->ccs->inherited_ticks;
835 ccs->inherited_alloc += i->ccs->inherited_alloc;
841 static CostCentreStack *
842 pruneCCSTree( CostCentreStack *ccs )
844 CostCentreStack *ccs1;
845 IndexTable *i, **prev;
847 prev = &ccs->indexTable;
848 for (i = ccs->indexTable; i != 0; i = i->next) {
849 if (i->back_edge) { continue; }
851 ccs1 = pruneCCSTree(i->ccs);
859 if ( (RtsFlags.CcFlags.doCostCentres >= COST_CENTRES_ALL
860 /* force printing of *all* cost centres if -P -P */ )
862 || ( ccs->indexTable != 0 )
863 || ( ccs->scc_count || ccs->time_ticks || ccs->mem_alloc )
871 /* -----------------------------------------------------------------------------
872 Generate the XML time/allocation profile
873 -------------------------------------------------------------------------- */
876 gen_XML_logfile( void )
878 fprintf(prof_file, "%d %lu", TIME_UPD_UQ, total_prof_ticks);
880 reportCCS_XML(pruneCCSTree(CCS_MAIN));
882 fprintf(prof_file, " 0\n");
888 reportCCS_XML(CostCentreStack *ccs)
893 if (ccs_to_ignore(ccs)) { return; }
897 fprintf(prof_file, " 1 %d %llu %lu %llu",
898 ccs->ccsID, ccs->scc_count, ccs->time_ticks, ccs->mem_alloc);
900 for (i = ccs->indexTable; i != 0; i = i->next) {
902 reportCCS_XML(i->ccs);
908 fprintCCS( FILE *f, CostCentreStack *ccs )
911 for (; ccs && ccs != CCS_MAIN; ccs = ccs->prevStack ) {
912 fprintf(f,"%s.%s", ccs->cc->module, ccs->cc->label);
913 if (ccs->prevStack && ccs->prevStack != CCS_MAIN) {
922 debugCCS( CostCentreStack *ccs )
925 for (; ccs && ccs != CCS_MAIN; ccs = ccs->prevStack ) {
926 debugBelch("%s.%s", ccs->cc->module, ccs->cc->label);
927 if (ccs->prevStack && ccs->prevStack != CCS_MAIN) {
935 #endif /* PROFILING */