File: PolyMLStatistics.html

package info (click to toggle)
polyml 5.6-8
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 31,892 kB
  • ctags: 34,453
  • sloc: cpp: 44,983; ansic: 24,520; asm: 14,850; sh: 11,730; makefile: 551; exp: 484; python: 253; awk: 91; sed: 9
file content (102 lines) | stat: -rw-r--r-- 4,278 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>The PolyML.Statistics structure</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="docstyle.css" rel="stylesheet" type="text/css">
</head>

<body>
<ul class="nav">
	<li><a href="PolyMLStatistics.html">Previous</a></li>
	<li><a href="PolyMLStructure.html">Up</a></li>
	<li><a href="#">Next</a></li>
</ul>
<h2><font face="Arial"><strong>PolyML.Statistics structure</strong></font></h2>
<p>The PolyML.Statistics structure provides a way for a program to read information 
  about the run-time system. As well as getting information about the local Poly/ML 
  process it is also possible to get information about another Poly/ML process 
  being run by the same user.</p>
<PRE class="mainsig"><STRONG>structure</STRONG> Statistics:
  <strong>sig</strong>
    <strong>val</strong> getLocalStats : unit ->
       {sizeHeap: int,
       gcFullGCs: int,
       timeGCUser: Time.time,
       threadsInML: int,
       gcPartialGCs: int,
       threadsTotal: int,
       timeGCSystem: Time.time,
       userCounters: int vector,
       threadsWaitIO: int,
       timeNonGCUser: Time.time,
       sizeAllocation: int,
       timeNonGCSystem: Time.time,
       threadsWaitMutex: int,
       threadsWaitSignal: int,
       sizeAllocationFree: int,
       sizeHeapFreeLastGC: int,
       threadsWaitCondVar: int,
       sizeHeapFreeLastFullGC: int}

    <strong>val</strong> getRemoteStats : int ->
       {sizeHeap: int,
       gcFullGCs: int,
       timeGCUser: Time.time,
       threadsInML: int,
       gcPartialGCs: int,
       threadsTotal: int,
       timeGCSystem: Time.time,
       userCounters: int vector,
       threadsWaitIO: int,
       timeNonGCUser: Time.time,
       sizeAllocation: int,
       timeNonGCSystem: Time.time,
       threadsWaitMutex: int,
       threadsWaitSignal: int,
       sizeAllocationFree: int,
       sizeHeapFreeLastGC: int,
       threadsWaitCondVar: int,
       sizeHeapFreeLastFullGC: int}

    <strong>val</strong> setUserCounter : int * int -> unit
    <strong>val</strong> numUserCounters : unit -> int
<strong>end</strong></PRE>
<p>There are two functions that return information..</p>
<div class="entryBlock"><PRE class="entrycode"><STRONG>val</STRONG> getLocalStats : unit -&gt; { ... }</PRE>
<div class="entrytext"> Returns information about the Poly/ML 
  process that has called this function.</div>
</div>
<div class="entryBlock"><PRE class="entrycode"><STRONG>val</STRONG> getRemoteStats : int -&gt; { ... }</PRE>
<div class="entrytext"> 
  <p>Returns information about another Poly/ML process. The argument is the process 
    id (pid) of the Poly/ML process for which information is requested. Raises 
    the Fail exception if this is not a currently running Poly/ML process or the 
    calling user does not have permission to read the statistics. The statistics 
    are held in shared memory and on Unix systems these are memory-mapped files 
    in the user's .polyml directory.</p>
</div>
</div><p>The actual information returned is still being determined and may well change.</p>
<p>In addition to information about the run-time system the statistics mechanism 
  provides a small array of values that can be set by the ML code. This allows 
  an ML program to set values that can be read in another process.</p>
<div class="entryBlock"><PRE class="entrycode"><STRONG>val</STRONG> numUserCounters : unit -&gt; int</PRE>
<div class="entrytext"> <p>Returns the number of counters available. 
  Currently this is eight.</p></div>
</div>
<div class="entryBlock">
<PRE class="entrycode"><STRONG>val</STRONG> setUserCounter : int * int -> unit</PRE>
<div class="entrytext"> 
  <p>setUserCounter(n, m) stores the value m in the n-th counter.</p>
</div>
</div><p>Writing to the counters is potentially an expensive operation. If the information 
  is likely to change rapidly it will usually be best to use a separate thread 
  to poll the information periodically and update the counter.</p>
<ul class="nav">
	<li><a href="PolyMLStatistics.html">Previous</a></li>
	<li><a href="PolyMLStructure.html">Up</a></li>
	<li><a href="#">Next</a></li>
</ul>
</body>
</html>