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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 249 - (view) (download) (as text)
Original Path: sml/branches/SMLNJ/src/runtime/mach-dep/unix-prof.c

1 : monnier 249 /* unix-prof.c
2 :     *
3 :     * COPYRIGHT (c) 1996 AT&T Research.
4 :     *
5 :     * SML Profiling support for Unix.
6 :     */
7 :     #include "ml-unixdep.h"
8 :     #include "signal-sysdep.h"
9 :     #include "ml-base.h"
10 :     #include "ml-values.h"
11 :     #include "ml-objects.h"
12 :     #include "ml-globals.h"
13 :     #include "profile.h"
14 :    
15 :    
16 :     /* The pointer to the heap allocated array of call counts.
17 :     * When this pointer is ML_unit, then profiling is disabled.
18 :     */
19 :     ml_val_t ProfCntArray = ML_unit;
20 :    
21 :     /* local routines */
22 :     PVT SigReturn_t ProfSigHandler ();
23 :    
24 :    
25 :     /* EnableProfSignals:
26 :     */
27 :     void EnableProfSignals ()
28 :     {
29 :     SIG_SetHandler (SIGVTALRM, ProfSigHandler);
30 :    
31 :     } /* end of EnableProfSignals */
32 :    
33 :     /* DisableProfSignals:
34 :     */
35 :     void DisableProfSignals ()
36 :     {
37 :     SIG_SetHandler (SIGVTALRM, SIG_DFL);
38 :    
39 :     } /* end of DisableProfSignals */
40 :    
41 :     /* ProfSigHandler:
42 :     *
43 :     * The handler for SIGVTALRM signals.
44 :     */
45 :     PVT SigReturn_t ProfSigHandler ()
46 :     {
47 :     Word_t *arr = PTR_MLtoC(Word_t, ProfCntArray);
48 :     int indx = INT_MLtoC(DEREF(ProfCurrent));
49 :    
50 :     arr[indx]++;
51 :    
52 :     } /* end of ProfSigHandler */
53 :    

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