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/include/stats-data.h
ViewVC logotype

Annotation of /sml/trunk/src/runtime/include/stats-data.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 250 - (view) (download) (as text)

1 : monnier 249 /* stats-data.h
2 :     *
3 :     * COPYRIGHT (c) 1994 AT&T Bell Laboratories.
4 :     */
5 :    
6 :     #ifndef _STATS_DATA_
7 :     #define _STATS_DATA_
8 :    
9 :     #ifndef _ML_BASE_
10 :     typedef unsigned int Unsigned32_t;
11 :     #endif
12 :    
13 :     #include "ml-timer.h"
14 :     #include "cntr.h"
15 :    
16 :     typedef struct {
17 :     Time_t startTime; /* the time of initialization */
18 :     Unsigned32_t mask; /* bitmask, telling which things were */
19 :     /* measured */
20 :     Unsigned32_t isNewRuntime; /* true, if this is the new runtime */
21 :     /* new runtime parameters */
22 :     Unsigned32_t allocSzB; /* the size of the allocation space */
23 :     Unsigned32_t numGens; /* the number of generations. */
24 :     /* old runtime parameters */
25 :     Unsigned32_t softmax;
26 :     Unsigned32_t ratio;
27 :     Unsigned32_t pad[8]; /* pad to 64 bytes */
28 :     } stat_hdr_t;
29 :    
30 :     typedef struct {
31 :     cntr_t allocCnt; /* allocation count (in bytes) */
32 :     Unsigned32_t numGens; /* the number of generations collected */
33 :     Time_t startTime;
34 :     Time_t stopTime;
35 :     Unsigned32_t pad[9]; /* pad to 64 bytes */
36 :     } stat_rec_t;
37 :    
38 :     /* mask bits in header */
39 :     #define STATMASK_ALLOC 0x01
40 :     #define STATMASK_NGENS 0x02
41 :     #define STATMASK_START 0x04
42 :     #define STATMASK_STOP 0x08
43 :    
44 :     #ifdef COLLECT_STATS
45 :    
46 :     #define STATS_BUF_SZ (2048/sizeof(stat_rec_t))
47 :    
48 :     extern bool_t StatsOn; /* if TRUE, then generate stats */
49 :     extern int StatsFD; /* the file descriptor to write the data to */
50 :    
51 :     extern stat_rec_t StatsBuf[]; /* buffer of data */
52 :     extern int NStatsRecs; /* the number of records in the buffer */
53 :    
54 :     /* flush out any records in the buffer */
55 :     #define STATS_FLUSH_BUF() { \
56 :     if (NStatsRecs >= 0) { \
57 :     write (StatsFD, (char *)StatsBuf, NStatsRecs*sizeof(stat_rec_t)); \
58 :     NStatsRecs = 0; \
59 :     } \
60 :     }
61 :    
62 :     #define STATS_FINISH() { \
63 :     if (++NStatsRecs >= STATS_BUF_SZ) { \
64 :     write (StatsFD, (char *)StatsBuf, STATS_BUF_SZ*sizeof(stat_rec_t)); \
65 :     NStatsRecs = 0; \
66 :     } \
67 :     }
68 :    
69 :     #endif
70 :    
71 :     #endif /* !_STATS_DATA_ */
72 :    

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