dsdb: Provide better error strings in rootdse GUID attribute handling
[Samba.git] / examples / systemtap / generate-winbindd.stp.sh
blob002fb5bf7dcd93a6569568cfe68422cda0835a56
1 #!/bin/sh
3 outfile="$(dirname $0)/winbindd.stp"
5 child_funcs="winbindd_dual_ping
6 winbindd_dual_list_trusted_domains
7 winbindd_dual_init_connection
8 winbindd_dual_pam_auth
9 winbindd_dual_pam_auth_crap
10 winbindd_dual_pam_logoff
11 winbindd_dual_pam_chng_pswd_auth_crap
12 winbindd_dual_pam_chauthtok
13 _wbint_LookupSid
14 _wbint_LookupSids
15 _wbint_LookupName
16 _wbint_Sids2UnixIDs
17 _wbint_UnixIDs2Sids
18 _wbint_AllocateUid
19 _wbint_AllocateGid
20 _wbint_GetNssInfo
21 _wbint_LookupUserAliases
22 _wbint_LookupUserGroups
23 _wbint_QuerySequenceNumber
24 _wbint_LookupGroupMembers
25 _wbint_QueryGroupList
26 _wbint_QueryUserRidList
27 _wbint_DsGetDcName
28 _wbint_LookupRids
29 _wbint_CheckMachineAccount
30 _wbint_ChangeMachineAccount
31 _wbint_PingDc"
33 async_funcs="wb_ping
34 winbindd_lookupsid
35 winbindd_lookupsids
36 winbindd_lookupname
37 winbindd_sids_to_xids
38 winbindd_xids_to_sids
39 winbindd_getpwsid
40 winbindd_getpwnam
41 winbindd_getpwuid
42 winbindd_getsidaliases
43 winbindd_getuserdomgroups
44 winbindd_getgroups
45 winbindd_show_sequence
46 winbindd_getgrgid
47 winbindd_getgrnam
48 winbindd_getusersids
49 winbindd_lookuprids
50 winbindd_setpwent
51 winbindd_getpwent
52 winbindd_endpwent
53 winbindd_dsgetdcname
54 winbindd_getdcname
55 winbindd_setgrent
56 winbindd_getgrent
57 winbindd_endgrent
58 winbindd_list_users
59 winbindd_list_groups
60 winbindd_check_machine_acct
61 winbindd_ping_dc
62 winbindd_pam_auth
63 winbindd_pam_logoff
64 winbindd_pam_chauthtok
65 winbindd_pam_chng_pswd_auth_crap
66 winbindd_wins_byip
67 winbindd_wins_byname
68 winbindd_allocate_uid
69 winbindd_allocate_gid
70 winbindd_change_machine_acct
71 winbindd_pam_auth_crap"
73 backend_funcs="query_user_list
74 enum_dom_groups
75 enum_local_groups
76 name_to_sid
77 sid_to_name
78 rids_to_names
79 lookup_usergroups
80 lookup_useraliases
81 lookup_groupmem
82 sequence_number
83 lockout_policy
84 password_policy
85 trusted_domains"
87 header='#!/usr/bin/stap
89 # Systemtap script to instrument winbindd
91 '"# Generated by examples/systemtap/$(basename $0) on $(date), do not edit
92 #"'
93 # Usage:
95 # Instrument all winbindd processes:
96 # # stap winbindd.stp
98 # Instrument a specific winbindd process:
99 # # stap -x PID winbindd.stp
102 global dc_running, dc_svctime
103 global backend_running, backend_svctime
104 global send_running, recv_running
105 global start_time, idle_time
106 global async_svctime, async_runtime
108 probe begin {
109 printf("Collecting data, press ctrl-C to stop... ")
112 domchild_req_template='
114 # winbind domain child function XXX
117 probe process("winbindd").function("XXX") {
118 dc_running[tid(), "XXX"] = gettimeofday_us()
121 probe process("winbindd").function("XXX").return {
122 if (!([tid(), "XXX"] in dc_running))
123 next
125 end = gettimeofday_us()
126 begin = dc_running[tid(), "XXX"]
127 delete dc_running[tid(), "XXX"]
129 duration = end - begin
130 dc_svctime["XXX"] <<< duration
133 backend_req_template='
135 # winbind domain child backend function XXX
138 probe process("winbindd").function("XXX@../source3/winbindd/winbindd_ads.c") {
139 backend_running[tid(), "XXX"] = gettimeofday_us()
142 probe process("winbindd").function("XXX@../source3/winbindd/winbindd_ads.c").return {
143 if (!([tid(), "XXX"] in backend_running))
144 next
146 end = gettimeofday_us()
147 begin = backend_running[tid(), "XXX"]
148 delete backend_running[tid(), "XXX"]
150 duration = end - begin
151 backend_svctime["XXX"] <<< duration
154 async_req_template='
156 # winbind async function XXX
159 probe process("winbindd").function("XXX_send") {
160 send_running["XXX_send"] = gettimeofday_us()
163 probe process("winbindd").function("XXX_send").return {
164 if (!(["XXX_send"] in send_running))
165 next
167 end = gettimeofday_us()
168 start = send_running["XXX_send"]
169 delete send_running["XXX_send"]
171 start_time["XXX_send", $return] = start
172 idle_time["XXX_send", $return] = end
175 probe process("winbindd").function("XXX_recv") {
176 if (!(["XXX_send", $req] in start_time))
177 next
179 recv_running["XXX_recv"] = gettimeofday_us()
182 probe process("winbindd").function("XXX_recv").return {
183 if (!(["XXX_recv"] in recv_running))
184 next
186 recv_end = gettimeofday_us()
187 recv_start = recv_running["XXX_recv"]
188 delete recv_running["XXX_recv"]
189 recv_runtime = recv_end - recv_start
191 req = @entry($req)
193 send_begin = start_time["XXX_send", req]
194 delete start_time["XXX_send", req]
195 svctime = recv_end - send_begin
197 idle = idle_time["XXX_send", req]
198 delete idle_time["XXX_send", req]
199 runtime = (idle - send_begin) + recv_runtime
201 async_svctime["XXX_send"] <<< svctime
202 async_runtime["XXX_send"] <<< runtime
205 footer='
206 probe end {
207 printf("\n\n")
209 printf("Winbind request service time\n")
210 printf("============================\n")
211 foreach ([name] in async_svctime) {
212 printf("%-40s count: %5d, sum: %6d ms (min: %6d us, avg: %6d us, max: %6d us)\n",
213 name,
214 @count(async_svctime[name]),
215 @sum(async_svctime[name]) / 1000,
216 @min(async_svctime[name]),
217 @avg(async_svctime[name]),
218 @max(async_svctime[name]))
220 printf("\n")
222 printf("Winbind request runtime\n")
223 printf("=======================\n")
224 foreach ([name] in async_runtime) {
225 printf("%-40s count: %5d, sum: %6d ms (min: %6d us, avg: %6d us, max: %6d us)\n",
226 name,
227 @count(async_runtime[name]),
228 @sum(async_runtime[name]) / 1000,
229 @min(async_runtime[name]),
230 @avg(async_runtime[name]),
231 @max(async_runtime[name]))
233 printf("\n")
235 printf("Winbind domain-child request service time\n")
236 printf("=========================================\n")
237 foreach ([name] in dc_svctime) {
238 printf("%-40s count: %5d, sum: %6d ms (min: %6d us, avg: %6d us, max: %6d us)\n",
239 name,
240 @count(dc_svctime[name]),
241 @sum(dc_svctime[name]) / 1000,
242 @min(dc_svctime[name]),
243 @avg(dc_svctime[name]),
244 @max(dc_svctime[name]))
246 printf("\n")
248 printf("Winbind domain-child AD-backend service time\n")
249 printf("============================================\n")
250 foreach ([name] in backend_svctime) {
251 printf("%-40s count: %5d, sum: %6d ms (min: %6d us, avg: %6d us, max: %6d us)\n",
252 name,
253 @count(backend_svctime[name]),
254 @sum(backend_svctime[name]) / 1000,
255 @min(backend_svctime[name]),
256 @avg(backend_svctime[name]),
257 @max(backend_svctime[name]))
259 printf("\n")
261 printf("Winbind request service time distributions (us)\n")
262 printf("===============================================\n")
263 foreach ([name] in async_svctime) {
264 printf("%s:\n", name);
265 println(@hist_log(async_svctime[name]))
267 printf("\n")
269 printf("Winbind request runtime distributions (us)\n")
270 printf("==========================================\n")
271 foreach ([name] in async_runtime) {
272 printf("%s:\n", name);
273 println(@hist_log(async_runtime[name]))
276 printf("Winbind domain-child request service time distributions (us)\n")
277 printf("============================================================\n")
278 foreach ([name] in dc_svctime) {
279 printf("%s:\n", name);
280 println(@hist_log(dc_svctime[name]))
283 printf("Winbind domain-child AD-backend service time distributions (us)\n")
284 printf("===============================================================\n")
285 foreach ([name] in backend_svctime) {
286 printf("%s:\n", name);
287 println(@hist_log(backend_svctime[name]))
291 cat <<EOF > $outfile
292 $header
295 printf "$child_funcs\n" | while read func ; do
296 printf "$domchild_req_template\n" | sed -e s/XXX/$func/g >> $outfile
297 done
299 printf "$backend_funcs\n" | while read func ; do
300 printf "$backend_req_template\n" | sed -e "s|XXX|$func|g" >> $outfile
301 done
303 printf "$async_funcs\n" | while read func ; do
304 printf "$async_req_template\n" | sed -e s/XXX/$func/g >> $outfile
305 done
307 cat <<EOF >>$outfile
308 $footer