So here's a small AWK script to list the unique providers, how many instances of each are there, and how many providers are attached to each PID:

The sudo will ask for an admin password, but it's only needed to get the raw providers list.

sudo dtrace -l | gawk '

// { if($2 in provspids) {

next

}

provspids[$2] = 1;

provname = gensub(/[[:digit:]]+/, "", "g", $2);

pid = gensub(/([^[:digit:]]+)([[:digit:]]*)/, "\\2", "g", $2);

provs[provname]++;

pid = strtonum(pid);

pids[pid]++

}

END {

for (p in provs) {

print p " x " provs[p];

suminstances += provs[p];

sumproviders++

}

print "\n\tproviders = " sumproviders ", provider instances = " suminstances "\n";

for (pid in pids) {

print "PID " pid " has " pids[pid] " providers"

}

}

'

An important detail: the providers without a PID in its name are attributed by the script to a non-existant PID 0, for ease of implementaiton. It's an ugly but useful special case for GAWK, since using purely numerical indexes in a GAWK array causes the array to be traversed in a sorted way – so we end up with a sorted PID list, which for us is perfect. There are other ways to do it, but right now I just want to cleanse this all with fire and get out of AWK. This has already taken like 10 times more than it should. When will I learn to just jump into Python?

The output in my Mac OS X 10.10:

lockstat x 1

security_machserver x 3

sdt x 1

CoreData x 243

CFRunLoop x 265

MetadataImporter x 7

UIFoundation x 164

syscall x 1

profile x 1

fbt x 1

fsinfo x 1

plockstat x 278

ldap_rb_stats x 112

HALS_ObjectMap x 1

opencl_cpu x 35

CoreText x 243

NSXPCProxy x 243

Accessibility x 243

PackageKit x 35

Cocoa_Autorelease x 265

mptcp x 1

LSUA x 232

NSXPCConnection x 243

NSXPCListener x 243

HALS_Engine x 1

vboxdrv x 1

securityd x 1

QLThumbnail x 84

LSSession x 243

NSProgress x 243

io x 1

NSProcessInfo x 243

ip x 1

vImage_api x 243

photostreamagent x 1

Cocoa_Layout x 243

syspolicy x 252

security_debug x 252

mach_trap x 1

boost x 1

HALS_IO x 1

MobileDevice x 5

HALC_IO x 243

SoftwareUpdate x 28

RawCamera x 44

NSAccessibility x 164

magmalloc x 278

JavaScriptCore x 104

distnoted x 3

dispatch x 278

QLSeamlessClosing x 84

ISIconImageRequestor x 167

MetadataFramework x 243

proc x 1

security_exception x 252

QLSeamlessOpening x 81

objc_runtime x 277

QuickTimeX x 90

NSTrackingArea x 164

PROVIDER x 1

CFBundle x 265

codesign x 252

PhotoFoundation x 1

cache x 278

opencl_api x 165

NSAppNap x 265

pluginkit x 69

python x 2

odprobes x 1

CoreImage x 165

ws x 232

tcp x 1

mds x 2

HALS_System x 1

PrintCore x 11

QuartzComposer x 81

Suggestions x 10

RemoteViewServices x 164

NSXPCListenerEndpoint x 243

vminfo x 1

LSApplication x 243

pkd x 1

SceneKit x 2

sched x 1

garbage_collection x 277

afc x 5

NSApplication x 164

dtrace x 1

CFPreferences x 265

CFPreferencesServer x 265

providers = 90, provider instances = 10614

PID 0 has 18 providers

PID 1 has 6 providers

PID 45 has 6 providers

PID 46 has 49 providers

PID 48 has 33 providers

PID 49 has 16 providers

PID 51 has 41 providers

PID 52 has 49 providers

PID 54 has 33 providers

PID 55 has 33 providers

PID 56 has 16 providers

PID 59 has 33 providers

PID 60 has 41 providers

PID 62 has 43 providers

PID 66 has 41 providers

PID 67 has 34 providers

PID 68 has 16 providers

PID 71 has 33 providers

PID 72 has 49 providers

PID 73 has 41 providers

PID 75 has 49 providers

PID 76 has 33 providers

PID 77 has 43 providers

PID 78 has 33 providers

PID 80 has 42 providers

PID 81 has 33 providers

PID 82 has 36 providers

PID 83 has 18 providers

PID 85 has 33 providers

PID 88 has 33 providers

PID 89 has 33 providers

PID 93 has 33 providers

PID 95 has 12 providers

PID 96 has 33 providers

PID 97 has 45 providers

PID 98 has 33 providers

PID 99 has 12 providers

PID 101 has 33 providers

PID 102 has 34 providers

PID 103 has 6 providers

PID 106 has 13 providers

PID 133 has 16 providers

PID 135 has 12 providers

PID 136 has 33 providers

PID 143 has 33 providers

PID 152 has 33 providers

PID 181 has 41 providers

PID 182 has 33 providers

PID 183 has 41 providers

PID 185 has 42 providers

PID 186 has 33 providers

PID 192 has 42 providers

PID 193 has 16 providers

PID 194 has 41 providers

PID 195 has 6 providers

PID 196 has 41 providers

PID 197 has 33 providers

PID 198 has 33 providers

PID 199 has 33 providers

PID 200 has 33 providers

PID 203 has 12 providers

PID 208 has 33 providers

PID 224 has 12 providers

PID 226 has 46 providers

PID 227 has 44 providers

PID 229 has 41 providers

PID 238 has 12 providers

PID 245 has 33 providers

PID 247 has 33 providers

PID 249 has 33 providers

PID 252 has 16 providers

PID 253 has 48 providers

PID 255 has 13 providers

PID 256 has 41 providers

PID 257 has 12 providers

PID 259 has 55 providers

PID 260 has 41 providers

PID 262 has 50 providers

PID 263 has 54 providers

PID 264 has 50 providers

PID 265 has 33 providers

PID 266 has 50 providers

PID 267 has 41 providers

PID 268 has 51 providers

PID 269 has 33 providers

PID 271 has 41 providers

PID 272 has 43 providers

PID 273 has 34 providers

PID 274 has 50 providers

PID 277 has 44 providers

PID 281 has 44 providers

PID 283 has 51 providers

PID 284 has 50 providers

PID 287 has 45 providers

PID 288 has 50 providers

PID 291 has 45 providers

PID 292 has 12 providers

PID 293 has 33 providers

PID 294 has 16 providers

PID 296 has 34 providers

PID 298 has 41 providers

PID 302 has 42 providers

PID 303 has 51 providers

PID 305 has 49 providers

PID 307 has 33 providers

PID 308 has 33 providers

PID 309 has 49 providers

PID 310 has 33 providers

PID 311 has 49 providers

PID 312 has 53 providers

PID 313 has 43 providers

PID 314 has 33 providers

PID 315 has 49 providers

PID 316 has 42 providers

PID 317 has 50 providers

PID 318 has 42 providers

PID 320 has 49 providers

PID 321 has 33 providers

PID 322 has 49 providers

PID 323 has 33 providers

PID 325 has 34 providers

PID 328 has 33 providers

PID 330 has 52 providers

PID 331 has 34 providers

PID 332 has 48 providers

PID 333 has 41 providers

PID 334 has 51 providers

PID 336 has 49 providers

PID 338 has 49 providers

PID 340 has 49 providers

PID 341 has 51 providers

PID 342 has 50 providers

PID 344 has 50 providers

PID 345 has 50 providers

PID 346 has 33 providers

PID 347 has 50 providers

PID 348 has 33 providers

PID 349 has 32 providers

PID 351 has 42 providers

PID 353 has 53 providers

PID 354 has 51 providers

PID 355 has 33 providers

PID 357 has 50 providers

PID 358 has 48 providers

PID 359 has 33 providers

PID 360 has 50 providers

PID 361 has 50 providers

PID 362 has 33 providers

PID 363 has 41 providers

PID 366 has 52 providers

PID 367 has 33 providers

PID 368 has 49 providers

PID 370 has 6 providers

PID 375 has 50 providers

PID 377 has 49 providers

PID 378 has 46 providers

PID 379 has 49 providers

PID 380 has 49 providers

PID 381 has 49 providers

PID 382 has 49 providers

PID 384 has 50 providers

PID 385 has 50 providers

PID 386 has 33 providers

PID 387 has 6 providers

PID 392 has 50 providers

PID 400 has 51 providers

PID 401 has 50 providers

PID 402 has 50 providers

PID 403 has 50 providers

PID 411 has 49 providers

PID 414 has 33 providers

PID 415 has 33 providers

PID 417 has 41 providers

PID 418 has 37 providers

PID 433 has 4 providers

PID 449 has 6 providers

PID 464 has 6 providers

PID 471 has 41 providers

PID 486 has 51 providers

PID 489 has 50 providers

PID 519 has 41 providers

PID 520 has 42 providers

PID 523 has 33 providers

PID 525 has 54 providers

PID 527 has 51 providers

PID 530 has 48 providers

PID 532 has 49 providers

PID 534 has 48 providers

PID 536 has 53 providers

PID 538 has 33 providers

PID 541 has 41 providers

PID 542 has 46 providers

PID 545 has 45 providers

PID 546 has 41 providers

PID 552 has 48 providers

PID 553 has 48 providers

PID 563 has 41 providers

PID 571 has 42 providers

PID 574 has 46 providers

PID 577 has 46 providers

PID 605 has 41 providers

PID 607 has 46 providers

PID 608 has 46 providers

PID 614 has 42 providers

PID 616 has 41 providers

PID 618 has 41 providers

PID 622 has 41 providers

PID 638 has 6 providers

PID 639 has 48 providers

PID 640 has 49 providers

PID 643 has 41 providers

PID 645 has 48 providers

PID 646 has 33 providers

PID 663 has 12 providers

PID 666 has 6 providers

PID 717 has 51 providers

PID 718 has 33 providers

PID 720 has 49 providers

PID 786 has 42 providers

PID 787 has 45 providers

PID 1141 has 50 providers

PID 1344 has 41 providers

PID 1345 has 41 providers

PID 1346 has 33 providers

PID 1425 has 41 providers

PID 1431 has 41 providers

PID 1432 has 33 providers

PID 1482 has 41 providers

PID 2366 has 6 providers

PID 2378 has 34 providers

PID 2379 has 46 providers

PID 2381 has 33 providers

PID 2383 has 34 providers

PID 2384 has 46 providers

PID 2406 has 41 providers

PID 2407 has 13 providers

PID 2408 has 46 providers

PID 2439 has 50 providers

PID 2440 has 50 providers

PID 2442 has 41 providers

PID 2443 has 41 providers

PID 2444 has 33 providers

PID 2475 has 50 providers

PID 2476 has 50 providers

PID 2536 has 33 providers

PID 3243 has 46 providers

PID 3245 has 46 providers

PID 3246 has 33 providers

PID 3300 has 16 providers

PID 3571 has 56 providers

PID 3584 has 42 providers

PID 3671 has 42 providers

PID 3675 has 33 providers

PID 3682 has 34 providers

PID 4320 has 46 providers

PID 4321 has 33 providers

PID 4616 has 54 providers

PID 4621 has 34 providers

PID 4983 has 44 providers

PID 4990 has 44 providers

PID 5086 has 41 providers

PID 5088 has 35 providers

PID 5119 has 41 providers

PID 5120 has 41 providers

PID 5121 has 33 providers

PID 5223 has 51 providers

PID 5377 has 33 providers

PID 5378 has 6 providers

PID 5852 has 33 providers

PID 5864 has 51 providers

PID 5866 has 41 providers

PID 5867 has 41 providers

PID 5868 has 41 providers

PID 5869 has 33 providers

PID 6567 has 42 providers

PID 6615 has 49 providers

PID 6651 has 33 providers

PID 6652 has 12 providers

PID 6653 has 33 providers

## No comments

## Post a Comment