4
\f0\froman Times New Roman;
5
\f1\fdecor Courier New;}
11
\red255\green255\blue0;}
22
{\uldb Introduction}{\v intro}
25
{\uldb Starting and Connecting OSIDebug}{\v startup}
28
{\uldb Sleep Info}{\v sleep}
31
{\uldb Lock Info}{\v lock}
38
${\footnote Introduction}
41
\fs40\cf2 Introduction\cf0\fs25
44
The osidebug program retrieves information from running programs using
45
the OSI package (libosi.lib). The information you can retrieve depends
46
partly upon the information that the programmer is gathering, but can include
47
information on blocked processes and held locks.
53
${\footnote Starting OSIDebug}
56
\fs40\cf2 Starting OSIDebug\cf0\fs25
59
The osidebug program is started by running it through the program manager
68
It starts by bringing up a window.
71
To debug any program, you must know the RPC NSI name space entry that the
72
program has exported its debugging interface to; this is the name parameter that
73
was passed to \f1 osi_InitDebug()\f0 in the application program.
76
You specify this name to \f1osidebug\f0 by clicking on the RPC NSI name entry window
77
(it will have a default name beginning with "/.:/<something>" in it already) and typing
78
the RPC NSI name, including the "/.:", that your server is using.
81
Your next step is to connect the \f1osidebug\f0 to the program by clicking on the
82
\f1Debug Server\f0 button. At this time, \f1osidebug\f0 will bind to the server, or
83
display an error number in the status line at the bottom of the window if it fails.
86
If the program succeeds at binding to your application, it will display "Done." at the
87
bottom of the display, and will display a set of collection names in the "Collections"
91
You can click on any of the collection names and \f1osidebug\f0 will retrieve that collection
92
and place it in the "Results" window. There are three collections exported generically, the
93
"types" collection, which lists the collection names, the "sleep" collection, which provides
94
information on sleeping threads, and the "lock" collection, which provides information on
95
locking statistics, assuming that the application is gathering that information.
98
There isn't much more to say about the "types" collection. The remaining collections are
99
described in more detail in the next sections.
102
You can quit the program by clicking on the \f1Quit\f0 button.
105
You can rebind to the server at any time by clicking on the \f1Debug Server\f0 button again.
106
The \f1osidebug\f0 program will reload the set of collection names at this time, and
107
re-establish the RPC bindings. You will also need to use this button if the application being
108
debugged is restarted, since the old RPC binding will go bad at this time, and attempts to
109
view collections of information will fail.
112
It is also possible for users to define their own named collections of data to be viewed by
113
the \f1osidebug\f0 program. See the documentation from your application program for the
114
detailed information on those information collections.
120
${\footnote Sleep Information}
123
\fs40\cf2 Getting Sleep Information\cf0\fs25
126
You can click on the "sleep" collection name and \f1osidebug\f0 will retrieve
127
information on sleeping threads, if any.
130
For each blocked thread, \f1osidebug\f0 will display several lines. The first line is
131
labelled "Sleep address", and gives the hex value of the sleep value passed to the
132
OSI sleep function; if the thread is sleeping waiting for a lock or mutex to become
133
available, this will be the address of the lock.
136
The second line gives the thread ID of the blocked thread.
139
The third line, labelled "States", gives the state of the sleeping thread's sleep control
140
block. This is an OR-ed bit mask of the following bits:
144
#define OSI_SLEEPINFO_SIGNALLED 1 /* thread has been signalled */ \line
145
#define OSI_SLEEPINFO_INHASH 2 /* sleep info is in hash table */ \line
146
#define OSI_SLEEPINFO_DELETED 4 /* sleep info will be deleted when refcount is 0 */ \line
150
Typically, you'll just see the INHASH state set, indicating that the block is in the hash
151
table (where it is while the thread is blocked); this will be reported as a States value of
152
2. Infrequently, you may see the other state bits set, which typically indicates that
153
the \f1osidebug\f0 program caught the system between the time that the thread was woken by
154
a call to \f1osiwakeup\f0 and the time that the newly woken thread started executing. These
155
other states should be transient; if a block stays in one of these states for an appreciable
156
amount of time, it probably indicates a bug in the OSI package.
162
${\footnote Lock Information}
165
\fs40\cf2 Getting Lock Information\cf0\fs25
168
You can click on the "lock" collection name and \f1osidebug\f0 will retrieve
169
information on locks initialized in statistics gathering mode (created after the
170
application programmer calls osi_LockTypeSetDefault("stat")).
173
When you do so, \f1osidebug\f0 will retrieve information about the currently known
174
locks and display this information in the "Results" window. The information consists of
178
The "Lock name" gives the name passed in as the second parameter to the lock's initialization
179
call, when the programmer called \f1lock_InitializeMutex\f0 or \f1lock_InitializeRWLock\f0.
180
The programmer should choose a usefully mnemonic name.
183
The "Lock address" field gives the address of the lock structure in hex. If some thread
184
is waiting for this lock, it will be sleeping with the same address as its sleep value.
187
The "Writer count" is the count of the number of threads holding this lock for writing.
188
Since write locks can be held by at most one thread at a time, this count will be either 0,
189
if the lock is not held, or 1 if it is held. If the lock is a mutex object, rather than a
190
read/write lock, this field will be used to indicate whether someone is holding the mutex.
193
The "Reader count" is the count of the number of threads holding the lock for reading.
194
Since multiple readers can lock a read/write lock concurrently, this count may be anything from
195
0, indicating that the lock isn't read locked at all, to any number. This field should never
196
be non-zero at the same time that the "Writer count" field is also non-zero. For mutex locks,
197
this counter is always zero.
200
The "Are waiters" field is zero if there are no threads waiting to obtain this lock in a
201
mode incompatible with the way that it is currently held, or 1 if there are threads waiting for
205
The "Write-locked time" field gives the number of milliseconds that this lock has been write
206
locked (or locked at all, if this is a mutex) by any thread.
209
The "Write-locked count" field gives the number of calls that obtained this lock for writing
210
(or that obtained the mutex at all, if this is a mutex).
213
The "Write-blocked time" field gives the number of milliseconds that threads trying to
214
obtain a write lock (or any mutex) have been waiting for this lock or mutex.
217
The "Write-blocked count" gives the number of calls to write-lock a read/write lock, or
218
the number of calls to obtain a mutex, that blocked due to a lock conflict.
221
The "Read-locked time", "Read-locked count", "Read-blocked time" and "Read-blocked count" fields
222
give the corresponding information for readers obtaining read/write locks. These fields are
223
not displayed for mutexes, since their information is inapplicable to those types of locks.