Annotation of OpenXM_contrib/PHC/Ada/System/unix_resource_usage.ads, Revision 1.1.1.1
1.1 maekawa 1: with System;
2:
3: package Unix_Resource_Usage is
4:
5: type Process_Times is private;
6:
7: type times_enum is (self, children);
8:
9: type page_seconds is new integer;
10:
11: -- expressed in units of pages * clock ticks (1 tick = 1/50 second).
12: -- The value is calculated by summing the number of shared memory
13: -- pages in use each time the internal system clock ticks, and then
14: -- averaging over 1 second intervals.
15:
16: function Get_Process_Times ( who : times_enum := self ) return Process_Times;
17:
18: function Total_Time_of ( times: in Process_Times ) return duration;
19:
20: function User_CPU_Time_Of ( times: in Process_Times ) return duration;
21:
22: function System_CPU_Time_Of ( times: in Process_Times ) return duration;
23:
24: function Max_Resident_Set_Size_of ( times: in Process_Times ) return natural;
25:
26: function Shared_Pages_Value_of ( times: in Process_Times )
27: return page_seconds;
28:
29: -- DESCRIPTION :
30: -- returns the amount of memory used by the text segment which was
31: -- also shared among other processes.
32:
33: function Unshared_Data_Pages_Value_of ( times: in Process_Times )
34: return page_seconds;
35:
36: -- DESCRIPTION :
37: -- returns the amount of unshared memory residing in the data segment
38: -- of the process.
39:
40: function Stack_Pages_Value_of ( times: in Process_Times ) return page_seconds;
41:
42: -- DESCRIPTION :
43: -- returns the amount of unshared memory residing in the stack segment
44: -- of the process
45:
46: function Non_IO_Page_Faults_of ( times: in Process_Times ) return natural;
47:
48: -- DESCRIPTION :
49: -- returns the number of page faults serviced without any I/O activity;
50: -- here I/O activity is avoided by "reclaiming" a page frame from the
51: -- list of pages awaiting reallocation.
52:
53: function IO_Page_Faults_of ( times: in Process_Times ) return natural;
54:
55: -- DESCRIPTION :
56: -- returns the number of page faults serviced which required I/O activity.
57:
58: function Swaps_of ( times : in Process_Times ) return natural;
59:
60: -- DESCRIPTION :
61: -- returns the number of times the process was swapped out of main memory.
62:
63: function Input_Blocks_of ( times : in Process_Times ) return natural;
64:
65: -- DESCRIPTION :
66: -- returns the number of times the file system had to perform input.
67:
68: function Output_Blocks_of ( times : in Process_Times ) return natural;
69:
70: -- DESCRIPTION :
71: -- returns the number of times the file system had to perform output.
72:
73: function Socket_Messages_Sent_of ( times : in Process_Times ) return natural;
74:
75: -- DESCRIPTION :
76: -- returns the number of messages sent over sockets.
77:
78: function Socket_Messages_Received_of ( times : in Process_Times )
79: return natural;
80: -- DESCRIPTION :
81: -- returns the number of messages received over sockets.
82:
83: function Signals_Delivered_of ( times : in Process_Times ) return natural;
84:
85: -- DESCRIPTION :
86: -- returns the number of signals delivered.
87:
88: function Voluntary_Context_Switches_of ( times: in Process_Times )
89: return natural;
90: -- DESCRIPTION :
91: -- returns the number of times a context switch resulted due to a process
92: -- voluntarily giving up the processor before its time slice was completed
93: -- (usually to await availability of a resource).
94:
95: function Involuntary_Context_Switches_of ( times: in Process_Times )
96: return natural;
97: -- DESCRIPTION :
98: -- returns the number of times a context switch resulted due to a
99: -- higher priority process becoming runnable or because the current
100: -- process exceeded its time slice.
101:
102: private
103:
104: type timeval is record
105: tv_sec : integer; -- Ada integer is C/SunOS long
106: tv_usec : integer; -- Ada integer is C/SunOS long
107: end record;
108:
109: type rusage is record
110: ru_utime : timeval;
111: ru_stime : timeval;
112: ru_maxrss : integer;
113: ru_ixrss : integer; -- integral shared text memory size
114: ru_idrss : integer; -- integral unshared data size
115: ru_isrss : integer; -- integral unshared stack size
116: ru_minflt : integer; -- page reclaims
117: ru_majflt : integer; -- page faults
118: ru_nswap : integer; -- swaps
119: ru_inblock : integer; -- block input operations
120: ru_outblock : integer; -- block output operations
121: ru_msgsnd : integer; -- messages sent
122: ru_msgrcv : integer; -- messages received
123: ru_nsignals : integer; -- signals received
124: ru_nvcsw : integer; -- voluntary context switches
125: ru_nivcsw : integer; -- involuntary context switches
126: end record;
127:
128: type process_times is new rusage;
129:
130: pragma inline (get_process_times, total_time_of, user_cpu_time_of,
131: system_cpu_time_of, max_resident_set_size_of,
132: shared_pages_value_of, unshared_data_pages_value_of,
133: stack_pages_value_of, non_io_page_faults_of,
134: io_page_faults_of, swaps_of, input_blocks_of,
135: output_blocks_of, socket_messages_sent_of,
136: socket_messages_received_of, signals_delivered_of,
137: voluntary_context_switches_of,
138: involuntary_context_switches_of);
139:
140: end Unix_Resource_Usage;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>