-/* Called on every tick
- */
-
-void
-hs_hpc_tick(int globIx) {
- int threadId = 0; // for now, assume single thread
- // TODO: work out how to get the thread Id to here.
-
-
-#if DEBUG_HPC && DEBUG
- printf("hs_hpc_tick(%d)\n",globIx);
-#endif
- if (!hpc_ticks_inited) {
- char* trace_filename;
- int comma;
- Info *tmpModule;
-
- assert(hpc_inited);
- hpc_ticks_inited = 1;
-
- trace_filename = (char *) malloc(strlen(prog_name) + 6);
- sprintf(trace_filename, "%s.rix", prog_name);
- rixFile = fopen(trace_filename,"w+");
-
- comma = 0;
-
- fprintf(rixFile,"START %s\n",prog_name);
- fprintf(rixFile,"[");
- tmpModule = modules;
- for(;tmpModule != 0;tmpModule = tmpModule->next) {
- if (comma) {
- fprintf(rixFile,",");
- } else {
- comma = 1;
- }
- fprintf(rixFile,"(\"%s\",%u)",
- tmpModule->modName,
- tmpModule->tickCount);
-#if DEBUG_HPC
- fprintf(stderr,"(tracer)%s: %u (offset=%u)\n",
- tmpModule->modName,
- tmpModule->tickCount,
- tmpModule->tickOffset);
-#endif
- }
- fprintf(rixFile,"]\n");
- fflush(rixFile);
- }
- assert(rixFile != 0);
-
- fprintf(rixFile,"%d\n",globIx);
-
-#if DEBUG_HPC
- printf("end: hs_hpc_tick\n");
-#endif
-
-}