Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/runtime/mach-dep/unix-prof.c
ViewVC logotype

View of /sml/trunk/src/runtime/mach-dep/unix-prof.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 250 - (download) (as text) (annotate)
Sat Apr 17 18:57:03 1999 UTC (21 years, 1 month ago) by monnier
File size: 997 byte(s)
This commit was generated by cvs2svn to compensate for changes in r249,
which included commits to RCS files with non-trunk default branches.
/* unix-prof.c
 *
 * COPYRIGHT (c) 1996 AT&T Research.
 *
 * SML Profiling support for Unix.
 */
#include "ml-unixdep.h"
#include "signal-sysdep.h"
#include "ml-base.h"
#include "ml-values.h"
#include "ml-objects.h"
#include "ml-globals.h"
#include "profile.h"


/* The pointer to the heap allocated array of call counts.
 * When this pointer is ML_unit, then profiling is disabled.
 */
ml_val_t	ProfCntArray = ML_unit;

/* local routines */
PVT SigReturn_t ProfSigHandler ();


/* EnableProfSignals:
 */
void EnableProfSignals ()
{
    SIG_SetHandler (SIGVTALRM, ProfSigHandler);

} /* end of EnableProfSignals */

/* DisableProfSignals:
 */
void DisableProfSignals ()
{
    SIG_SetHandler (SIGVTALRM, SIG_DFL);

} /* end of DisableProfSignals */

/* ProfSigHandler:
 *
 * The handler for SIGVTALRM signals.
 */
PVT SigReturn_t ProfSigHandler ()
{
    Word_t	*arr = PTR_MLtoC(Word_t, ProfCntArray);
    int		indx = INT_MLtoC(DEREF(ProfCurrent));

    arr[indx]++;

} /* end of ProfSigHandler */


root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0